浏览代码

fix 试卷题目

he2802 4 年之前
父节点
当前提交
c22bfad651

+ 4 - 12
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamAddBo.java

@@ -27,21 +27,10 @@ public class ExamAddBo {
     /** 更新时间 */
     @ApiModelProperty("更新时间")
     private Long updateTime;
-    /** 教育类型ID */
-    @ApiModelProperty("教育类型ID")
-    private Long educationTypeId;
-    /** 业务层次id */
-    @ApiModelProperty("业务层次id")
-    private Long businessId;
-    /** 科目id */
-    @ApiModelProperty("科目id")
-    private Long subjectId;
+
     /** 前缀名称 */
     @ApiModelProperty("前缀名称")
     private String prefixName;
-    /** 项目ID */
-    @ApiModelProperty("项目ID")
-    private Long projectId;
     /** 编码 */
     @ApiModelProperty("编码")
     private String code;
@@ -65,4 +54,7 @@ public class ExamAddBo {
     private Long examPaperId;
     @ApiModelProperty("题目列表")
     private List<ExamQuestionAddBo> questionList;
+    /** 业务层级列表 */
+    @ApiModelProperty("业务层级列表")
+    private List<QuestionBusinessAddBo> businessList;
 }

+ 4 - 14
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamEditBo.java

@@ -30,26 +30,12 @@ public class ExamEditBo {
     @ApiModelProperty("更新时间")
     private Long updateTime;
 
-    /** 教育类型ID */
-    @ApiModelProperty("教育类型ID")
-    private Long educationTypeId;
 
-    /** 业务层次id */
-    @ApiModelProperty("业务层次id")
-    private Long businessId;
-
-    /** 科目id */
-    @ApiModelProperty("科目id")
-    private Long subjectId;
 
     /** 前缀名称 */
     @ApiModelProperty("前缀名称")
     private String prefixName;
 
-    /** 项目ID */
-    @ApiModelProperty("项目ID")
-    private Long projectId;
-
     /** 编码 */
     @ApiModelProperty("编码")
     private String code;
@@ -81,4 +67,8 @@ public class ExamEditBo {
     @ApiModelProperty("题目列表")
     private List<ExamQuestionAddBo> questionList;
 
+    /** 业务层级列表 */
+    @ApiModelProperty("业务层级列表")
+    private List<QuestionBusinessEditBo> businessList;
+
 }

+ 1 - 12
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamQueryBo.java

@@ -40,21 +40,10 @@ public class ExamQueryBo extends BaseEntity {
 	/**  状态 1正常 0关闭 */
 	@ApiModelProperty(" 状态 1正常 0关闭")
 	private List<Integer> status;
-	/** 教育类型ID */
-	@ApiModelProperty("教育类型ID")
-	private Long educationTypeId;
-	/** 业务层次id */
-	@ApiModelProperty("业务层次id")
-	private Long businessId;
-	/** 科目id */
-	@ApiModelProperty("科目id")
-	private Long subjectId;
+
 	/** 前缀名称 */
 	@ApiModelProperty("前缀名称")
 	private String prefixName;
-	/** 项目ID */
-	@ApiModelProperty("项目ID")
-	private Long projectId;
 	/** 编码 */
 	@ApiModelProperty("编码")
 	private String code;

+ 0 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Exam.java

@@ -34,16 +34,8 @@ private static final long serialVersionUID=1L;
     /** 更新时间 */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
-    /** 教育类型ID */
-    private Long educationTypeId;
-    /** 业务层次id */
-    private Long businessId;
-    /** 科目id */
-    private Long subjectId;
     /** 前缀名称 */
     private String prefixName;
-    /** 项目ID */
-    private Long projectId;
     /** 编码 */
     private String code;
     /** 试卷名 */

+ 31 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -4,15 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
-import com.zhongzheng.modules.bank.bo.ExamAddBo;
-import com.zhongzheng.modules.bank.bo.ExamEditBo;
-import com.zhongzheng.modules.bank.bo.ExamQueryBo;
-import com.zhongzheng.modules.bank.bo.ExamQuestionAddBo;
+import com.zhongzheng.modules.bank.bo.*;
 import com.zhongzheng.modules.bank.domain.Exam;
 import com.zhongzheng.modules.bank.domain.ExamQuestion;
+import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.mapper.ExamMapper;
 import com.zhongzheng.modules.bank.service.IExamQuestionService;
 import com.zhongzheng.modules.bank.service.IExamService;
+import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
 import com.zhongzheng.modules.bank.vo.ExamVo;
 import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
 import com.zhongzheng.modules.course.domain.CourseChapterSection;
@@ -43,6 +42,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     @Autowired
     private IExamQuestionService iExamQuestionService;
 
+    @Autowired
+    private IQuestionBusinessService iQuestionBusinessService;
+
     @Override
     public ExamVo queryById(Long examId){
         Exam db = this.baseMapper.selectById(examId);
@@ -53,11 +55,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     public List<ExamVo> queryList(ExamQueryBo bo) {
         LambdaQueryWrapper<Exam> lqw = Wrappers.lambdaQuery();
         lqw.in(bo.getStatus() != null, Exam::getStatus, bo.getStatus());
-        lqw.eq(bo.getEducationTypeId() != null, Exam::getEducationTypeId, bo.getEducationTypeId());
-        lqw.eq(bo.getBusinessId() != null, Exam::getBusinessId, bo.getBusinessId());
-        lqw.eq(bo.getSubjectId() != null, Exam::getSubjectId, bo.getSubjectId());
         lqw.like(StrUtil.isNotBlank(bo.getPrefixName()), Exam::getPrefixName, bo.getPrefixName());
-        lqw.eq(bo.getProjectId() != null, Exam::getProjectId, bo.getProjectId());
         lqw.eq(StrUtil.isNotBlank(bo.getCode()), Exam::getCode, bo.getCode());
         lqw.like(StrUtil.isNotBlank(bo.getExamName()), Exam::getExamName, bo.getExamName());
         lqw.eq(bo.getPublishStatus() != null, Exam::getPublishStatus, bo.getPublishStatus());
@@ -110,6 +108,17 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             }
             iExamQuestionService.saveBatch(coll);
         }
+        if(bo.getBusinessList()!=null){
+            Collection<QuestionBusiness> coll = new HashSet<>();
+            for(int i=0;i<bo.getBusinessList().size();i++){
+                QuestionBusinessAddBo item = bo.getBusinessList().get(i);
+                QuestionBusiness addItem = BeanUtil.toBean(item, QuestionBusiness.class);
+                addItem.setMajorId(add.getExamId());
+                addItem.setType(QuestionBusiness.TYPE_EXAM);
+                coll.add(addItem);
+            }
+            iQuestionBusinessService.saveBatch(coll);
+        }
         return result;
     }
 
@@ -132,6 +141,20 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             }
             iExamQuestionService.saveBatch(coll);
         }
