wangliang 4 tahun lalu
induk
melakukan
85e5b0d028

+ 4 - 4
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -582,11 +582,11 @@ public class TBUserController {
             Gson gson = new Gson();
             TBUser tbUser = gson.fromJson(gson.toJson(mapParameter), TBUser.class);
             List<String> roleList = (List<String>) mapParameter.get("roleCode");
-            Set<String> roleSet = null;
-            if (Objects.nonNull(roleList) && roleList.size() > 0) {
-                roleSet = new HashSet<>(roleList);
+            if (Objects.isNull(roleList) || roleList.size() == 0) {
+                throw new BusinessException("请选择角色");
             }
-            if (Objects.nonNull(roleSet) && roleSet.size() > 1) {
+            Set<String> roleSet = new HashSet<>(roleList);
+            if (roleSet.size() > 1) {
                 throw new BusinessException("暂不支持多个角色");
             }
             if (Objects.isNull(tbUser.getId())) {

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/service/impl/TempleteLogicServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.templete.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
@@ -149,6 +150,11 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                             teStudent = new TEStudent(orgId, examStudentImportDto.getIdentity(), examStudentImportDto.getName(), createId);
                             teStudentService.save(teStudent);
                             teStudentList.add(teStudent);
+                        }else{
+                            UpdateWrapper<TEStudent> teStudentUpdateWrapper = new UpdateWrapper<>();
+                            teStudentUpdateWrapper.lambda().set(TEStudent::getName, teExamStudent.getName())
+                                    .eq(TEStudent::getIdentity, teExamStudent.getIdentity());
+                            teStudentService.update(teStudentUpdateWrapper);
                         }
                         teExamStudent = gson.fromJson(gson.toJson(examStudentImportDto), TEExamStudent.class);
                         teExamStudent.setExamId(examId);
@@ -170,6 +176,11 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                         teExamStudent.setCourseName(examStudentImportDto.getCourseName());
                         teExamStudent.setExamActivityId(teExamActivity.getId());
                         teExamStudent.setLeftExamCount(examCount);
+
+                        UpdateWrapper<TEStudent> teStudentUpdateWrapper = new UpdateWrapper<>();
+                        teStudentUpdateWrapper.lambda().set(TEStudent::getName, teExamStudent.getName())
+                                .eq(TEStudent::getIdentity, teExamStudent.getIdentity());
+                        teStudentService.update(teStudentUpdateWrapper);
                     }
                     teExamStudentService.saveOrUpdate(teExamStudent);
                     roomCodeAndNameSet.add(teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());

+ 23 - 12
themis-business/src/main/resources/mapper/TEStudentMapper.xml

@@ -4,20 +4,30 @@
 
     <select id="studentQuery" resultType="com.qmth.themis.business.dto.response.TEStudentDto">
         select
-            tes.id,
-            tes.name,
-            tes.`identity`,
-            tbo.name as orgName,
-            tes.enable,
-            tes.base_photo_path as basePhotoPath,
-            (select tbu.name from t_b_user tbu where tbu.id = tes.create_id) as createName,
-            (select tbu.name from t_b_user tbu where tbu.id = tes.update_id) as updateName,
-            tes.create_time as createTime,
-            tes.update_time as updateTime
+        t.id,
+        t.name,
+        t.identity,
+        t.orgName,
+        t.enable,
+        t.basePhotoPath,
+        if(t.updateName is not null, t.updateName, t.createName) as updateName,
+        if(t.updateTime is not null, t.updateTime, t.createTime) as updateTime
         from
-            t_e_student tes
+        (select
+        tes.id,
+        tes.name,
+        tes.`identity`,
+        tbo.name as orgName,
+        tes.enable,
+        tes.base_photo_path as basePhotoPath,
+        (select tbu.name from t_b_user tbu where tbu.id = tes.create_id) as createName,
+        (select tbu.name from t_b_user tbu where tbu.id = tes.update_id) as updateName,
+        tes.create_time as createTime,
+        tes.update_time as updateTime
+        from
+        t_e_student tes
         left join t_b_org tbo on
-            tbo.id = tes.org_id
+        tbo.id = tes.org_id
         <where>
             <if test="identity != null and identity != ''">
                 and tes.identity like concat('%', #{identity}, '%')
@@ -29,6 +39,7 @@
                 and tes.enable = #{enable}
             </if>
         </where>
+        ) t order by t.name
     </select>
 
     <select id="studentExamRecordQuery" resultType="com.qmth.themis.business.dto.response.TEStudentExamRecordDto">