Commit f948c4d56102378bb9bd4864650f53e7c7ac25ae
1 parent
f2dbade8
1.
Showing
1 changed file
with
1 additions
and
1 deletions
src/main/java/com/bsth/handler/PersonnelUpdateHandler.java
| @@ -141,7 +141,7 @@ public class PersonnelUpdateHandler { | @@ -141,7 +141,7 @@ public class PersonnelUpdateHandler { | ||
| 141 | logger.info(String.format("根据身份证号关联更新工号、姓名、公司、工种,记录数%d",rows)); | 141 | logger.info(String.format("根据身份证号关联更新工号、姓名、公司、工种,记录数%d",rows)); |
| 142 | // 可能会出现数据异常情况 如一个是最新的工号无身份证号,一个是老的工号有身份证号,最后更新的结果会造成工号和身份证号重复 | 142 | // 可能会出现数据异常情况 如一个是最新的工号无身份证号,一个是老的工号有身份证号,最后更新的结果会造成工号和身份证号重复 |
| 143 | // 将更晚创建的人员信息destroy更新为2 | 143 | // 将更晚创建的人员信息destroy更新为2 |
| 144 | - rows = jdbcTemplate.update("update bsth_c_personnel x INNER JOIN (select card,max(id) id from bsth_c_personnel a where destroy = 0 and LENGTH(a.card) > 1 and a.locked = 0) y on x.id = y.id set x.destroy = 2"); | 144 | + rows = jdbcTemplate.update("update bsth_c_personnel x INNER JOIN (select card,max(id) id from bsth_c_personnel a where destroy = 0 and LENGTH(a.card) > 1 and a.locked = 0 GROUP BY card) y on x.id = y.id set x.destroy = 2"); |
| 145 | logger.info(String.format("同一个人,临时将更晚创建的人员destroy更新为2,记录数%d",rows)); | 145 | logger.info(String.format("同一个人,临时将更晚创建的人员destroy更新为2,记录数%d",rows)); |
| 146 | // 将更早创建的人员信息更新为停用 | 146 | // 将更早创建的人员信息更新为停用 |
| 147 | rows = jdbcTemplate.update("update bsth_c_personnel set destroy = 1 where destroy = 0"); | 147 | rows = jdbcTemplate.update("update bsth_c_personnel set destroy = 1 where destroy = 0"); |