浏览代码

update staff search info

add_swagger
cyril.tsui 8 个月前
父节点
当前提交
75e6e18035
共有 2 个文件被更改,包括 12 次插入2 次删除
  1. +7
    -1
      src/main/java/com/ffii/tsms/modules/data/entity/projections/StaffSearchInfo.kt
  2. +5
    -1
      src/main/java/com/ffii/tsms/modules/data/web/StaffsController.kt

+ 7
- 1
src/main/java/com/ffii/tsms/modules/data/entity/projections/StaffSearchInfo.kt 查看文件

@@ -1,6 +1,7 @@
package com.ffii.tsms.modules.data.entity.projections

import org.springframework.beans.factory.annotation.Value
import java.time.LocalDate

/**
* Projection for {@link com.ffii.tsms.modules.data.entity.Staff}
@@ -9,6 +10,12 @@ interface StaffSearchInfo {
val id: Long?
val staffId: String?
val name: String?
val departDate: LocalDate?

@get:Value("#{target.departDate == null " +
"|| (target.departDate?.isBefore(T(java.time.LocalDate).now()) == false " +
"&& target.departDate?.isEqual(T(java.time.LocalDate).now()) == false)}")
val active: Boolean?

@get:Value("#{target.team?.code}")
val team: String?
@@ -24,5 +31,4 @@ interface StaffSearchInfo {

@get:Value("#{target.user?.id}")
val userId: Long?

}

+ 5
- 1
src/main/java/com/ffii/tsms/modules/data/web/StaffsController.kt 查看文件

@@ -14,6 +14,7 @@ import liquibase.hub.model.Project
import org.springframework.http.HttpStatus
import org.springframework.web.bind.ServletRequestBindingException
import org.springframework.web.bind.annotation.*
import java.time.LocalDate


@RestController
@@ -25,7 +26,10 @@ class StaffsController(private val staffsService: StaffsService) {
}
@GetMapping
fun allStaff(): List<StaffSearchInfo> {
return staffsService.allStaff()
return staffsService.allStaff().sortedWith(compareBy( { when (it.active) {
true -> 0
else -> 1 // false
}}, { it.staffId }))
}

@GetMapping("/noteam")


正在加载...
取消
保存