feat(部门信息修改时同步更新人员信息表中的部门):
| | |
| | | @Scheduled(cron = "0 0 2 * * ?") |
| | | public void updateDeptName(){ |
| | | log.info("每天凌晨2点更新部门名称和全称"); |
| | | empBaseInfoService.updateDeptName(); |
| | | // empBaseInfoService.updateDeptName(); |
| | | } |
| | | @Override |
| | | public void run(String... args) throws Exception { |
| | | calculateSeniority(); |
| | | updateDeptName(); |
| | | // updateDeptName(); |
| | | } |
| | | } |
| | |
| | | " where allDeptName like #{queryParam}" + |
| | | "</script>") |
| | | public void changeAllDeptName(@Param("fromName") String fromName, @Param("toName") String toName,@Param("queryParam") String queryParam); |
| | | |
| | | @Update("<script>" + |
| | | " update t_emp_baseinfo\n" + |
| | | " set allDeptName = replace(allDeptName, #{fromName}, #{toName})" + |
| | | " where allDeptName like #{queryParam}" + |
| | | "</script>") |
| | | public void updateEmpAllDeptName(@Param("fromName") String fromName, @Param("toName") String toName,@Param("queryParam") String queryParam); |
| | | |
| | | @Update("<script>" + |
| | | " update t_emp_baseinfo \n" + |
| | | " set deptName = #{newDeptName} \n" + |
| | | " where deptId = #{queryParam} \n" + |
| | | "</script>") |
| | | public void updateEmpDeptName(@Param("newDeptName") String newDeptName,@Param("queryParam") String queryParam); |
| | | } |
| | |
| | | } |
| | | String oldAllName = dept.getAllDeptName(); |
| | | String newAllName = createALlDeptName(dept); |
| | | Long deptId = dept.getDeptId(); |
| | | String newDeptName = dept.getDeptName(); |
| | | dept.setModifyTime(new Date()); |
| | | this.baseMapper.updateById(dept); |
| | | |
| | | deptMapper.changeAllDeptName(oldAllName,newAllName,oldAllName + "%"); |
| | | deptMapper.updateEmpAllDeptName(oldAllName,newAllName,oldAllName + "%"); |
| | | deptMapper.updateEmpDeptName(newDeptName,deptId.toString()); |
| | | } |
| | | |
| | | @Override |