试卷修改题目数量校验

main
hujunpeng 4 months ago
parent 1c000a46cb
commit 4fca5933a4
  1. 10
      ccic-exam/src/main/java/com/ccic/safeliab/dao/ExamPaperMapper.java
  2. 8
      ccic-exam/src/main/java/com/ccic/safeliab/service/ExamPaperService.java
  3. 5
      ccic-exam/src/main/java/com/ccic/safeliab/service/ExamPaperServiceImpl.java
  4. 11
      ccic-exam/src/main/java/com/ccic/safeliab/web/ExamPaperController.java
  5. 12
      ccic-exam/src/main/resources/mappers/ExamPaperMapper.xml

@ -63,12 +63,20 @@ public interface ExamPaperMapper extends BaseMapper<ExamPapers> {
* *
* @param industryId 监管行业 * @param industryId 监管行业
* @param questionCount 题目数量 * @param questionCount 题目数量
* @return * @return
*/ */
List<QuestionCategories> getRandomQuestions( List<QuestionCategories> getRandomQuestions(
@Param("industryId") Long industryId, @Param("industryId") Long industryId,
@Param("questionCount") Integer questionCount); @Param("questionCount") Integer questionCount);
/**
* 获取监管行业下的所有试题
*
* @param industryId 监管行业
* @return 试题
*/
int geIndustryQuestions( @Param("industryId") Long industryId);
/** /**
* 查询试卷是否被引用 * 查询试卷是否被引用
* *

@ -54,6 +54,14 @@ public interface ExamPaperService extends BaseService<ExamPapers> {
*/ */
List<QuestionCategories> getRandomQuestions(ExamPapers entity); List<QuestionCategories> getRandomQuestions(ExamPapers entity);
/**
* 获取监管行业下的所有试题
*
* @param industryId 监管行业
* @return 试题
*/
int geIndustryQuestions(Long industryId);
/** /**
* 添加试卷 * 添加试卷
* *

@ -125,6 +125,11 @@ public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaperMapper, ExamP
return baseMapper.getRandomQuestions(entity.getIndustryId(), entity.getQuestionCount()); return baseMapper.getRandomQuestions(entity.getIndustryId(), entity.getQuestionCount());
} }
@Override
public int geIndustryQuestions(Long industryId) {
return baseMapper.geIndustryQuestions(industryId);
}
@Override @Override
public boolean addExamPaper(InsExamPaperVO vo) { public boolean addExamPaper(InsExamPaperVO vo) {
// 试卷 // 试卷

@ -70,6 +70,17 @@ public class ExamPaperController {
return R.ok().data(data); return R.ok().data(data);
} }
/**
* 获取监管行业下的所有试题
* @param vo 试卷vo
* @return 试题
*/
@PostMapping("/geIndustryQuestions")
public R geIndustryQuestions(@RequestBody InsExamPaperVO vo) {
int total = examPaperService.geIndustryQuestions(vo.getIndustryId());
return R.ok().data(total);
}
/** /**
* 获取试卷详情 * 获取试卷详情
* @param id 试卷ID * @param id 试卷ID

@ -156,4 +156,16 @@
</if> </if>
</where> </where>
</select> </select>
<select id="geIndustryQuestions" resultType="int">
SELECT
count(id)
FROM
ex_question_categories
<where>
is_deleted = '0'
<if test="industryId!= null and industryId!= ''">
AND industry_id = #{industryId}
</if>
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save