Althars123 3 лет назад
Родитель
Сommit
7526f495c5

+ 1 - 1
twzd-admin/src/main/java/com/miaxis/system/controller/system/SysLoginController.java

@@ -139,7 +139,7 @@ public class SysLoginController
         WxUserInfo wxUserInfo = new WxUserInfo();
         wxUserInfo.setOpenid("ovKTX5-FKLF6_sgTtCIXpG_lz3PY");
         wxUserInfo.setUnionid("oqEKX6GxPyBPfRbM-Bk01CGwA0oM");
-        wxUserInfo.setNickname("Sss");
+        wxUserInfo.setNickname("Althars");
         wxUserInfo.setSex("0");
         wxUserInfo.setHeadimgurl("https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83erGMFzKaOmz6cIaA0J1nicWSlBLdLKY46N5CNCoASiajT7Z3RIfPngPhJsjmqsSjGCFibPU4vCtfz3aw/132");
         String token = loginService.login(wxUserInfo,null, StudentLoginTypeEnum.AUTHORIZATION_CODE_LOGIN.getCode());

+ 1 - 1
twzd-framework/src/main/java/com/miaxis/framework/web/service/UserDetailsServiceImpl.java

@@ -89,7 +89,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
                     userService.saveUserInfo(userInfo);
                 }else {
                     userInfo.setXcxOpenid((String) ServletUtils.getRequest().getAttribute("xcxOpenid"));
-                    userService.updateStudent(userInfo);
+                    userService.updateXcxOpenid(userInfo);
                 }
                 return createLoginUser(identification);
             }

+ 2 - 0
twzd-system/src/main/java/com/miaxis/system/mapper/SysUserMapper.java

@@ -125,4 +125,6 @@ public interface SysUserMapper
     void updateSysUserByNickName(@Param("schoolName")String schoolName, @Param("total")Integer total);
 
     UserInfo getStudentByUnionid(String identification);
+
+    void updateXcxOpenid(UserInfo userInfo);
 }

+ 2 - 0
twzd-system/src/main/java/com/miaxis/system/service/ISysUserService.java

@@ -186,4 +186,6 @@ public interface ISysUserService
     void updateSysUserByNickName(String schoolName, Integer total);
 
     UserInfo getStudentByUnionid(String identification);
+
+    void updateXcxOpenid(UserInfo userInfo);
 }

+ 5 - 0
twzd-system/src/main/java/com/miaxis/system/service/impl/SysUserServiceImpl.java

@@ -483,4 +483,9 @@ public class SysUserServiceImpl implements ISysUserService
     public UserInfo getStudentByUnionid(String identification) {
         return userMapper.getStudentByUnionid(identification);
     }
+
+    @Override
+    public void updateXcxOpenid(UserInfo userInfo) {
+        userMapper.updateXcxOpenid(userInfo);
+    }
 }

+ 6 - 11
twzd-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -109,19 +109,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</insert>
 	<insert id="updateStudent" parameterType="com.miaxis.common.core.domain.entity.UserInfo" >
 		update user_info set
-		<if test="headImage != null and headImage != ''">
 			head_image = #{headImage},
-		</if>
-		<if test="nickName != null and nickName != ''">
 			nick_name = #{nickName},
-		</if>
-		<if test="openid != null and openid != ''">
-			openid = #{openid},
-		</if>
-		<if test="xcxOpenid != null and xcxOpenid != ''">
-			xcx_openid = #{xcxOpenid},
-		</if>
-		union_id = #{unionId}
+			openid = #{openid}
+		where union_id = #{unionId}
+	</insert>
+	<insert id="updateXcxOpenid" parameterType="com.miaxis.common.core.domain.entity.UserInfo" >
+		update user_info set
+			xcx_openid = #{xcxOpenid}
 		where union_id = #{unionId}
 	</insert>