Pārlūkot izejas kodu

教师基本信息,绑定手机号

tags/正式3.2.0
雍文秀 pirms 2 gadiem
vecāks
revīzija
eec2b4585f

+ 3
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java Parādīt failu

@@ -204,4 +204,7 @@ public interface UserMapper extends TkMapper<TUser> {
204 204
 
205 205
     //根据用户id获取绑定方式
206 206
     Map getBindById(Integer userid);
207
+
208
+    //获取手机号绑定的其他用户数量
209
+    Integer getNumByUserPhone(Integer userid, String userphone);
207 210
 }

+ 3
- 0
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java Parādīt failu

@@ -867,6 +867,9 @@ public class UserService extends JedisUtil {
867 867
     public ResultVo bindUserPhone(Integer userid, String userphone, Integer msgcode) {
868 868
         ResultVo resultVo = getCodeResultVo(userphone, msgcode);
869 869
         if (resultVo != null) return resultVo;
870
+        //获取手机号绑定的其他用户数量
871
+        Integer num = userMapper.getNumByUserPhone(userid, userphone);
872
+        if (num != 0) return new ResultVo(1, "该手机号已被其他账号绑定");
870 873
         userMapper.bindUserPhone(userid, userphone);
871 874
         return new ResultVo(0, "绑定手机成功");
872 875
     }

+ 7
- 4
suser/src/main/resources/mapper/system/UserMapper.xml Parādīt failu

@@ -95,12 +95,11 @@
95 95
         <result property="usertime" column="usertime"></result>
96 96
         <result property="createtime" column="createtime"></result>
97 97
         <result property="rolename" column="rolename"></result>
98
-        <result property="lsbname" column="lsbname"></result>
99
-        <!--<collection property="lsblist" ofType="java.util.Map" javaType="java.util.List">
98
+        <collection property="lsblist" ofType="java.util.Map" javaType="java.util.List">
100 99
             <result property="subjectname" column="subjectname"></result>
101 100
             <result property="versionname" column="versionname"></result>
102 101
             <result property="lsbname" column="lsbname"></result>
103
-        </collection>-->
102
+        </collection>
104 103
         <collection property="classlist" ofType="java.util.Map"
105 104
                     javaType="java.util.List" select="listTeacherClass" column="{userid=userid,classtype=classtype,year=year}">
106 105
         </collection>
@@ -123,7 +122,7 @@
123 122
     <!--教师基本信息-->
124 123
     <select id="getTeacherInfo" resultMap="teacherInfoMap">
125 124
         select u.userid,u.username,u.headpic,u.loginname,u.usersex,u.userphone,u.usertime,u.createtime
126
-        ,s.subjectname,group_concat(concat(s.subjectname,'-',v.versionname,'-',sb.lsbname) separator '    ')lsbname
125
+        ,s.subjectname,v.versionname,sb.lsbname
127 126
         ,(select group_concat(r.rolename separator '  ')
128 127
         from t_user_role ur left join t_role r on ur.roleid=r.roleid where ur.userid=#{userid})rolename
129 128
         ,#{classtype} classtype,#{year} year
@@ -196,6 +195,10 @@
196 195
         select userphone,bindphoned,bindsecret
197 196
         from t_user where userid=#{userid} limit 1
198 197
     </select>
198
+    <!--获取手机号绑定的其他用户数量-->
199
+    <select id="getNumByUserPhone" resultType="java.lang.Integer">
200
+        select count(*) from t_user where userid!=#{userid} and userphone=#{userphone}
201
+    </select>
199 202
 
200 203
 
201 204
 </mapper>

Notiek ielāde…
Atcelt
Saglabāt