Browse Source

更新学生信息

tags/正式版本
雍文秀 2 years ago
parent
commit
df21ed776a

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

258
 
258
 
259
     //批量更新用户信息
259
     //批量更新用户信息
260
     void batchUpdateUser(@Param("users") List<TUser> users);
260
     void batchUpdateUser(@Param("users") List<TUser> users);
261
+
262
+    //更新学生信息
263
+    void updateStudent(@Param("user") TUser user);
261
 }
264
 }

+ 5
- 2
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassStudentService.java View File

218
                             throw new Exception("准考证号长度不符合要求");
218
                             throw new Exception("准考证号长度不符合要求");
219
                         }
219
                         }
220
                     }
220
                     }
221
+                    if (examno.equals("")) examno = null;
221
                     stu.setExamno(examno);
222
                     stu.setExamno(examno);
222
                     Integer userid = user.getUserid();
223
                     Integer userid = user.getUserid();
223
                     stu.setUserid(userid);
224
                     stu.setUserid(userid);
310
         user.setLoginpwd(N_Utils.getMD5Pwd("123456"));
311
         user.setLoginpwd(N_Utils.getMD5Pwd("123456"));
311
         user.setUsersex(model.getUsersex());
312
         user.setUsersex(model.getUsersex());
312
         user.setStudentno(model.getStudentno());
313
         user.setStudentno(model.getStudentno());
314
+        if (examno.equals("")) examno = null;
313
         user.setExamno(examno);
315
         user.setExamno(examno);
314
         user.setCreateid(model.getCreateid());
316
         user.setCreateid(model.getCreateid());
315
         user.setSchoolid(schoolid);
317
         user.setSchoolid(schoolid);
396
         }
398
         }
397
         String examno = model.getExamno();
399
         String examno = model.getExamno();
398
         if (N_Utils.isNotEmpty(examno)) {
400
         if (N_Utils.isNotEmpty(examno)) {
399
-            TSchool school = schoolMapper.getSchoolInfoById(u.getSchoolid());
401
+            TSchool school = schoolMapper.getSchoolInfoByUserid(model.getStudentid());
400
             Integer limitenolen = school.getLimitenolen();
402
             Integer limitenolen = school.getLimitenolen();
401
             if (!N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
403
             if (!N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
402
                 return new ResultVo(1, "准考证号长度不符合要求");
404
                 return new ResultVo(1, "准考证号长度不符合要求");
408
         user.setUsersex(model.getUsersex());
410
         user.setUsersex(model.getUsersex());
409
         user.setUsername(model.getStudentname());
411
         user.setUsername(model.getStudentname());
410
         user.setStudentno(model.getStudentno());
412
         user.setStudentno(model.getStudentno());
413
+        if (examno.equals("")) examno = null;
411
         user.setExamno(examno);
414
         user.setExamno(examno);
412
         user.setLoginname(model.getStudentno());
415
         user.setLoginname(model.getStudentno());
413
         user.setUserphone(model.getUserphone());
416
         user.setUserphone(model.getUserphone());
429
             user.setUsertime(null);
432
             user.setUsertime(null);
430
         }
433
         }
431
         user.setCreatetime(N_Utils.getSecondTimestamp());
434
         user.setCreatetime(N_Utils.getSecondTimestamp());
432
-        userMapper.updateByPrimaryKeySelective(user);
435
+        userMapper.updateStudent(user);
433
         return new ResultVo(0, "修改成功");
436
         return new ResultVo(0, "修改成功");
434
     }
437
     }
435
 
438
 

+ 2
- 2
suser/src/main/resources/mapper/gradeclass/SchoolMapper.xml View File

17
 
17
 
18
     <!--更加用户id获取当前学校id和年份-->
18
     <!--更加用户id获取当前学校id和年份-->
19
     <select id="getSchoolInfoByUserid" resultType="com.xhkjedu.suser.model.gradeclass.TSchool">
19
     <select id="getSchoolInfoByUserid" resultType="com.xhkjedu.suser.model.gradeclass.TSchool">
20
-        select s.schoolid,s.year from t_user u left join t_school s on u.schoolid=s.schoolid
20
+        select s.schoolid,s.year,limitenolen from t_user u left join t_school s on u.schoolid=s.schoolid
21
         where u.userid=#{userid}
21
         where u.userid=#{userid}
22
     </select>
22
     </select>
23
     <!--获取学校基本信息-->
23
     <!--获取学校基本信息-->
24
     <select id="getSchoolInfoById" resultType="com.xhkjedu.suser.model.gradeclass.TSchool">
24
     <select id="getSchoolInfoById" resultType="com.xhkjedu.suser.model.gradeclass.TSchool">
25
-        select usernum,limitenolen from t_school where schoolid=#{schoolid}
25
+        select usernum,limitenolen,schoolname from t_school where schoolid=#{schoolid}
26
     </select>
26
     </select>
27
 </mapper>
27
 </mapper>

+ 8
- 0
suser/src/main/resources/mapper/system/UserMapper.xml View File

298
             where userid=#{u.userid}
298
             where userid=#{u.userid}
299
         </foreach>
299
         </foreach>
300
     </update>
300
     </update>
301
+    <!--更新学生信息-->
302
+    <update id="updateStudent">
303
+        update t_user set username=#{user.username},loginname=#{user.loginname},studentno=#{user.studentno},examno=#{user.examno}
304
+        ,usertime =#{user.usertime},createtime=#{user.createtime},usersex=#{user.usersex}
305
+        <if test="user.userphone!=null and user.userphone!=''">,userphone =#{user.userphone}</if>
306
+        <if test="user.bindphoned!=null">,bindphoned =#{user.bindphoned}</if>
307
+        where userid=#{user.userid}
308
+    </update>
301
 </mapper>
309
 </mapper>

Loading…
Cancel
Save