|
|
@@ -10,6 +10,7 @@ import com.ffii.tsms.modules.data.entity.TeamRepository |
|
|
|
import com.ffii.tsms.modules.data.entity.SkillRepository
|
|
|
|
import com.ffii.tsms.modules.data.entity.SalaryEffectiveRepository
|
|
|
|
import com.ffii.tsms.modules.data.entity.DepartmentRepository
|
|
|
|
import com.ffii.tsms.modules.data.entity.projections.StaffSearchInfo
|
|
|
|
import com.ffii.tsms.modules.project.web.models.NewStaffRequest
|
|
|
|
// import com.ffii.tsms.modules.data.web.models.NewStaffRequest
|
|
|
|
import org.springframework.stereotype.Service
|
|
|
@@ -35,18 +36,26 @@ public final class StaffsService( |
|
|
|
return staffRepository.findAll()
|
|
|
|
}
|
|
|
|
|
|
|
|
fun fetchStaffList(args: Map<String, Any>): List<Map<String, Any>> {
|
|
|
|
val sql = StringBuilder("select"
|
|
|
|
+ " s.*,"
|
|
|
|
+ " date_format(s.created, '%Y-%m-%d') as created,"
|
|
|
|
+ " date_format(s.departDate, '%Y-%m-%d') as departDate,"
|
|
|
|
+ " date_format(s.joinDate, '%Y-%m-%d') as joinDate"
|
|
|
|
+ " from staff s"
|
|
|
|
+ " where s.deleted = false"
|
|
|
|
)
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args)
|
|
|
|
fun allStaff(): List<StaffSearchInfo> {
|
|
|
|
return staffRepository.findStaffSearchInfoBy();
|
|
|
|
}
|
|
|
|
|
|
|
|
// fun fetchStaffList(args: Map<String, Any>): List<Map<String, Any>> {
|
|
|
|
// val sql = StringBuilder("select"
|
|
|
|
// + " s.*,"
|
|
|
|
// + " date_format(s.created, '%Y-%m-%d') as created,"
|
|
|
|
// + " date_format(s.departDate, '%Y-%m-%d') as departDate,"
|
|
|
|
// + " date_format(s.joinDate, '%Y-%m-%d') as joinDate"
|
|
|
|
// + " from staff s"
|
|
|
|
// + " where s.deleted = false"
|
|
|
|
// )
|
|
|
|
// if (args != null) {
|
|
|
|
// if (args.containsKey("staffId"))
|
|
|
|
// sql.append(" AND s.staffId = :staffId ");
|
|
|
|
// }
|
|
|
|
// return jdbcDao.queryForList(sql.toString(), args)
|
|
|
|
// }
|
|
|
|
|
|
|
|
fun saveStaff(req: NewStaffRequest): Staff {
|
|
|
|
val user = userRepository.findById(req.userId).orElseThrow()
|
|
|
|
val currentPosition = positionRepository.findById(req.currentPositionId).orElseThrow()
|
|
|
|