Quellcode durchsuchen

登录新增修改iotuserid

丁治程 vor 2 Monaten
Ursprung
Commit
a09025399e

+ 2 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockUser/mapper/InterlockUserMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import org.jeecg.modules.interlockUser.entity.InterlockUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.system.entity.SysUser;
@@ -23,4 +24,5 @@ public interface InterlockUserMapper extends BaseMapper<InterlockUser> {
     @Select("delete from sys_user where username=#{wiseUser}")
     SysUser delSysUserByUserName(@Param("wiseUser") String wiseUser);
 
+    int updateIotUserId(@Param("userId") String userId,@Param("iotUserId") String iotUserId);
 }

+ 3 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockUser/mapper/xml/InterlockUserMapper.xml

@@ -2,4 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.interlockUser.mapper.InterlockUserMapper">
 
+    <update id="updateIotUserId">
+        update interlock_user set iot_userid = #{iotUserId} where id = #{userId}
+    </update>
 </mapper>

+ 1 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockUser/service/IInterlockUserService.java

@@ -61,4 +61,5 @@ public interface IInterlockUserService extends IService<InterlockUser> {
     //根据用户名查找用户信息
     InterlockUser getInterlockUserByUserName(String wiseUser);
 
+    int updateIotUserId(String userId, String iotUserId);
 }

+ 4 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockUser/service/impl/InterlockUserServiceImpl.java

@@ -380,4 +380,8 @@ public class InterlockUserServiceImpl extends ServiceImpl<InterlockUserMapper, I
         return interlockUserMapper.getInterlockUserByUserName(wiseUser);
     }
 
+    @Override
+    public int updateIotUserId(String userId, String iotUserId) {
+        return interlockUserMapper.updateIotUserId(userId, iotUserId);
+    }
 }

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/service/IIotedgeCollectDataService.java

@@ -33,5 +33,5 @@ public interface IIotedgeCollectDataService extends IService<IotedgeCollectData>
 
     Map<String, Object> getAllGroup();
 
-    String addIoTedgeUser(String userName,String ssoRole,InterlockUser interlockUser, String elToken);
+    String addIoTedgeUser(String userName,String ssoRole,String userId, String elToken);
 }

+ 3 - 3
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/service/impl/IotedgeCollectDataServiceImpl.java

@@ -338,7 +338,7 @@ public class IotedgeCollectDataServiceImpl extends ServiceImpl<IotedgeCollectDat
     }
 
     @Override
-    public String addIoTedgeUser(String userName, String ssoRole, InterlockUser interlockUser, String elToken) {
+    public String addIoTedgeUser(String userName, String ssoRole, String userId, String elToken) {
         String result = "200";
 
         try {
@@ -346,8 +346,8 @@ public class IotedgeCollectDataServiceImpl extends ServiceImpl<IotedgeCollectDat
             String code = (String) jsonObject.get("code");
             String iotUserId = (String) jsonObject.get("userId");
 
-            interlockUser.setIotUserid(iotUserId);
-            interlockUserService.updateById(interlockUser);
+            //interlockUser.setIotUserid(iotUserId);
+            interlockUserService.updateIotUserId(userId,iotUserId);
 
             String rloe = "";
             if ("globalAdmin".equals(ssoRole)){

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/ssoClient/controller/SSOLoginLogoutController.java

@@ -574,7 +574,7 @@ public class SSOLoginLogoutController {
                 interlockSystemLimitService.saveBatch(interlockSystemLimitList);
             }
 
-            iotedgeCollectDataService.addIoTedgeUser(username,ssoRole,interlockUser,elToken);
+            iotedgeCollectDataService.addIoTedgeUser(username,ssoRole,userId,elToken);
 
             baseCommonService.addLog("添加用户,username: " + username, CommonConstant.LOG_TYPE_2, 2);
         } catch (Exception e) {