From 9f47da788bf7127847a4c3f5cfc424efdc3c736c Mon Sep 17 00:00:00 2001 From: "jiakun.lin" Date: Mon, 15 Mar 2021 11:43:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper/tms/UserDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/mapper/tms/UserDao.xml b/src/main/resources/mapper/tms/UserDao.xml index ba71046..f7508ac 100644 --- a/src/main/resources/mapper/tms/UserDao.xml +++ b/src/main/resources/mapper/tms/UserDao.xml @@ -19,6 +19,7 @@ u.IDNumber, u.documentType, u.educationDegree, + u.userAvatars, pro.provinceId, pro.provinceName, s.schoolId, From 3d940090278bd84febcbb0ad6a18787373ca557e Mon Sep 17 00:00:00 2001 From: "jiakun.lin" Date: Mon, 15 Mar 2021 16:58:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=88=90=E7=BB=A9=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E8=80=83=E6=A0=B8=E6=90=9C=E7=B4=A2=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper/tms/AchievementManagementDao.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/tms/AchievementManagementDao.xml b/src/main/resources/mapper/tms/AchievementManagementDao.xml index c2a1330..c6c68b8 100644 --- a/src/main/resources/mapper/tms/AchievementManagementDao.xml +++ b/src/main/resources/mapper/tms/AchievementManagementDao.xml @@ -497,11 +497,10 @@ et.creation_time AS creationTime, et.is_del FROM - tms_experimental_teaching et, - hr_project_management pm + tms_experimental_teaching et inner join + hr_project_management pm on et.project_id = pm.projectId WHERE user_id = #{userId} - AND et.project_id = pm.projectId AND pm.isdel = 0 and et.experimental_class_name like concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or From 0d2ba8feb248c3ac673c0fc718d3826ab544ee2c Mon Sep 17 00:00:00 2001 From: "jiakun.lin" Date: Tue, 16 Mar 2021 14:20:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BF=85=E9=A1=BB=E8=A6=81=E5=B8=A6=E5=AD=A6=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=AD=A6=E5=8F=B7=E5=94=AF=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msdw/tms/api/UserInfoControllerApi.java | 2 +- .../tms/controller/UserInfoController.java | 23 +++++++++++++++---- .../java/com/msdw/tms/dao/StudentDao.java | 4 +++- .../com/msdw/tms/service/StudentService.java | 3 ++- .../tms/service/impl/StudentServiceImpl.java | 18 ++++++++------- src/main/resources/mapper/tms/StudentDao.xml | 8 +++++-- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java index 51edcf5..037f505 100644 --- a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java +++ b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java @@ -24,7 +24,7 @@ public interface UserInfoControllerApi { R getUserId(String token); @ApiOperation(value = "注册",notes = "注册") - R save(UserInfoEntity entity); + R save(UserInfoEntity entity,@ApiParam(value = "学号",required = true)String workNumber); @ApiOperation(value = "个人中心信息展示",notes = "个人中心信息展示") R userInfo(Integer id); diff --git a/src/main/java/com/msdw/tms/controller/UserInfoController.java b/src/main/java/com/msdw/tms/controller/UserInfoController.java index 5f9586a..f5bac50 100644 --- a/src/main/java/com/msdw/tms/controller/UserInfoController.java +++ b/src/main/java/com/msdw/tms/controller/UserInfoController.java @@ -8,6 +8,7 @@ import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.UserPersonalFileEntity; import com.msdw.tms.entity.vo.CheckVo; +import com.msdw.tms.entity.vo.StudentVo; import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.entity.vo.UserProsonalEntityVo; import com.msdw.tms.service.StudentService; @@ -58,27 +59,41 @@ public class UserInfoController implements UserInfoControllerApi { @Override @Transactional @PostMapping("/add") - public R save(@RequestBody UserInfoEntity userInfoEntity){ + public R save(@RequestBody UserInfoEntity userInfoEntity,@RequestParam String workNumber){ String token ="UT_"+ UUID.randomUUID().toString().replace("-", ""); userInfoEntity.setToken(token); userInfoEntity.setSchoolId(2105); Integer schoolId = userInfoEntity.getSchoolId(); Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId); Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone()); + + //新增学生 + StudentVo studentVo = new StudentVo(); + studentVo.setUserId(userInfoEntity.getUserId()); + studentVo.setRoleId(Integer.valueOf(userInfoEntity.getRoleId())); + studentVo.setSchoolId(schoolId); + studentVo.setIsdel(0); + studentVo.setWorkNumber(workNumber); + studentVo.setPlatformId(1); + //为1 学号有重复 + int num = studentService.queryStudentByWorkNumber(studentVo); + if (integer==1){ return R.error(400,"账号已存在"); } if (integer1==1){ - return R.error(400,"改手机号已被绑定"); + return R.error(400,"该手机号已被绑定"); + } + if (num == 1){ + return R.error(400,"该学号重复!"); } int userId = userInfoService.add(userInfoEntity); if (userId==0){ return R.error(400,"添加用户信息失败"); } // userInfoEntity.setUserId(userId); - studentService.addStudentInfo(userInfoEntity); - return R.ok(); + return studentService.addStudentInfo(studentVo); } /** diff --git a/src/main/java/com/msdw/tms/dao/StudentDao.java b/src/main/java/com/msdw/tms/dao/StudentDao.java index b426e78..1dff280 100644 --- a/src/main/java/com/msdw/tms/dao/StudentDao.java +++ b/src/main/java/com/msdw/tms/dao/StudentDao.java @@ -28,7 +28,7 @@ public interface StudentDao extends BaseMapper { void updateWorkNumber(String workNumber,Integer studentId); - boolean addStudentInfo(UserInfoEntity userInfoEntity); + boolean addStudentInfo(StudentVo studentVo); List querySchoolName(String schoolAppellationName); @@ -37,4 +37,6 @@ public interface StudentDao extends BaseMapper { int querySchoolAppellationName(String schoolAppellationName); List queryAccount(String account,Integer schoolId); + + int queryStudentByWorkNumber(StudentVo studentVo); } diff --git a/src/main/java/com/msdw/tms/service/StudentService.java b/src/main/java/com/msdw/tms/service/StudentService.java index 05d99e9..efc4e0e 100644 --- a/src/main/java/com/msdw/tms/service/StudentService.java +++ b/src/main/java/com/msdw/tms/service/StudentService.java @@ -30,7 +30,7 @@ public interface StudentService extends IService{ void updateWorkNumber(Integer studentId); - R addStudentInfo(UserInfoEntity userInfoEntity); + R addStudentInfo(StudentVo studentVo); void downloadFiles(HttpServletResponse response) throws IOException; @@ -40,4 +40,5 @@ public interface StudentService extends IService{ R queryAccount(String account,Integer schoolId); + int queryStudentByWorkNumber(StudentVo studentVo); } diff --git a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java index cca9696..e3a099d 100644 --- a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java @@ -122,18 +122,15 @@ public class StudentServiceImpl extends ServiceImpl im } @Override - public R addStudentInfo(UserInfoEntity userInfoEntity) { + public R addStudentInfo(StudentVo studentVo) { R r = new R(); - boolean result = studentDao.addStudentInfo(userInfoEntity); + boolean result = studentDao.addStudentInfo(studentVo); if (result==false){ - r.put("code",300); - r.put("errmessage","注册失败!"); - return r; + throw new RuntimeException();//添加失败,抛出运行时异常让外层事务回滚 }else{ - r.put("code",200); - r.put("errmessage","注册成功!"); - return r; + return R.ok("注册成功!"); } + } @Override @@ -310,4 +307,9 @@ public class StudentServiceImpl extends ServiceImpl im } + @Override + public int queryStudentByWorkNumber(StudentVo studentVo) { + return studentDao.queryStudentByWorkNumber(studentVo); + } + } diff --git a/src/main/resources/mapper/tms/StudentDao.xml b/src/main/resources/mapper/tms/StudentDao.xml index e421705..6a11653 100644 --- a/src/main/resources/mapper/tms/StudentDao.xml +++ b/src/main/resources/mapper/tms/StudentDao.xml @@ -94,9 +94,9 @@ WHERE ) - INSERT INTO student(schoolId,userId,roleId,isdel,platformId) + INSERT INTO student(schoolId,userId,roleId,isdel,platformId,workNumber) VALUES - ( #{schoolId},#{userId},4,0,1 + ( #{schoolId},#{userId},#{roleId},#{isdel},#{platformId},#{workNumber} ) @@ -146,4 +146,8 @@ WHERE update student set workNumber = #{workNumber} where studentId = #{studentId} + + \ No newline at end of file