替换UserId

This commit is contained in:
Lihx 2024-09-20 00:17:38 +08:00
parent 4e5a0d3f63
commit f9520fc152
5 changed files with 135 additions and 0 deletions

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.inspection.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -121,4 +124,64 @@ public class SiteInfoController extends BaseController
return success(sum);
}
/**
* 修改user_id
*/
@GetMapping("/updateUserID")
public CommonResult updateUserId(){
//Map key存放老Idvalue存放新Id
Map<Integer, Integer> map = new HashMap<>();
map.put(135,4826);
map.put(855,4828);
map.put(896,4829);
map.put(900,4830);
map.put(901,4221);
map.put(902,4832);
map.put(903,123);
map.put(904,846);
map.put(905,125);
map.put(907,850);
map.put(908,845);
map.put(909,4568);
map.put(910,4839);
map.put(911,4840);
map.put(912,4841);
map.put(913,4842);
map.put(914,4843);
map.put(915,4844);
map.put(916,4845);
map.put(917,4846);
map.put(918,4847);
map.put(919,138);
map.put(920,4849);
map.put(921,4850);
map.put(924,4851);
map.put(926,4853);
map.put(927,2793);
map.put(928,4855);
map.put(929,842);
map.put(930,4857);
map.put(931,4858);
map.put(932,908);
map.put(933,4860);
map.put(934,4861);
map.put(935,4862);
map.put(936,4863);
int sum = 0;
//遍历Map获得key和value
for (Map.Entry<Integer, Integer> userId : map.entrySet()) {
Integer oldUserId = userId.getKey();
Integer newUserId = userId.getValue();
sum +=siteInfoService.updateUserId1(newUserId ,oldUserId);
sum +=siteInfoService.updateUserId2(newUserId ,oldUserId);
sum +=siteInfoService.updateUserId3(newUserId ,oldUserId);
sum +=siteInfoService.updateUserId4(newUserId ,oldUserId);
sum +=siteInfoService.updateUserId5(newUserId ,oldUserId);
}
return success(sum);
}
}

View File

@ -80,4 +80,12 @@ public interface SiteInfoMapper
*/
public int addAll(NweUsers user);
/**
* 修改user_id
*/
public int updateUserId1(@Param("newUserId") int newUserId,@Param("oldUserId") int oldUserId);
public int updateUserId2(@Param("newUserId") int newUserId,@Param("oldUserId") int oldUserId);
public int updateUserId3(@Param("newUserId") int newUserId,@Param("oldUserId") int oldUserId);
public int updateUserId4(@Param("newUserId") int newUserId,@Param("oldUserId") int oldUserId);
public int updateUserId5(@Param("newUserId") int newUserId,@Param("oldUserId") int oldUserId);
}

View File

@ -78,4 +78,15 @@ public interface ISiteInfoService
public int addNewDB(NweUsers user);
/**
* 修改user_id
*/
public int updateUserId1(int newUserId,int oldUserId);
public int updateUserId2(int newUserId,int oldUserId);
public int updateUserId3(int newUserId,int oldUserId);
public int updateUserId4(int newUserId,int oldUserId);
public int updateUserId5(int newUserId,int oldUserId);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.service.impl;
import java.util.List;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.inspection.entity.NweUsers;
import cn.iocoder.yudao.util.DateUtils;
import com.alibaba.fastjson.JSONObject;
@ -124,5 +125,39 @@ public class SiteInfoServiceImpl implements ISiteInfoService
return siteInfoMapper.addAll(user);
}
/**
* 修改user_id 5个SQL
*/
@Override
@TenantIgnore
public int updateUserId1(int newUserId, int oldUserId) {
return siteInfoMapper.updateUserId1(newUserId, oldUserId);
}
@Override
@TenantIgnore
public int updateUserId2(int newUserId, int oldUserId) {
return siteInfoMapper.updateUserId2(newUserId, oldUserId);
}
@Override
@TenantIgnore
public int updateUserId3(int newUserId, int oldUserId) {
return siteInfoMapper.updateUserId3(newUserId, oldUserId);
}
@Override
@TenantIgnore
public int updateUserId4(int newUserId, int oldUserId) {
return siteInfoMapper.updateUserId4(newUserId, oldUserId);
}
@Override
@TenantIgnore
public int updateUserId5(int newUserId, int oldUserId) {
return siteInfoMapper.updateUserId5(newUserId, oldUserId);
}
}

View File

@ -153,5 +153,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateUserId1" >
update rescue_info set user_id = #{newUserId} where user_id = #{oldUserId}
</update>
<update id="updateUserId2" >
update rescue_order_info set validation_user_id = #{newUserId} where user_id = #{oldUserId}
</update>
<update id="updateUserId3" >
update rescue_order_info set user_id = #{newUserId} where user_id = #{oldUserId}
</update>
<update id="updateUserId4" >
update rescue_order_return set user_id = #{newUserId} where user_id = #{oldUserId}
</update>
<update id="updateUserId5" >
update driver_info set user_id = #{newUserId} where user_id = #{oldUserId}
</update>
</mapper>