能力申请前端传用户部门id时,更新用户部门id(存在用户原有部门被删除的情况 屮)

This commit is contained in:
wangliwen 2022-09-16 10:53:17 +08:00
parent e539922487
commit 8e5648b964
2 changed files with 11 additions and 1 deletions

View File

@ -100,7 +100,10 @@ public class AbilityCenterControllerV3 {
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程"); return new Result().error("联系管理员添加流程");
} }
// 前端传了部门id更新该用户部门id
if (abilityBatchApplicationDTO.getDeptId() != null) {
jdbcTemplate.update(String.format("UPDATE sys_user SET dept_id = %d WHERE id = %d;", abilityBatchApplicationDTO.getDeptId(), abilityBatchApplicationDTO.getUserId()));
}
List<Map<String, Object>> system_ = jdbcTemplate.queryForList("SELECT `name` AS resourceName,id AS resourceId FROM tb_data_resource WHERE type = '应用资源' AND del_flag = 0;"); List<Map<String, Object>> system_ = jdbcTemplate.queryForList("SELECT `name` AS resourceName,id AS resourceId FROM tb_data_resource WHERE type = '应用资源' AND del_flag = 0;");
if (system_.isEmpty()) { if (system_.isEmpty()) {
return new Result().error("无应用资源"); return new Result().error("无应用资源");
@ -140,6 +143,10 @@ public class AbilityCenterControllerV3 {
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程"); return new Result().error("联系管理员添加流程");
} }
// 前端传了部门id更新该用户部门id
if (abilityBatchApplicationDTO.getDeptId() != null) {
jdbcTemplate.update(String.format("UPDATE sys_user SET dept_id = %d WHERE id = %d;", abilityBatchApplicationDTO.getDeptId(), abilityBatchApplicationDTO.getUserId()));
}
final String applyFlag = UUID.randomUUID().toString(); final String applyFlag = UUID.randomUUID().toString();
abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识 abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识
logger.info("申请入参{}", JSON.toJSONString(abilityBatchApplicationDTO)); logger.info("申请入参{}", JSON.toJSONString(abilityBatchApplicationDTO));

View File

@ -75,4 +75,7 @@ public class TAbilityBatchApplicationDTO extends AuditingBaseDTO implements Seri
@ApiModelProperty(value = "资源所属部门信息") @ApiModelProperty(value = "资源所属部门信息")
private SysDeptDTO resourceOwnerDept; private SysDeptDTO resourceOwnerDept;
@ApiModelProperty(value = "申请人部门id")
private Long deptId;
} }