소스 검색

搜索题目id, 模糊精确搜练习册名称, 搜索归属批次

chen 5 년 전
부모
커밋
e722545719

+ 2 - 0
ssj-kmt-exercise-service-impl/src/main/java/com/ssj/service/kmt/exercisesys/KmtExerciseSysServiceImpl.java

@@ -1500,6 +1500,8 @@ public class KmtExerciseSysServiceImpl implements KmtExerciseSysService {
         params.put("semester", req.getSemester());
         params.put("bookType", req.getBookType());
         params.put("bookYear", req.getBookYear());
+        params.put("searchType", req.getSearchType());
+        params.put("assignedBatch", req.getAssignedBatch());
 
         List<Exercise1Dto> list = kmtExerciseMapper.findExerciseList(page, params);
         Map<String, Object> resultMap = new HashMap<>(16);

+ 6 - 1
ssj-kmt-exercise-service-impl/src/main/java/com/ssj/service/kmt/kmt/service/impl/KmtExerciseQuestionServiceImpl.java

@@ -143,7 +143,12 @@ public class KmtExerciseQuestionServiceImpl extends BaseServiceImpl<KmtExerciseQ
 
 
         if (StringUtils.isNotBlank(request.getPeriodId())){
-            List<ExerciseQuetionDto> questions = kmtExerciseMapperService.findQuestionByBookCourseIdAndUserId(request, page,  userId);
+            List<ExerciseQuetionDto> questions = null;
+            if (StringUtil.isNotBlank(request.getQuestionId())){
+                questions = kmtExerciseMapper.findExerciseQuestionByQuestionId(request.getQuestionId(), page);
+            } else {
+                questions = kmtExerciseMapperService.findQuestionByBookCourseIdAndUserId(request, page,  userId);
+            }
             kmtExerciseService.appendQuestionDtoDataFromJSONFile(questions);
             list = this.getQuestionGroupList(questions, true);
         }

+ 22 - 0
ssj-kmt-exercise-service/src/main/java/com/ssj/service/kmt/exercisesys/request/DistributionExerciseBookListReq.java

@@ -72,6 +72,12 @@ public class DistributionExerciseBookListReq extends PageReq {
     @Pattern(regexp = ".{0}|\\d{4}-\\d{2}-\\d{2}", message = "日期格式不正确,正确的日期格式为:yyyy-MM-dd")
     private String endTime;
 
+    @ApiModelProperty(name = "searchType", value = "0模糊,1精确", required = false)
+    private int searchType;
+
+    @ApiModelProperty(name = "assignedBatch", value = "0模糊,1精确", required = false)
+    private String assignedBatch;
+
     public Integer getType() {
         return type;
     }
@@ -175,4 +181,20 @@ public class DistributionExerciseBookListReq extends PageReq {
     public void setEndTime(String endTime) {
         this.endTime = endTime;
     }
+
+    public int getSearchType() {
+        return searchType;
+    }
+
+    public void setSearchType(int searchType) {
+        this.searchType = searchType;
+    }
+
+    public String getAssignedBatch() {
+        return assignedBatch;
+    }
+
+    public void setAssignedBatch(String assignedBatch) {
+        this.assignedBatch = assignedBatch;
+    }
 }

+ 21 - 0
ssj-kmt-exercise-service/src/main/java/com/ssj/service/kmt/exercisesys/request/ExerciseListReq.java

@@ -44,6 +44,12 @@ public class ExerciseListReq extends BaseRequest {
     @ApiModelProperty(name = "bookYear", value = "使用年份", required = true)
     private Integer bookYear;
 
+    @ApiModelProperty(name = "searchType", value = "0模糊,1精确", required = false)
+    private int searchType;
+
+    @ApiModelProperty(name = "assignedBatch", value = "0模糊,1精确", required = false)
+    private String assignedBatch;
+
     public String getVersionName() {
         return versionName;
     }
@@ -124,4 +130,19 @@ public class ExerciseListReq extends BaseRequest {
         this.pageSize = pageSize;
     }
 
+    public int getSearchType() {
+        return searchType;
+    }
+
+    public void setSearchType(int searchType) {
+        this.searchType = searchType;
+    }
+
+    public String getAssignedBatch() {
+        return assignedBatch;
+    }
+
+    public void setAssignedBatch(String assignedBatch) {
+        this.assignedBatch = assignedBatch;
+    }
 }

+ 11 - 0
ssj-kmt-exercise-service/src/main/java/com/ssj/service/kmt/request/ExerciseBookIdDealTypeRequest.java

@@ -28,6 +28,9 @@ public class ExerciseBookIdDealTypeRequest extends BaseRequest {
     @ApiModelProperty(name = "exerciseBookId", value = "练习册exerciseBookId", required = true)
     private String exerciseBookId;
 
+    @ApiModelProperty(name = "questionId", value = "题目id", required = false)
+    private String questionId;
+
 
     public String getId() {
         return id;
@@ -68,4 +71,12 @@ public class ExerciseBookIdDealTypeRequest extends BaseRequest {
     public void setExerciseBookId(String exerciseBookId) {
         this.exerciseBookId = exerciseBookId;
     }
+
+    public String getQuestionId() {
+        return questionId;
+    }
+
+    public void setQuestionId(String questionId) {
+        this.questionId = questionId;
+    }
 }

+ 22 - 0
ssj-kmt-exercise-service/src/main/java/com/ssj/service/kmt/request/ExerciseConditionRequest.java

@@ -26,6 +26,12 @@ public class ExerciseConditionRequest extends BaseRequest {
     @ApiModelProperty(name = "bookName", value = "搜索的练习册名称", required = false)
     private String  bookName;
 
+    @ApiModelProperty(name = "searchType", value = "0模糊,1精确", required = true)
+    private int searchType;
+
+    @ApiModelProperty(name = "questionId", value = "题目id", required = false)
+    private String questionId;
+
     public String getSubject() {
         return subject;
     }
@@ -73,4 +79,20 @@ public class ExerciseConditionRequest extends BaseRequest {
     public void setBookName(String bookName) {
         this.bookName = bookName;
     }
+
+    public int getSearchType() {
+        return searchType;
+    }
+
+    public void setSearchType(int searchType) {
+        this.searchType = searchType;
+    }
+
+    public String getQuestionId() {
+        return questionId;
+    }
+
+    public void setQuestionId(String questionId) {
+        this.questionId = questionId;
+    }
 }

+ 11 - 0
ssj-kmt-exercise-service/src/main/java/com/ssj/service/kmt/request/ExerciseQuestionsRequest.java

@@ -49,6 +49,9 @@ public class ExerciseQuestionsRequest extends BaseRequest {
     @ApiModelProperty(name = "rollbackType", value = "批量打回类型,1(打回到ai),2(打回到题目加工), 3(打回到题目审核), 4(打回到解析加工),5(打回到解析审核)", required = false)
     private int  rollbackType;
 
+    @ApiModelProperty(name = "questionId", value = "questionId", required = false)
+    private String questionId;
+
     public String getSubject() {
         return subject;
     }
@@ -161,4 +164,12 @@ public class ExerciseQuestionsRequest extends BaseRequest {
     public void setRollbackType(int rollbackType) {
         this.rollbackType = rollbackType;
     }
+
+    public String getQuestionId() {
+        return questionId;
+    }
+
+    public void setQuestionId(String questionId) {
+        this.questionId = questionId;
+    }
 }

+ 23 - 38
ssj-mybatis-service-impl/src/main/java/com/ssj/service/kmt/exercise/KmtExerciseMapperServiceImpl.java

@@ -1027,45 +1027,27 @@ public class KmtExerciseMapperServiceImpl implements KmtExerciseMapperService {
     @Override
     public List<ExerciseBookDto> findExerciseBooks(ExerciseConditionRequest request, String userId) {
         List<ExerciseBookDto> list = null, result = new ArrayList<>();
-        if (request.getDealType() == 1){
-            if (StringUtils.isBlank(request.getGrade())){
-                //待加工页面没有科目年级,只判断年级
-                list = kmtExerciseMapper.findUnHandleBooks(userId,request.getBookName());
-            } else {
-                //准备废弃
-                list = kmtExerciseMapper.findUndistributedHandlerBooks(request.getSubject(), request.getSemester(), request.getVersionType(),  request.getGrade());
-            }
+
+        if (StringUtils.isNotBlank(request.getQuestionId())){
+            list = kmtExerciseMapper.findExerciseBookByQuestionId(request.getQuestionId());
+        } else if (request.getDealType() == 1){
+            list = kmtExerciseMapper.findUnHandleBooks(userId, request.getSearchType(), request.getBookName());
         } else if (request.getDealType() == 2){
-            if (StringUtils.isBlank(request.getGrade())){
-                //待审核页面没有科目年级,只判断年级
-                list = kmtExerciseMapper.findUnAuditingBooks(userId,request.getBookName());
-            } else {
-                //准备废弃
-                list = kmtExerciseMapper.findUndistributedAuditerBooks(request.getSubject(), request.getSemester(), request.getVersionType(),  request.getGrade());
-            }
+            list = kmtExerciseMapper.findUnAuditingBooks(userId, request.getSearchType(), request.getBookName());
         } else if (request.getDealType() == 4) {
             //解析加工练习册列表
-            list = kmtExerciseMapper.findUnAnalysisHandleBooks(userId,request.getBookName());
+            list = kmtExerciseMapper.findUnAnalysisHandleBooks(userId, request.getSearchType(), request.getBookName());
         } else if (request.getDealType() == 5) {
             //解析审核练习册列表
-            list = kmtExerciseMapper.findUnAnalysisAuditingBooks(userId,request.getBookName());
+            list = kmtExerciseMapper.findUnAnalysisAuditingBooks(userId, request.getSearchType(), request.getBookName());
         } else if (request.getDealType() == 6){
             //未校对练习册列表
-            list = kmtExerciseMapper.findUnCorrectAnswerBooks(userId, request.getBookName());
-//            List<ExerciseBookDto> tempList = kmtExerciseMapper.findUnCorrectAnswerBooks(userId, request.getBookName());
-//            list = new LinkedList<>();
-//            List<String> exerciseBookIds = exerciseQuestionSearchService.findAnswerCorrectExerciseBookId(userId, request.getDealType());
-//            if (CollectionUtils.isNotEmpty(exerciseBookIds)){
-//                for (ExerciseBookDto temp : tempList){
-//                    if  (exerciseBookIds.contains(temp.getExerciseBookId())){
-//                        list.add(temp);
-//                    }
-//                }
-//            }
+            list = kmtExerciseMapper.findUnCorrectAnswerBooks(userId, request.getSearchType(), request.getBookName());
         } else if (request.getDealType() == 7) {
-            list = kmtExerciseMapper.findCorrectedAnswerBooks(userId, request.getBookName());
-        }else {
-            list = kmtExerciseMapper.findAllExerciseBooks(request.getSubject(), request.getSemester(), request.getVersionType(),  request.getGrade(), request.getBookName());
+            list = kmtExerciseMapper.findCorrectedAnswerBooks(userId, request.getSearchType(), request.getBookName());
+        } else {
+            list = kmtExerciseMapper.findAllExerciseBooks(request.getSubject(), request.getSemester(),
+                    request.getVersionType(),  request.getGrade(), request.getSearchType(),  request.getBookName());
         }
         if (list != null) {
             for (ExerciseBookDto bookDto : list) {
@@ -1106,15 +1088,18 @@ public class KmtExerciseMapperServiceImpl implements KmtExerciseMapperService {
         List<ExerciseUnitBookcourseDto> list;
         List<ExerciseBookUnitDto> result = new ArrayList<>();
         if (request.getDealType() != 3){
-            list = kmtExerciseMapper.findUnHandleExerciseBookCourse(request.getExerciseBookId(), request.getDealType(), userId);
-//        } else if (request.getDealType() > 3) {
-//            list = kmtExerciseMapper.findAnalysisUnHandleExerciseBookCourse(request.getId(), request.getDealType());
+            list = kmtExerciseMapper.findUnHandleExerciseBookCourse(request.getExerciseBookId(), request.getDealType(),
+                    request.getQuestionId(), userId);
         } else {
-            KmtExerciseBook book = kmtExerciseBookService.getById(request.getExerciseBookId());
-            if (book.getBookType() == 1 || book.getBookType() == 2){
-                list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookId(book.getId());
+            if (StringUtil.isNotBlank(request.getQuestionId())){
+                list = kmtExerciseMapper.findExerciseBookCourseByQuestionId(request.getQuestionId());
             } else {
-                list = kmtExerciseMapper.findAllExerciseBookCourse(book.getBookId(), book.getId());
+                KmtExerciseBook book = kmtExerciseBookService.getById(request.getExerciseBookId());
+                if (book.getBookType() == 1 || book.getBookType() == 2){
+                    list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookId(book.getId());
+                } else {
+                    list = kmtExerciseMapper.findAllExerciseBookCourse(book.getBookId(), book.getId());
+                }
             }
         }
         if (CollectionUtils.isNotEmpty(list)){

+ 30 - 0
ssj-mybatis-service-impl/src/main/java/com/ssj/service/mapper/KmtExerciseMapper.java

@@ -243,6 +243,7 @@ public interface KmtExerciseMapper {
      * @return
      */
     List<ExerciseBookDto> findUnHandleBooks(@Param("handleUserId") String handleUserId,
+                                            @Param("searchType") int searchType,
                                             @Param("bookName") String bookName);
 
     /**
@@ -260,6 +261,7 @@ public interface KmtExerciseMapper {
      * @return
      */
     List<ExerciseBookDto> findUnAuditingBooks(@Param("auditingUserId") String auditingUserId,
+                                              @Param("searchType") int searchType,
                                               @Param("bookName") String bookName);
 
 
@@ -284,6 +286,7 @@ public interface KmtExerciseMapper {
                                                @Param("semester") int semester,
                                                @Param("versionType") int versionType,
                                                @Param("grade") String grade,
+                                               @Param("searchType") int searchType,
                                                @Param("bookName") String bookName);
 
     /**
@@ -294,6 +297,7 @@ public interface KmtExerciseMapper {
      */
     List<ExerciseUnitBookcourseDto> findUnHandleExerciseBookCourse(@Param("bookId") String bookId,
                                                                    @Param("dealType") int dealType,
+                                                                   @Param("questionId") String questionId,
                                                                    @Param("userId") String userId);
 
 
@@ -509,6 +513,7 @@ public interface KmtExerciseMapper {
      * @return
      */
     List<ExerciseBookDto> findUnAnalysisHandleBooks(@Param("analysisUserId") String analysisUserId,
+                                                    @Param("searchType") int searchType,
                                                     @Param("bookName") String bookName);
 
     /**
@@ -517,6 +522,7 @@ public interface KmtExerciseMapper {
      * @return
      */
     List<ExerciseBookDto> findUnAnalysisAuditingBooks(@Param("analysisAuditerId") String analysisAuditerId,
+                                                      @Param("searchType") int searchType,
                                                       @Param("bookName") String bookName);
 
     /**
@@ -526,6 +532,7 @@ public interface KmtExerciseMapper {
      * @return
      */
     List<ExerciseBookDto> findUnCorrectAnswerBooks(@Param("userId") String userId,
+                                                   @Param("searchType") int searchType,
                                                    @Param("bookName") String bookName);
 
 
@@ -536,6 +543,7 @@ public interface KmtExerciseMapper {
      * @return
      */
     List<ExerciseBookDto> findCorrectedAnswerBooks(@Param("userId") String userId,
+                                                   @Param("searchType") int searchType,
                                                    @Param("bookName") String bookName);
 
     /**
@@ -1101,4 +1109,26 @@ public interface KmtExerciseMapper {
             "#{questionKnow.howDetailsId}, #{questionKnow.howDetailsKdId}, #{questionKnow.createTime}, " +
             "#{questionKnow.howDetailSortId}, #{questionKnow.howDetailKdSortId}, #{questionKnow.version})")
     int insertKmtExerciseQuestionKnow (@Param("questionKnow") KmtExerciseQuestionKnow questionKnow);
+
+    /**
+     * 根据题目id查询练习册
+     * @param questionId
+     * @return
+     */
+    List<ExerciseBookDto> findExerciseBookByQuestionId (@Param("questionId")String questionId);
+
+    /**
+     * 根据题目id查询单元课时
+     * @param questionId
+     * @return
+     */
+    List<ExerciseUnitBookcourseDto> findExerciseBookCourseByQuestionId (@Param("questionId")String questionId);
+
+    /**
+     * 查询练习册系统的统一格式题目
+     * @param questionId
+     * @param page
+     * @return
+     */
+    List<ExerciseQuetionDto> findExerciseQuestionByQuestionId (@Param("questionId")String questionId, Page page);
 }

+ 143 - 27
ssj-mybatis-service-impl/src/main/resources/mybatis/mapper/KmtExerciseMapper.xml

@@ -538,7 +538,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.had_handle=0 and  eb.handle_user_id=#{handleUserId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -561,7 +568,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -580,7 +594,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.analysis_handled=0 and eb.analysis_user_id=#{analysisUserId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -590,7 +611,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.analysis_audited=0 and eb.analysis_auditer_id=#{analysisAuditerId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -599,7 +627,14 @@
         from kmt_exercise_book eb
         where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.answer_corrected_status = 0
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -608,7 +643,14 @@
         from kmt_exercise_book eb
         where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.proofread_status > 0
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -628,7 +670,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -638,24 +687,49 @@
         left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
         left join kmt_exercise_book eb on eq.exercise_book_id = eb.id
         where eq.exercise_book_id=#{bookId}
-        <if test = "dealType == 1">
-            and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
-        </if>
-        <if test = "dealType == 2">
-            and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
-        </if>
-        <if test = "dealType == 4">
-            and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
-        </if>
-        <if test = "dealType == 5">
-            and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
-        </if>
-        <if test = "dealType == 6">
-            and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
-        </if>
-        <if test = "dealType == 7">
-            and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
-        </if>
+        <choose>
+            <when test = "dealType == 1">
+                and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 2">
+                and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 4">
+                and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 5">
+                and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 6">
+                and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 7">
+                and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <otherwise>
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </otherwise>
+        </choose>
         group by ebc.id
         order by ebc.period_sort
 
@@ -1159,7 +1233,14 @@
             and t.grade = #{map.grade}
         </if>
         <if test="map.bookName != null and map.bookName != '' ">
-            and t.book_name like concat('%',#{map.bookName},'%')
+            <choose>
+                <when test="map.searchType == 1">
+                    and t.book_name = #{map.bookName}
+                </when>
+                <otherwise>
+                    and t.book_name like concat('%',#{map.bookName},'%')
+                </otherwise>
+            </choose>
         </if>
         <if test="map.semester != null and map.semester != '' and map.semester > 0 ">
             and t.semester = #{map.semester}
@@ -1170,6 +1251,9 @@
         <if test="map.bookYear != null and map.bookYear != '' ">
             and t.book_year = #{map.bookYear}
         </if>
+        <if test="map.assignedBatch != null and map.assignedBatch != '' ">
+            and t.assigned_batch = like concat('%',#{map.assignedBatch},'%')
+        </if>
         order by t.updated_time desc,t.book_name
     </select>
 
@@ -1649,7 +1733,14 @@
                       and analysis_auditer_id is not null)
                   </if>
                   <if test="req.bookName != null and req.bookName != ''">
-                      and book_name like '%${req.bookName}%'
+                      <choose>
+                          <when test="req.searchType == 1">
+                              and book_name  = #{req.bookName}
+                          </when>
+                          <otherwise>
+                              and book_name like '%${req.bookName}%'
+                          </otherwise>
+                      </choose>
                   </if>
                   <if test="req.subject != null and req.subject != ''">
                       and course_name = #{req.subject}
@@ -1672,6 +1763,9 @@
                   <if test="req.endTime != null and req.endTime != ''">
                       and '${req.endTime} 23:59:59' > create_time
                   </if>
+                  <if test="req.assignedBatch != null and req.assignedBatch != ''">
+                      and assigned_batch like '%${req.assignedBatch}%'
+                  </if>
               order by create_time desc
               limit #{offset}, #{pageSize}) eb
                  left join kmt_exercise_book_teacher_record ebtrHandle
@@ -1880,4 +1974,26 @@
     <select id="findSignService" resultType="com.ssj.bean.sys.fx.domain.Merchant">
       select * from fx_merchant where lib_id=#{libId} and sign_service is not null limit 1
     </select>
+
+    <select id="findExerciseBookByQuestionId" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
+        select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type,
+        eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
+        from kmt_exercise_book eb, kmt_exercise_questions eq
+        where eb.id=eq.exercise_book_id and eq.id=#{questionId} and eb.part_flag != 3
+    </select>
+    <select id="findExerciseBookCourseByQuestionId" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
+        select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
+        left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
+        where eq.id=#{questionId}
+    </select>
+
+    <select id="findExerciseQuestionByQuestionId" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
+        select eq.id question_id, eq.course_name, eb.handle_user_id, eb.auditing_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eq.book_course_id course_id,
+        eq.big_question_index, eq.small_question_name small_question_index,
+        eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
+        eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
+        eq.training_skill training_skills, eq.parent_id, eq.proofread_status, eq.question_path, eq.num, eq.create_time
+        from kmt_exercise_questions eq  left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
+        where eq.id=#{questionId}
+    </select>
 </mapper>

+ 106 - 25
ssj-mybatis-service-impl/target/classes/mybatis/mapper/KmtExerciseMapper.xml

@@ -538,7 +538,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.had_handle=0 and  eb.handle_user_id=#{handleUserId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -561,7 +568,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -580,7 +594,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.analysis_handled=0 and eb.analysis_user_id=#{analysisUserId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -590,7 +611,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.analysis_audited=0 and eb.analysis_auditer_id=#{analysisAuditerId}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -599,7 +627,14 @@
         from kmt_exercise_book eb
         where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.answer_corrected_status = 0
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -608,7 +643,14 @@
         from kmt_exercise_book eb
         where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.proofread_status > 0
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -628,7 +670,14 @@
         from kmt_exercise_book eb
         where eb.part_flag != 3 and eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
         <if test="bookName != null and bookName != ''">
-            and eb.book_name like concat('%',#{bookName},'%')
+            <choose>
+                <when test="searchType == 1">
+                    and eb.book_name = #{bookName}
+                </when>
+                <otherwise>
+                    and eb.book_name like concat('%',#{bookName},'%')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -638,24 +687,49 @@
         left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
         left join kmt_exercise_book eb on eq.exercise_book_id = eb.id
         where eq.exercise_book_id=#{bookId}
-        <if test = "dealType == 1">
-            and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
-        </if>
-        <if test = "dealType == 2">
-            and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
-        </if>
-        <if test = "dealType == 4">
-            and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
-        </if>
-        <if test = "dealType == 5">
-            and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
-        </if>
-        <if test = "dealType == 6">
-            and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
-        </if>
-        <if test = "dealType == 7">
-            and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
-        </if>
+        <choose>
+            <when test = "dealType == 1">
+                and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 2">
+                and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 4">
+                and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 5">
+                and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 6">
+                and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <when test = "dealType == 7">
+                and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </when>
+            <otherwise>
+                <if test="questionId != null and questionId != ''">
+                    and eq.id=#{questionId}
+                </if>
+            </otherwise>
+        </choose>
         group by ebc.id
         order by ebc.period_sort
 
@@ -1880,4 +1954,11 @@
     <select id="findSignService" resultType="com.ssj.bean.sys.fx.domain.Merchant">
       select * from fx_merchant where lib_id=#{libId} and sign_service is not null limit 1
     </select>
+
+    <select id="findExerciseBookByQuestionId" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
+        select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type,
+        eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
+        from kmt_exercise_book eb, kmt_exercise_questions eq
+        where eb.id=eq.exercise_book_id and eq.id=#{questionId} and eb.part_flag != 3
+    </select>
 </mapper>