From f9520fc15269ef31129637fa18f90e7179a28f8f Mon Sep 17 00:00:00 2001 From: Lihx Date: Fri, 20 Sep 2024 00:17:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2UserId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SiteInfoController.java | 63 +++++++++++++++++++ .../inspection/mapper/SiteInfoMapper.java | 8 +++ .../inspection/service/ISiteInfoService.java | 11 ++++ .../service/impl/SiteInfoServiceImpl.java | 35 +++++++++++ .../mapper/inspection/SiteInfoMapper.xml | 18 ++++++ 5 files changed, 135 insertions(+) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/SiteInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/SiteInfoController.java index 0602d3ee..38cae4b0 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/SiteInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/SiteInfoController.java @@ -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存放老Id,value存放新Id + Map 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 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); + } + + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/SiteInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/SiteInfoMapper.java index 34e51f1a..9d7b0e0b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/SiteInfoMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/SiteInfoMapper.java @@ -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); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ISiteInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ISiteInfoService.java index e137eddc..ac9533a9 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ISiteInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/ISiteInfoService.java @@ -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); + + + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/SiteInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/SiteInfoServiceImpl.java index 4951c95a..cc9aad2b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/SiteInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/SiteInfoServiceImpl.java @@ -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); + } + + } diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/SiteInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/SiteInfoMapper.xml index 019a493e..5e4dbfc5 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/SiteInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/SiteInfoMapper.xml @@ -153,5 +153,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update rescue_info set user_id = #{newUserId} where user_id = #{oldUserId} + + + + update rescue_order_info set validation_user_id = #{newUserId} where user_id = #{oldUserId} + + + + update rescue_order_info set user_id = #{newUserId} where user_id = #{oldUserId} + + + update rescue_order_return set user_id = #{newUserId} where user_id = #{oldUserId} + + + update driver_info set user_id = #{newUserId} where user_id = #{oldUserId} + +