he2802 3 anni fa
parent
commit
5a713b80e8

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamQueryBo.java

@@ -87,4 +87,6 @@ public class ExamQueryBo extends BaseEntity {
 	private String searchKey;
 	@ApiModelProperty("试卷IDs")
 	private List<Long> examIds;
+	@ApiModelProperty("试卷类型名称")
+	private String paperName;
 }

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamPaperServiceImpl.java

@@ -1,9 +1,12 @@
 package com.zhongzheng.modules.exam.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.course.domain.CourseSection;
 import com.zhongzheng.modules.pay.domain.PayAisle;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -93,6 +96,24 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
      */
     private void validEntityBeforeSave(ExamPaper entity){
         //TODO 做一些数据校验,如唯一约束
+        if(checkNameUnique(entity)){
+            throw new CustomException("节标题重复");
+        }
+    }
+
+    private boolean checkNameUnique(ExamPaper entity) {
+        ExamPaper info = getOne(new LambdaQueryWrapper<ExamPaper>()
+                .eq(ExamPaper::getPaperName,entity.getPaperName()).ne(ExamPaper::getStatus,-1).last("limit 1"));
+        if (Validator.isNotNull(info)) {
+            if(Validator.isNotEmpty(entity.getPaperId())){
+                if(entity.getPaperId().longValue() != info.getPaperId().longValue()){
+                    return true;
+                }
+            }else{
+                return true;
+            }
+        }
+        return false;
     }
 
     @Override

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -964,7 +964,6 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
             //    Long secLong = 0L;
             //    Long studyLong = 0L;
-
            /* SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
             subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
             subjectStudyRecordQueryBo.setUserId(classPeriodStudentVo.getUserId());

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml

@@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (SELECT count(*)  from exam_question where exam_id = e.exam_id ) question_num
         FROM
             exam e
+                LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
                 LEFT JOIN question_business qb ON e.exam_id = qb.major_id
                 AND qb.type = 2
                 LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
@@ -103,6 +104,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 #{item}
             </foreach>
         </if>
+        <if test="paperName != null and paperName != ''">
+            AND ep.paper_name like concat('%', #{paperName}, '%')
+        </if>
         <if test="educationTypeId != null and educationTypeId != ''">
             AND cet.id = #{educationTypeId}
         </if>

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -202,7 +202,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="majorId != null and majorId != ''">
             AND g.major_id = #{majorId}
         </if>
-        <if test="standPrice != null and standPrice != ''">
+        <if test="standPrice != null ">
             AND g.stand_price = #{standPrice}
         </if>
         <if test="searchKey != null and searchKey != ''">