diff --git a/src/main/java/com/ffii/tsms/modules/data/service/TeamService.kt b/src/main/java/com/ffii/tsms/modules/data/service/TeamService.kt index b77ce64..04a6bc3 100644 --- a/src/main/java/com/ffii/tsms/modules/data/service/TeamService.kt +++ b/src/main/java/com/ffii/tsms/modules/data/service/TeamService.kt @@ -67,6 +67,7 @@ open class TeamService( open fun updateTeam(req: NewTeamRequest, team: Team): Team { val addIds = req.addStaffIds ?: listOf() + val oldTeamLead = team.staff.id val teamLead: Staff // val teamName: String // val teamCode: String @@ -106,6 +107,18 @@ open class TeamService( } } + val newTeamLead = teamLead?.id +// if ((oldTeamLead != null && oldTeamLead > 0) && (newTeamLead != null && newTeamLead > 0)) { + if (oldTeamLead != newTeamLead) { + val sql = StringBuilder("update project" + + " set teamlead = :newTeamLead where teamlead = :oldTeamLead" + ) + + val args = mapOf("newTeamLead" to teamLead?.id, "oldTeamLead" to newTeamLead) + + jdbcDao.executeUpdate(sql.toString(), args) + } + return team }