Browse Source

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

tags/正式3.2.0
雍文秀 2 years ago
parent
commit
eec2b4585f

+ 3
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java View File

204
 
204
 
205
     //根据用户id获取绑定方式
205
     //根据用户id获取绑定方式
206
     Map getBindById(Integer userid);
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 View File

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

+ 7
- 4
suser/src/main/resources/mapper/system/UserMapper.xml View File

95
         <result property="usertime" column="usertime"></result>
95
         <result property="usertime" column="usertime"></result>
96
         <result property="createtime" column="createtime"></result>
96
         <result property="createtime" column="createtime"></result>
97
         <result property="rolename" column="rolename"></result>
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
             <result property="subjectname" column="subjectname"></result>
99
             <result property="subjectname" column="subjectname"></result>
101
             <result property="versionname" column="versionname"></result>
100
             <result property="versionname" column="versionname"></result>
102
             <result property="lsbname" column="lsbname"></result>
101
             <result property="lsbname" column="lsbname"></result>
103
-        </collection>-->
102
+        </collection>
104
         <collection property="classlist" ofType="java.util.Map"
103
         <collection property="classlist" ofType="java.util.Map"
105
                     javaType="java.util.List" select="listTeacherClass" column="{userid=userid,classtype=classtype,year=year}">
104
                     javaType="java.util.List" select="listTeacherClass" column="{userid=userid,classtype=classtype,year=year}">
106
         </collection>
105
         </collection>
123
     <!--教师基本信息-->
122
     <!--教师基本信息-->
124
     <select id="getTeacherInfo" resultMap="teacherInfoMap">
123
     <select id="getTeacherInfo" resultMap="teacherInfoMap">
125
         select u.userid,u.username,u.headpic,u.loginname,u.usersex,u.userphone,u.usertime,u.createtime
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
         ,(select group_concat(r.rolename separator '  ')
126
         ,(select group_concat(r.rolename separator '  ')
128
         from t_user_role ur left join t_role r on ur.roleid=r.roleid where ur.userid=#{userid})rolename
127
         from t_user_role ur left join t_role r on ur.roleid=r.roleid where ur.userid=#{userid})rolename
129
         ,#{classtype} classtype,#{year} year
128
         ,#{classtype} classtype,#{year} year
196
         select userphone,bindphoned,bindsecret
195
         select userphone,bindphoned,bindsecret
197
         from t_user where userid=#{userid} limit 1
196
         from t_user where userid=#{userid} limit 1
198
     </select>
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
 </mapper>
204
 </mapper>

Loading…
Cancel
Save