+        if(bo.getBusinessList()!=null){
+            iQuestionBusinessService.remove(new LambdaQueryWrapper<QuestionBusiness>()
+                    .eq(QuestionBusiness::getMajorId, bo.getExamId())
+                    .eq(QuestionBusiness::getType,QuestionBusiness.TYPE_EXAM));
+            Collection<QuestionBusiness> coll = new HashSet<>();
+            for(int i=0;i<bo.getBusinessList().size();i++){
+                QuestionBusinessEditBo item = bo.getBusinessList().get(i);
+                QuestionBusiness addItem = BeanUtil.toBean(item, QuestionBusiness.class);
+                addItem.setMajorId(bo.getExamId());
+                addItem.setType(QuestionBusiness.TYPE_EXAM);
+                coll.add(addItem);
+            }
+            iQuestionBusinessService.saveBatch(coll);
+        }
         return this.updateById(update);
     }
 

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

@@ -9,11 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
-        <result property="educationTypeId" column="education_type_id"/>
-        <result property="businessId" column="business_id"/>
-        <result property="subjectId" column="subject_id"/>
         <result property="prefixName" column="prefix_name"/>
-        <result property="projectId" column="project_id"/>
         <result property="code" column="code"/>
         <result property="examName" column="exam_name"/>
         <result property="publishStatus" column="publish_status"/>