试卷管理,试题管理小问题修复
This commit is contained in:
parent
4516c36b1d
commit
445685132b
|
|
@ -101,6 +101,10 @@ public class ExamPaperCategoryController extends BaseController
|
|||
if(examPaperService.selectList(examPaper).size()>0){
|
||||
return error(1, "分类包含试卷,不允许扩展分类");
|
||||
}
|
||||
Integer parentId = examPaperCategory.getParentId();
|
||||
String parentIds = examPaperCategoryService.selectById(parentId).getParentIds();
|
||||
examPaperCategory.setParentIds(parentIds+","+parentId);
|
||||
|
||||
examPaperCategory.setCreateBy(ShiroUtils.getLoginName());
|
||||
examPaperCategory.setCreateDate(new Date());
|
||||
examPaperCategory.setDelFlag("0");
|
||||
|
|
@ -129,6 +133,7 @@ public class ExamPaperCategoryController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(ExamPaperCategory examPaperCategory)
|
||||
{
|
||||
ExamPaperCategory db = examPaperCategoryService.selectById(examPaperCategory.getId());
|
||||
examPaperCategory.setUpdateBy(ShiroUtils.getLoginName());
|
||||
examPaperCategory.setUpdateDate(new Date());
|
||||
|
||||
|
|
@ -140,7 +145,7 @@ public class ExamPaperCategoryController extends BaseController
|
|||
|
||||
ExamPaperCategory exam = new ExamPaperCategory();
|
||||
exam.setParentId(examPaperCategory.getId());
|
||||
if (examPaperCategoryService.selectList(exam).size() > 0)
|
||||
if (examPaperCategoryService.selectList(exam).size() > 0&&db.getParentId()!=examPaperCategory.getParentId() )
|
||||
{
|
||||
return error(1, "此分类存在下级分类,无法移动");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ExamPaperController extends BaseController
|
|||
public TableDataInfo list(ExamPaper examPaper)
|
||||
{
|
||||
List<ExamPaper> list = new ArrayList<>();
|
||||
List<ExamPaper> listByIds = getListByIds(list, examPaper);
|
||||
List<ExamPaper> listByIds = examPaperService.selectListByCategory(examPaper);
|
||||
return getDataTable(listByIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ public class ExamQuestionCategoryController extends BaseController {
|
|||
if (examQuestionService.selectList(examQuestion).size() > 0) {
|
||||
return error(1, "分类包含试题,不允许扩展分类");
|
||||
}
|
||||
Long parentId = examQuestionCategory.getParentId();
|
||||
String parentIds = examQuestionCategoryService.selectById(parentId).getParentIds();
|
||||
examQuestionCategory.setParentIds(parentIds+","+parentId);
|
||||
examQuestionCategory.setCreateBy(ShiroUtils.getLoginName());
|
||||
examQuestionCategory.setCreateDate(new Date());
|
||||
return toAjax(examQuestionCategoryService.insertExamQuestionCategory(examQuestionCategory));
|
||||
|
|
@ -123,6 +126,7 @@ public class ExamQuestionCategoryController extends BaseController {
|
|||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(ExamQuestionCategory examQuestionCategory) {
|
||||
ExamQuestionCategory db = examQuestionCategoryService.selectById(examQuestionCategory.getId());
|
||||
ExamQuestion examQuestion = new ExamQuestion();
|
||||
examQuestion.setCategoryId(examQuestionCategory.getParentId().toString());
|
||||
|
||||
|
|
@ -131,10 +135,13 @@ public class ExamQuestionCategoryController extends BaseController {
|
|||
}
|
||||
|
||||
ExamQuestionCategory exam = new ExamQuestionCategory();
|
||||
exam.setParentId(exam.getId());
|
||||
if (examQuestionCategoryService.selectList(exam).size() > 0) {
|
||||
exam.setParentId(examQuestionCategory.getId());
|
||||
if (examQuestionCategoryService.selectList(exam).size() > 0&&examQuestionCategory.getParentId()!=db.getParentId()) {
|
||||
return error(1, "此分类存在下级分类,无法移动");
|
||||
}
|
||||
Long parentId = examQuestionCategory.getParentId();
|
||||
String parentIds = examQuestionCategoryService.selectById(parentId).getParentIds();
|
||||
examQuestionCategory.setParentIds(parentIds+","+parentId);
|
||||
return toAjax(examQuestionCategoryService.updateExamQuestionCategory(examQuestionCategory));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class ExamQuestionController extends BaseController
|
|||
public TableDataInfo list(ExamQuestion examQuestion)
|
||||
{
|
||||
ArrayList<ExamQuestion> objects = new ArrayList<>();
|
||||
List<ExamQuestion> listByIds = getListByIds(objects, examQuestion);
|
||||
List<ExamQuestion> listByIds = examQuestionService.selectListBycategory(examQuestion);
|
||||
return getDataTable(listByIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@ public interface ExamPaperMapper extends MyMapper<ExamPaper>
|
|||
* @return 试卷集合
|
||||
*/
|
||||
public List<ExamPaper> selectExamPaperList(ExamPaper examPaper);
|
||||
|
||||
|
||||
List<ExamPaper> selectListByCategory(ExamPaper examPaper);
|
||||
}
|
||||
|
|
@ -60,4 +60,5 @@ public interface ExamQuestionMapper extends MyMapper<ExamQuestion>
|
|||
*/
|
||||
public int deleteExamQuestionByIds(String[] ids);
|
||||
|
||||
List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion);
|
||||
}
|
||||
|
|
@ -26,5 +26,6 @@ public interface IExamPaperService extends AbstractBaseService<ExamPaper>
|
|||
*/
|
||||
public List<ExamPaper> selectExamPaperList(ExamPaper examPaper);
|
||||
|
||||
|
||||
|
||||
List<ExamPaper> selectListByCategory(ExamPaper examPaper);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,6 @@ public interface IExamQuestionService extends AbstractBaseService<ExamQuestion>
|
|||
List<ExamQuestion> selectByIds(List<String> ids);
|
||||
|
||||
List<ExamQuestion> selectQuestionList(ExamQuestion examQuestion);
|
||||
|
||||
List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@ public class ExamPaperServiceImpl extends AbstractBaseServiceImpl<ExamPaperMappe
|
|||
{
|
||||
return examPaperMapper.selectExamPaperList(examPaper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamPaper> selectListByCategory(ExamPaper examPaper) {
|
||||
startPage();
|
||||
return examPaperMapper.selectListByCategory(examPaper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷分页列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -155,4 +155,10 @@ public class ExamQuestionServiceImpl extends AbstractBaseServiceImpl<ExamQuestio
|
|||
return examQuestionMapper.selectExamQuestionList(examQuestion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion) {
|
||||
startPage();
|
||||
return examQuestionMapper.selectListBycategory(examQuestion);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectListByCategory" parameterType="ExamPaper" resultMap="ExamPaperResult">
|
||||
select
|
||||
<include refid="selectExamPaperVo"/>
|
||||
from exam_paper
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="examPaperCategoryId != null "> and (exam_paper_category_id in
|
||||
(select id from exam_paper_category where FIND_IN_SET(#{examPaperCategoryId},parent_ids))
|
||||
or exam_paper_category_id = #{examPaperCategoryId} )</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="type != null and type != '' "> and type = #{type}</if>
|
||||
<if test="score != null "> and score = #{score}</if>
|
||||
<if test="questionNumber != null "> and question_number = #{questionNumber}</if>
|
||||
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -46,6 +46,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectListBycategory" parameterType="ExamQuestion" resultMap="ExamQuestionResult">
|
||||
select id, title, answer, type, label, category_id, create_by, create_date, update_by, update_date, remarks, del_flag from exam_question
|
||||
<where>
|
||||
<if test="id != null and id != '' "> and id = #{id}</if>
|
||||
<if test="title != null and title != '' "> and title = #{title}</if>
|
||||
<if test="answer != null and answer != '' "> and answer = #{answer}</if>
|
||||
<if test="type != null and type != '' "> and type = #{type}</if>
|
||||
<if test="label != null and label != '' "> and label = #{label}</if>
|
||||
<if test="categoryId != null and categoryId != '' "> and (category_id in
|
||||
(select id from exam_question_category where FIND_IN_SET(#{categoryId},parent_ids))
|
||||
or category_id = #{categoryId} )</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertExamQuestion" keyProperty="id" useGeneratedKeys="true" parameterType="ExamQuestion">
|
||||
insert into exam_question
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
|||
Loading…
Reference in New Issue