| | |
| | | " WHERE empStatus =0; \n" + |
| | | "</script>") |
| | | int updateSeniority(); |
| | | |
| | | @Update("<script> " + |
| | | " update t_emp_baseinfo set deptName=(select DEPT_NAME from t_dept where DEPT_ID=deptId), \n" + |
| | | " allDeptName=(select allDeptName from t_dept where DEPT_ID=deptId), \n" + |
| | | " modifyTime=now(); \n" + |
| | | "</script>") |
| | | int updateDeptName(); |
| | | |
| | | } |
| | |
| | | List<EmpBaseInfo> listAll(QueryWrapper<EmpBaseInfo> wrapper); |
| | | |
| | | boolean updateSeniority(); |
| | | |
| | | boolean updateDeptName(); |
| | | } |
| | |
| | | public boolean updateSeniority() { |
| | | return empBaseInfoMapper.updateSeniority()>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateDeptName() { |
| | | return empBaseInfoMapper.updateDeptName()>0; |
| | | } |
| | | } |
| | |
| | | log.info("每天凌晨1点计算一次工龄"); |
| | | empBaseInfoService.updateSeniority(); |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 2 * * ?") |
| | | public void updateDeptName(){ |
| | | log.info("每天凌晨2点更新部门名称和全称"); |
| | | empBaseInfoService.updateDeptName(); |
| | | } |
| | | @Override |
| | | public void run(String... args) throws Exception { |
| | | calculateSeniority(); |
| | | updateDeptName(); |
| | | } |
| | | } |