kangwei:在线题库,试题显示提交人、提交部门,提交时间
预览题库下试题列表
正在显示
16 个修改的文件
包含
274 行增加
和
19 行删除
... | @@ -66,8 +66,6 @@ public class AjhRectificationInfoServiceImpl extends ServiceImpl<AjhRectificatio | ... | @@ -66,8 +66,6 @@ public class AjhRectificationInfoServiceImpl extends ServiceImpl<AjhRectificatio |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public Map<String, Object> searchSafeCensus(String now, String paramType) { | 68 | public Map<String, Object> searchSafeCensus(String now, String paramType) { |
69 | |||
70 | |||
71 | String nowMonth = now;//本月 | 69 | String nowMonth = now;//本月 |
72 | String[] dateList = now.split("-"); | 70 | String[] dateList = now.split("-"); |
73 | String lastYear = null; | 71 | String lastYear = null; | ... | ... |
... | @@ -10,13 +10,16 @@ import javax.servlet.http.HttpServletRequest; | ... | @@ -10,13 +10,16 @@ import javax.servlet.http.HttpServletRequest; |
10 | import javax.servlet.http.HttpServletResponse; | 10 | import javax.servlet.http.HttpServletResponse; |
11 | import com.skua.core.api.vo.Result; | 11 | import com.skua.core.api.vo.Result; |
12 | import com.skua.core.aspect.annotation.AutoLog; | 12 | import com.skua.core.aspect.annotation.AutoLog; |
13 | import com.skua.core.context.BaseContextHandler; | ||
13 | import com.skua.core.query.QueryGenerator; | 14 | import com.skua.core.query.QueryGenerator; |
14 | import com.skua.core.util.ConvertUtils; | 15 | import com.skua.core.util.ConvertUtils; |
15 | import com.skua.modules.edu.entity.Question; | 16 | import com.skua.modules.edu.entity.Question; |
17 | import com.skua.modules.edu.entity.QuestionDB; | ||
16 | import com.skua.modules.edu.service.IQuestionService; | 18 | import com.skua.modules.edu.service.IQuestionService; |
17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 19 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
18 | import com.baomidou.mybatisplus.core.metadata.IPage; | 20 | import com.baomidou.mybatisplus.core.metadata.IPage; |
19 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 21 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
22 | import com.skua.modules.system.service.ISysDepartService; | ||
20 | import lombok.extern.slf4j.Slf4j; | 23 | import lombok.extern.slf4j.Slf4j; |
21 | 24 | ||
22 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 25 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
... | @@ -49,6 +52,9 @@ public class QuestionController { | ... | @@ -49,6 +52,9 @@ public class QuestionController { |
49 | @Autowired | 52 | @Autowired |
50 | private IQuestionService questionService; | 53 | private IQuestionService questionService; |
51 | 54 | ||
55 | @Autowired | ||
56 | private ISysDepartService departService; | ||
57 | |||
52 | /** | 58 | /** |
53 | * <pre> | 59 | * <pre> |
54 | * 分页列表查询 | 60 | * 分页列表查询 |
... | @@ -70,14 +76,34 @@ public class QuestionController { | ... | @@ -70,14 +76,34 @@ public class QuestionController { |
70 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 76 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
71 | HttpServletRequest req) { | 77 | HttpServletRequest req) { |
72 | Result<IPage<Question>> result = new Result<IPage<Question>>(); | 78 | Result<IPage<Question>> result = new Result<IPage<Question>>(); |
73 | QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap()); | 79 | //QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap()); |
74 | Page<Question> page = new Page<Question>(pageNo, pageSize); | 80 | Page<Question> page = new Page<Question>(pageNo, pageSize); |
75 | IPage<Question> pageList = questionService.page(page, queryWrapper); | 81 | //IPage<Question> pageList = questionService.page(page, queryWrapper); |
82 | IPage<Question> pageList = questionService.queryPageList(page, question); | ||
76 | result.setSuccess(true); | 83 | result.setSuccess(true); |
77 | result.setResult(pageList); | 84 | result.setResult(pageList); |
78 | return result; | 85 | return result; |
79 | } | 86 | } |
80 | 87 | ||
88 | @AutoLog(value = "在线考试-题库-题库下试题列表") | ||
89 | @ApiOperation(value="在线考试-题库下试题列表", notes="在线考试-题库下试题列表") | ||
90 | @GetMapping(value = "/questionList/{dbId}") | ||
91 | public Result<List<Question>> queryPageList(@PathVariable("dbId") String dbId) { | ||
92 | Result<List<Question>> result = new Result<List<Question>>(); | ||
93 | //QueryWrapper<QuestionDB> queryWrapper = QueryGenerator.initQueryWrapper(questionDB, req.getParameterMap()); | ||
94 | //List<QuestionDB> questionDBList = questionDBService.list(queryWrapper); | ||
95 | /*QueryWrapper<Question> queryWrapper = new QueryWrapper(); | ||
96 | queryWrapper.eq("question_db_id",dbId); | ||
97 | queryWrapper.orderByDesc("create_time");*/ | ||
98 | Question question = new Question(); | ||
99 | question.setQuestionDbId(dbId); | ||
100 | List<Question> questionDBList = questionService.selectQuestionList(question ) ; | ||
101 | |||
102 | result.setSuccess(true); | ||
103 | result.setResult(questionDBList); | ||
104 | return result; | ||
105 | } | ||
106 | |||
81 | /** | 107 | /** |
82 | * <pre> | 108 | * <pre> |
83 | * 添加 | 109 | * 添加 |
... | @@ -93,6 +119,8 @@ public class QuestionController { | ... | @@ -93,6 +119,8 @@ public class QuestionController { |
93 | public Result<Question> add(@RequestBody Question question)throws Exception { | 119 | public Result<Question> add(@RequestBody Question question)throws Exception { |
94 | Result<Question> result = new Result<Question>(); | 120 | Result<Question> result = new Result<Question>(); |
95 | try { | 121 | try { |
122 | question.setCreateBy(BaseContextHandler.getUserId()); | ||
123 | question.setCreateDept(BaseContextHandler.getRealDepartId()); | ||
96 | questionService.saveQuestion(question); | 124 | questionService.saveQuestion(question); |
97 | result.success("添加成功!"); | 125 | result.success("添加成功!"); |
98 | } catch (Exception e) { | 126 | } catch (Exception e) { |
... | @@ -119,6 +147,7 @@ public class QuestionController { | ... | @@ -119,6 +147,7 @@ public class QuestionController { |
119 | if(questionEntity==null) { | 147 | if(questionEntity==null) { |
120 | result.error500("未找到对应实体"); | 148 | result.error500("未找到对应实体"); |
121 | }else { | 149 | }else { |
150 | question.setUpdateBy(BaseContextHandler.getUserId()); | ||
122 | boolean ok = questionService.updateQuestion(question); | 151 | boolean ok = questionService.updateQuestion(question); |
123 | //TODO 返回false说明什么? | 152 | //TODO 返回false说明什么? |
124 | if(ok) { | 153 | if(ok) { | ... | ... |
... | @@ -75,8 +75,10 @@ public class QuestionDBController { | ... | @@ -75,8 +75,10 @@ public class QuestionDBController { |
75 | @GetMapping(value = "/qbList") | 75 | @GetMapping(value = "/qbList") |
76 | public Result<List<QuestionDB>> queryPageList(QuestionDB questionDB, HttpServletRequest req) { | 76 | public Result<List<QuestionDB>> queryPageList(QuestionDB questionDB, HttpServletRequest req) { |
77 | Result<List<QuestionDB>> result = new Result<List<QuestionDB>>(); | 77 | Result<List<QuestionDB>> result = new Result<List<QuestionDB>>(); |
78 | QueryWrapper<QuestionDB> queryWrapper = QueryGenerator.initQueryWrapper(questionDB, req.getParameterMap()); | 78 | //QueryWrapper<QuestionDB> queryWrapper = QueryGenerator.initQueryWrapper(questionDB, req.getParameterMap()); |
79 | List<QuestionDB> questionDBList = questionDBService.list(queryWrapper); | 79 | //List<QuestionDB> questionDBList = questionDBService.list(queryWrapper); |
80 | List<QuestionDB> questionDBList = questionDBService.selectQuestionDbList(questionDB ) ; | ||
81 | |||
80 | result.setSuccess(true); | 82 | result.setSuccess(true); |
81 | result.setResult(questionDBList); | 83 | result.setResult(questionDBList); |
82 | return result; | 84 | return result; |
... | @@ -95,7 +97,8 @@ public class QuestionDBController { | ... | @@ -95,7 +97,8 @@ public class QuestionDBController { |
95 | Result<IPage<QuestionDB>> result = new Result<IPage<QuestionDB>>(); | 97 | Result<IPage<QuestionDB>> result = new Result<IPage<QuestionDB>>(); |
96 | QueryWrapper<QuestionDB> queryWrapper = QueryGenerator.initQueryWrapper(questionDB, req.getParameterMap()); | 98 | QueryWrapper<QuestionDB> queryWrapper = QueryGenerator.initQueryWrapper(questionDB, req.getParameterMap()); |
97 | Page<QuestionDB> page = new Page<QuestionDB>(pageNo, pageSize); | 99 | Page<QuestionDB> page = new Page<QuestionDB>(pageNo, pageSize); |
98 | IPage<QuestionDB> pageList = questionDBService.page(page, queryWrapper); | 100 | //IPage<QuestionDB> pageList = questionDBService.page(page, queryWrapper); |
101 | IPage<QuestionDB> pageList = questionDBService.queryPageList(page,questionDB); | ||
99 | result.setSuccess(true); | 102 | result.setSuccess(true); |
100 | result.setResult(pageList); | 103 | result.setResult(pageList); |
101 | return result; | 104 | return result; | ... | ... |
1 | package com.skua.modules.edu.entity; | 1 | package com.skua.modules.edu.entity; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | import java.lang.reflect.Type; | ||
4 | import java.util.Date; | 5 | import java.util.Date; |
5 | import java.util.List; | 6 | import java.util.List; |
6 | 7 | ||
... | @@ -8,12 +9,16 @@ import com.baomidou.mybatisplus.annotation.IdType; | ... | @@ -8,12 +9,16 @@ import com.baomidou.mybatisplus.annotation.IdType; |
8 | import com.baomidou.mybatisplus.annotation.TableId; | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
9 | import com.baomidou.mybatisplus.annotation.TableName; | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
10 | import com.baomidou.mybatisplus.annotation.TableField; | 11 | import com.baomidou.mybatisplus.annotation.TableField; |
12 | import com.google.gson.Gson; | ||
13 | import com.google.gson.reflect.TypeToken; | ||
14 | import com.skua.core.aspect.annotation.Dict; | ||
11 | import io.swagger.annotations.ApiModel; | 15 | import io.swagger.annotations.ApiModel; |
12 | import io.swagger.annotations.ApiModelProperty; | 16 | import io.swagger.annotations.ApiModelProperty; |
13 | import lombok.Data; | 17 | import lombok.Data; |
14 | import lombok.EqualsAndHashCode; | 18 | import lombok.EqualsAndHashCode; |
15 | import lombok.experimental.Accessors; | 19 | import lombok.experimental.Accessors; |
16 | import com.fasterxml.jackson.annotation.JsonFormat; | 20 | import com.fasterxml.jackson.annotation.JsonFormat; |
21 | import org.apache.commons.lang3.StringUtils; | ||
17 | import org.springframework.format.annotation.DateTimeFormat; | 22 | import org.springframework.format.annotation.DateTimeFormat; |
18 | import org.jeecgframework.poi.excel.annotation.Excel; | 23 | import org.jeecgframework.poi.excel.annotation.Excel; |
19 | 24 | ||
... | @@ -26,7 +31,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; | ... | @@ -26,7 +31,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; |
26 | @Accessors(chain = true) | 31 | @Accessors(chain = true) |
27 | @ApiModel(value="edu_question对象", description="在线考试-试题") | 32 | @ApiModel(value="edu_question对象", description="在线考试-试题") |
28 | public class Question { | 33 | public class Question { |
29 | 34 | ||
30 | /**主键*/ | 35 | /**主键*/ |
31 | @TableId(type = IdType.ID_WORKER_STR) | 36 | @TableId(type = IdType.ID_WORKER_STR) |
32 | @ApiModelProperty(value = "主键") | 37 | @ApiModelProperty(value = "主键") |
... | @@ -58,8 +63,10 @@ public class Question { | ... | @@ -58,8 +63,10 @@ public class Question { |
58 | private String remark; | 63 | private String remark; |
59 | /**上传人*/ | 64 | /**上传人*/ |
60 | @Excel(name = "上传人", width = 15) | 65 | @Excel(name = "上传人", width = 15) |
66 | @Dict(dicCode = "id",dictTable = "sys_user",dicText = "realname") | ||
61 | @ApiModelProperty(value = "上传人") | 67 | @ApiModelProperty(value = "上传人") |
62 | private String createBy; | 68 | private String createBy; |
69 | |||
63 | /**上传时间*/ | 70 | /**上传时间*/ |
64 | @Excel(name = "上传时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | 71 | @Excel(name = "上传时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
65 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | 72 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
... | @@ -69,6 +76,7 @@ public class Question { | ... | @@ -69,6 +76,7 @@ public class Question { |
69 | /**更新人*/ | 76 | /**更新人*/ |
70 | @Excel(name = "更新人", width = 15) | 77 | @Excel(name = "更新人", width = 15) |
71 | @ApiModelProperty(value = "更新人") | 78 | @ApiModelProperty(value = "更新人") |
79 | @Dict(dicCode = "id",dictTable = "sys_user",dicText = "realname") | ||
72 | private String updateBy; | 80 | private String updateBy; |
73 | /**更新时间*/ | 81 | /**更新时间*/ |
74 | @Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | 82 | @Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
... | @@ -80,7 +88,11 @@ public class Question { | ... | @@ -80,7 +88,11 @@ public class Question { |
80 | @Excel(name = "delFlag", width = 15) | 88 | @Excel(name = "delFlag", width = 15) |
81 | @ApiModelProperty(value = "delFlag") | 89 | @ApiModelProperty(value = "delFlag") |
82 | private Integer delFlag; | 90 | private Integer delFlag; |
83 | 91 | /**厂站ID*/ | |
92 | @Excel(name = "厂站ID", width = 15) | ||
93 | @ApiModelProperty(value = "厂站ID") | ||
94 | @Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name") | ||
95 | private String createDept; | ||
84 | 96 | ||
85 | /**试题分值*/ | 97 | /**试题分值*/ |
86 | @TableField(exist=false) | 98 | @TableField(exist=false) |
... | @@ -102,4 +114,21 @@ public class Question { | ... | @@ -102,4 +114,21 @@ public class Question { |
102 | private String userAnswer; | 114 | private String userAnswer; |
103 | 115 | ||
104 | 116 | ||
117 | @TableField(exist=false) | ||
118 | @ApiModelProperty(value = "厂站名称") | ||
119 | private String departName; | ||
120 | |||
121 | @TableField(exist=false) | ||
122 | @ApiModelProperty(value = "用户名称") | ||
123 | private String userName; | ||
124 | |||
125 | public List<QuestionOption> getOptionList() { | ||
126 | if(optionList == null && StringUtils.isNotEmpty(questionData)){ | ||
127 | // 创建Gson实例 | ||
128 | Gson gson = new Gson(); | ||
129 | Type questionTypeListType = new TypeToken<List<QuestionOption>>() {}.getType(); | ||
130 | optionList = gson.fromJson(questionData,questionTypeListType); | ||
131 | } | ||
132 | return optionList; | ||
133 | } | ||
105 | } | 134 | } | ... | ... |
... | @@ -84,4 +84,17 @@ public class QuestionDB { | ... | @@ -84,4 +84,17 @@ public class QuestionDB { |
84 | @Excel(name = "delFlag", width = 15) | 84 | @Excel(name = "delFlag", width = 15) |
85 | @ApiModelProperty(value = "delFlag") | 85 | @ApiModelProperty(value = "delFlag") |
86 | private Integer delFlag; | 86 | private Integer delFlag; |
87 | |||
88 | |||
89 | @TableField(exist=false) | ||
90 | @ApiModelProperty(value = "单选题数目") | ||
91 | private Integer singleNum; | ||
92 | |||
93 | @TableField(exist=false) | ||
94 | @ApiModelProperty(value = "多选题数目") | ||
95 | private Integer multipleNum; | ||
96 | |||
97 | @TableField(exist=false) | ||
98 | @ApiModelProperty(value = "判断题数目") | ||
99 | private Integer judgeNum; | ||
87 | } | 100 | } | ... | ... |
... | @@ -23,8 +23,8 @@ import org.jeecgframework.poi.excel.annotation.Excel; | ... | @@ -23,8 +23,8 @@ import org.jeecgframework.poi.excel.annotation.Excel; |
23 | @EqualsAndHashCode(callSuper = false) | 23 | @EqualsAndHashCode(callSuper = false) |
24 | @Accessors(chain = true) | 24 | @Accessors(chain = true) |
25 | @ApiModel(value="edu_question_option对象", description="在线考试-试题选项") | 25 | @ApiModel(value="edu_question_option对象", description="在线考试-试题选项") |
26 | public class QuestionOption { | 26 | public class QuestionOption implements Serializable { |
27 | 27 | ||
28 | /**主键*/ | 28 | /**主键*/ |
29 | @TableId(type = IdType.ID_WORKER_STR) | 29 | @TableId(type = IdType.ID_WORKER_STR) |
30 | @ApiModelProperty(value = "主键") | 30 | @ApiModelProperty(value = "主键") | ... | ... |
1 | package com.skua.modules.edu.mapper; | 1 | package com.skua.modules.edu.mapper; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | |||
5 | import org.apache.ibatis.annotations.Param; | ||
6 | import com.skua.modules.edu.entity.QuestionDB; | 4 | import com.skua.modules.edu.entity.QuestionDB; |
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
8 | |||
9 | /** | 6 | /** |
10 | * 在线考试-题库 | 7 | * 在线考试-题库 |
11 | */ | 8 | */ |
12 | public interface QuestionDBMapper extends BaseMapper<QuestionDB> { | 9 | public interface QuestionDBMapper extends BaseMapper<QuestionDB> { |
13 | 10 | /*** | |
11 | * 列表查询 | ||
12 | * @param questionDB | ||
13 | * @return | ||
14 | */ | ||
15 | public List<QuestionDB> selectQuestionDbList(QuestionDB questionDB); | ||
14 | } | 16 | } | ... | ... |
... | @@ -2,6 +2,9 @@ package com.skua.modules.edu.mapper; | ... | @@ -2,6 +2,9 @@ package com.skua.modules.edu.mapper; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | 4 | ||
5 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
7 | import com.skua.modules.edu.entity.QuestionDB; | ||
5 | import org.apache.ibatis.annotations.Param; | 8 | import org.apache.ibatis.annotations.Param; |
6 | import com.skua.modules.edu.entity.Question; | 9 | import com.skua.modules.edu.entity.Question; |
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 10 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
... | @@ -31,4 +34,21 @@ public interface QuestionMapper extends BaseMapper<Question> { | ... | @@ -31,4 +34,21 @@ public interface QuestionMapper extends BaseMapper<Question> { |
31 | * @return | 34 | * @return |
32 | */ | 35 | */ |
33 | public int checkByPaper(@Param("questionId")String questionId); | 36 | public int checkByPaper(@Param("questionId")String questionId); |
37 | |||
38 | |||
39 | /** | ||
40 | * 查询在线考试--试题列表 | ||
41 | * | ||
42 | * @param eduQuestion 在线考试--试题 | ||
43 | * @return 在线考试--试题集合 | ||
44 | */ | ||
45 | public List<Question> selectQuestionList(Question eduQuestion); | ||
46 | |||
47 | /** | ||
48 | * 分页检索 | ||
49 | * | ||
50 | * @param eduQuestion 在线考试--试题 | ||
51 | * @return 在线考试--试题集合 | ||
52 | */ | ||
53 | public IPage<Question> queryPageList(Page<Question> page,@Param("param") Question eduQuestion); | ||
34 | } | 54 | } | ... | ... |
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.skua.modules.edu.mapper.QuestionDBMapper"> | 3 | <mapper namespace="com.skua.modules.edu.mapper.QuestionDBMapper"> |
4 | <resultMap type="com.skua.modules.edu.entity.QuestionDB" id="EduQuestionDbResult"> | ||
5 | <result property="id" column="id" /> | ||
6 | <result property="departId" column="depart_id" /> | ||
7 | <result property="userId" column="user_id" /> | ||
8 | <result property="parentId" column="parent_id" /> | ||
9 | <result property="dbName" column="db_name" /> | ||
10 | <result property="status" column="status" /> | ||
11 | <result property="remark" column="remark" /> | ||
12 | <result property="createBy" column="create_by" /> | ||
13 | <result property="createTime" column="create_time" /> | ||
14 | <result property="updateBy" column="update_by" /> | ||
15 | <result property="updateTime" column="update_time" /> | ||
16 | <result property="createDept" column="create_dept" /> | ||
17 | <result property="delFlag" column="del_flag" /> | ||
18 | <result property="singleNum" column="single_num" /> | ||
19 | <result property="multipleNum" column="multiple_num" /> | ||
20 | <result property="judgeNum" column="judge_num" /> | ||
21 | </resultMap> | ||
4 | 22 | ||
5 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
23 | <sql id="selectEduQuestionDbVo"> | ||
24 | select id, depart_id, user_id, parent_id, db_name, status, remark, create_by, create_time, update_by, update_time, create_dept, del_flag from edu_question_db | ||
25 | </sql> | ||
26 | |||
27 | <select id="selectQuestionDbList" parameterType="com.skua.modules.edu.entity.QuestionDB" resultMap="EduQuestionDbResult"> | ||
28 | select t.* , ifnull(aaa.single_num,0) single_num , ifnull(aaa.multiple_num,0) multiple_num , ifnull(aaa.judge_num,0) judge_num from edu_question_db t | ||
29 | left join ( | ||
30 | SELECT question_db_id , question_type, | ||
31 | SUM(IF(`question_type`='1',1,0))as 'single_num', | ||
32 | SUM(IF(`question_type`='2',1,0))as 'multiple_num', | ||
33 | SUM(IF(`question_type`='3',1,0))as 'judge_num' | ||
34 | FROM edu_question | ||
35 | group by question_db_id , question_type | ||
36 | )aaa on aaa.question_db_id = t.id | ||
37 | <where> | ||
38 | <if test="departId != null and departId != ''"> and t.depart_id = #{departId}</if> | ||
39 | <if test="userId != null and userId != ''"> and t.user_id = #{userId}</if> | ||
40 | <if test="parentId != null and parentId != ''"> and t.parent_id = #{parentId}</if> | ||
41 | <if test="dbName != null and dbName != ''"> and t.db_name like concat('%', #{dbName}, '%')</if> | ||
42 | <if test="status != null and status != ''"> and t.status = #{status}</if> | ||
43 | <if test="createDept != null and createDept != ''"> and t.create_dept = #{createDept}</if> | ||
44 | <if test="delFlag != null "> and t.del_flag = #{delFlag}</if> | ||
45 | </where> | ||
46 | </select> | ||
47 | |||
48 | </mapper> | ... | ... |
... | @@ -2,6 +2,66 @@ | ... | @@ -2,6 +2,66 @@ |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.skua.modules.edu.mapper.QuestionMapper"> | 3 | <mapper namespace="com.skua.modules.edu.mapper.QuestionMapper"> |
4 | 4 | ||
5 | <resultMap type="com.skua.modules.edu.entity.Question" id="EduQuestionResult"> | ||
6 | <result property="id" column="id" /> | ||
7 | <result property="questionDbId" column="question_db_id" /> | ||
8 | <result property="questionTitle" column="question_title" /> | ||
9 | <result property="questionType" column="question_type" /> | ||
10 | <result property="questionAnswer" column="question_answer" /> | ||
11 | <result property="questionData" column="question_data" /> | ||
12 | <result property="analyzes" column="analyzes" /> | ||
13 | <result property="remark" column="remark" /> | ||
14 | <result property="createBy" column="create_by" /> | ||
15 | <result property="createTime" column="create_time" /> | ||
16 | <result property="updateBy" column="update_by" /> | ||
17 | <result property="updateTime" column="update_time" /> | ||
18 | <result property="createDept" column="create_dept" /> | ||
19 | <result property="delFlag" column="del_flag" /> | ||
20 | <result property="departName" column="depart_name" /> | ||
21 | <result property="userName" column="user_name" /> | ||
22 | |||
23 | </resultMap> | ||
24 | |||
25 | <sql id="selectEduQuestionVo"> | ||
26 | select id, question_db_id, question_title, question_type, question_answer, question_data, analyzes, remark, create_by, create_time, update_by, update_time, create_dept, del_flag from edu_question | ||
27 | </sql> | ||
28 | <select id="queryPageList" resultMap="EduQuestionResult"> | ||
29 | select d.depart_name ,u.realname 'user_name' , t.* from edu_question t | ||
30 | left join sys_depart d on d.id = t.create_dept | ||
31 | left join sys_user u on u.id = t.create_by | ||
32 | <where> | ||
33 | <if test="param.questionDbId != null and param.questionDbId != ''"> and t.question_db_id = #{param.questionDbId}</if> | ||
34 | <if test="param.questionTitle != null and param.questionTitle != ''"> and t.question_title = #{param.questionTitle}</if> | ||
35 | <if test="param.questionType != null and param.questionType != ''"> and t.question_type = #{param.questionType}</if> | ||
36 | <if test="param.questionAnswer != null and param.questionAnswer != ''"> and t.question_answer = #{param.questionAnswer}</if> | ||
37 | <if test="param.questionData != null and param.questionData != ''"> and t.question_data = #{param.questionData}</if> | ||
38 | <if test="param.analyzes != null and param.analyzes != ''"> and t.analyzes = #{param.analyzes}</if> | ||
39 | <if test="param.createDept != null and param.createDept != ''"> and t.create_dept = #{param.createDept}</if> | ||
40 | <if test="param.delFlag != null "> and t.del_flag = #{param.delFlag}</if> | ||
41 | </where> | ||
42 | |||
43 | order by create_time desc | ||
44 | </select> | ||
45 | |||
46 | <select id="selectQuestionList" parameterType="com.skua.modules.edu.entity.Question" resultMap="EduQuestionResult"> | ||
47 | select d.depart_name ,u.realname 'user_name' , t.* from edu_question t | ||
48 | left join sys_depart d on d.id = t.create_dept | ||
49 | left join sys_user u on u.id = t.create_by | ||
50 | <where> | ||
51 | <if test="questionDbId != null and questionDbId != ''"> and t.question_db_id = #{questionDbId}</if> | ||
52 | <if test="questionTitle != null and questionTitle != ''"> and t.question_title = #{questionTitle}</if> | ||
53 | <if test="questionType != null and questionType != ''"> and t.question_type = #{questionType}</if> | ||
54 | <if test="questionAnswer != null and questionAnswer != ''"> and t.question_answer = #{questionAnswer}</if> | ||
55 | <if test="questionData != null and questionData != ''"> and t.question_data = #{questionData}</if> | ||
56 | <if test="analyzes != null and analyzes != ''"> and t.analyzes = #{analyzes}</if> | ||
57 | <if test="createDept != null and createDept != ''"> and t.create_dept = #{createDept}</if> | ||
58 | <if test="delFlag != null "> and t.del_flag = #{delFlag}</if> | ||
59 | </where> | ||
60 | |||
61 | order by create_time desc | ||
62 | </select> | ||
63 | |||
64 | |||
5 | <!-- 根据试卷编号获取试题集合--> | 65 | <!-- 根据试卷编号获取试题集合--> |
6 | <select id="selectListByPaperId" resultType="com.skua.modules.edu.entity.Question"> | 66 | <select id="selectListByPaperId" resultType="com.skua.modules.edu.entity.Question"> |
7 | select q.* ,pq.score from edu_paper_question pq | 67 | select q.* ,pq.score from edu_paper_question pq |
... | @@ -24,4 +84,4 @@ | ... | @@ -24,4 +84,4 @@ |
24 | </select> | 84 | </select> |
25 | 85 | ||
26 | 86 | ||
27 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
87 | </mapper> | ... | ... |
1 | package com.skua.modules.edu.service; | 1 | package com.skua.modules.edu.service; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
3 | import com.skua.modules.edu.entity.QuestionDB; | 5 | import com.skua.modules.edu.entity.QuestionDB; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
7 | import com.skua.modules.safe.entity.DangerLevelManageShare; | ||
8 | |||
9 | import java.util.List; | ||
5 | 10 | ||
6 | /** | 11 | /** |
7 | * 在线考试-题库 | 12 | * 在线考试-题库 |
... | @@ -14,4 +19,14 @@ public interface IQuestionDBService extends IService<QuestionDB> { | ... | @@ -14,4 +19,14 @@ public interface IQuestionDBService extends IService<QuestionDB> { |
14 | * @return | 19 | * @return |
15 | */ | 20 | */ |
16 | public boolean checkByDel(String id); | 21 | public boolean checkByDel(String id); |
22 | |||
23 | |||
24 | IPage<QuestionDB> queryPageList(Page<QuestionDB> page, QuestionDB questionDB) ; | ||
25 | |||
26 | /*** | ||
27 | * | ||
28 | * @param questionDB | ||
29 | * @return | ||
30 | */ | ||
31 | public List<QuestionDB> selectQuestionDbList(QuestionDB questionDB); | ||
17 | } | 32 | } | ... | ... |
1 | package com.skua.modules.edu.service; | 1 | package com.skua.modules.edu.service; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
3 | import com.skua.modules.edu.entity.Question; | 5 | import com.skua.modules.edu.entity.Question; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | 7 | ||
8 | import java.util.List; | ||
9 | |||
6 | /** | 10 | /** |
7 | * 在线考试-试题 | 11 | * 在线考试-试题 |
8 | */ | 12 | */ |
9 | public interface IQuestionService extends IService<Question> { | 13 | public interface IQuestionService extends IService<Question> { |
10 | 14 | ||
11 | /*** | 15 | /*** |
16 | * 分页检索 | ||
17 | * @param page | ||
18 | * @param questionDB | ||
19 | * @return | ||
20 | */ | ||
21 | public IPage<Question> queryPageList(Page<Question> page, Question questionDB) ; | ||
22 | |||
23 | public List<Question> selectQuestionList(Question questionDB); | ||
24 | /*** | ||
12 | * 添加试题 以及试题选项 | 25 | * 添加试题 以及试题选项 |
13 | * @param question | 26 | * @param question |
14 | * @return | 27 | * @return | ... | ... |
1 | package com.skua.modules.edu.service.impl; | 1 | package com.skua.modules.edu.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
4 | import com.skua.modules.edu.entity.Question; | 6 | import com.skua.modules.edu.entity.Question; |
5 | import com.skua.modules.edu.entity.QuestionDB; | 7 | import com.skua.modules.edu.entity.QuestionDB; |
6 | import com.skua.modules.edu.mapper.QuestionDBMapper; | 8 | import com.skua.modules.edu.mapper.QuestionDBMapper; |
... | @@ -11,6 +13,7 @@ import org.springframework.stereotype.Service; | ... | @@ -11,6 +13,7 @@ import org.springframework.stereotype.Service; |
11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
12 | 14 | ||
13 | import javax.annotation.Resource; | 15 | import javax.annotation.Resource; |
16 | import java.util.List; | ||
14 | 17 | ||
15 | /** | 18 | /** |
16 | * 在线考试-题库 | 19 | * 在线考试-题库 |
... | @@ -34,4 +37,19 @@ public class QuestionDBServiceImpl extends ServiceImpl<QuestionDBMapper, Questio | ... | @@ -34,4 +37,19 @@ public class QuestionDBServiceImpl extends ServiceImpl<QuestionDBMapper, Questio |
34 | } | 37 | } |
35 | return false; | 38 | return false; |
36 | } | 39 | } |
40 | |||
41 | public IPage<QuestionDB> queryPageList(Page<QuestionDB> page, QuestionDB questionDB) { | ||
42 | List<QuestionDB> questionList = this.baseMapper.selectQuestionDbList(questionDB); | ||
43 | page.setRecords(questionList); | ||
44 | return page; | ||
45 | } | ||
46 | /*** | ||
47 | * | ||
48 | * @param questionDB | ||
49 | * @return | ||
50 | */ | ||
51 | public List<QuestionDB> selectQuestionDbList(QuestionDB questionDB){ | ||
52 | List<QuestionDB> questionList = this.baseMapper.selectQuestionDbList(questionDB); | ||
53 | return questionList; | ||
54 | } | ||
37 | } | 55 | } | ... | ... |
1 | package com.skua.modules.edu.service.impl; | 1 | package com.skua.modules.edu.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
4 | import com.google.gson.Gson; | 6 | import com.google.gson.Gson; |
5 | import com.skua.modules.edu.entity.Question; | 7 | import com.skua.modules.edu.entity.Question; |
8 | import com.skua.modules.edu.entity.QuestionDB; | ||
6 | import com.skua.modules.edu.entity.QuestionOption; | 9 | import com.skua.modules.edu.entity.QuestionOption; |
7 | import com.skua.modules.edu.mapper.QuestionMapper; | 10 | import com.skua.modules.edu.mapper.QuestionMapper; |
8 | import com.skua.modules.edu.mapper.QuestionOptionMapper; | 11 | import com.skua.modules.edu.mapper.QuestionOptionMapper; |
... | @@ -21,6 +24,15 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i | ... | @@ -21,6 +24,15 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i |
21 | 24 | ||
22 | @Resource | 25 | @Resource |
23 | private QuestionOptionMapper optionMapper; | 26 | private QuestionOptionMapper optionMapper; |
27 | |||
28 | public IPage<Question> queryPageList(Page<Question> page, Question questionDB) { | ||
29 | return this.baseMapper.queryPageList(page,questionDB); | ||
30 | } | ||
31 | |||
32 | public List<Question> selectQuestionList( Question questionDB) { | ||
33 | return this.baseMapper.selectQuestionList(questionDB); | ||
34 | } | ||
35 | |||
24 | /*** | 36 | /*** |
25 | * 添加试题 以及试题选项 | 37 | * 添加试题 以及试题选项 |
26 | * @param question | 38 | * @param question | ... | ... |
... | @@ -12,6 +12,4 @@ import com.skua.modules.safe.entity.DangerLevelManageShare; | ... | @@ -12,6 +12,4 @@ import com.skua.modules.safe.entity.DangerLevelManageShare; |
12 | public interface IDangerLevelManageShareService extends IService<DangerLevelManageShare> { | 12 | public interface IDangerLevelManageShareService extends IService<DangerLevelManageShare> { |
13 | 13 | ||
14 | IPage<DangerLevelManageShare> queryPageList(Page<DangerLevelManageShare> page, DangerLevelManageShare dangerLevelManageShare) ; | 14 | IPage<DangerLevelManageShare> queryPageList(Page<DangerLevelManageShare> page, DangerLevelManageShare dangerLevelManageShare) ; |
15 | |||
16 | |||
17 | } | 15 | } | ... | ... |
... | @@ -166,6 +166,8 @@ public class MybatisInterceptor implements Interceptor { | ... | @@ -166,6 +166,8 @@ public class MybatisInterceptor implements Interceptor { |
166 | || "com.skua.modules.equipment.mapper.EquipmentSparepartMapper.queryByPage".equals(sqlId)//库存查询 | 166 | || "com.skua.modules.equipment.mapper.EquipmentSparepartMapper.queryByPage".equals(sqlId)//库存查询 |
167 | || "com.skua.modules.safe.mapper.DangerLevelManageShareMapper.selectDangerLevelManageShareList".equals(sqlId)//共享风险库 | 167 | || "com.skua.modules.safe.mapper.DangerLevelManageShareMapper.selectDangerLevelManageShareList".equals(sqlId)//共享风险库 |
168 | || "com.skua.modules.safe.mapper.DangerLevelManageShareMapper.selectPage".equals(sqlId) | 168 | || "com.skua.modules.safe.mapper.DangerLevelManageShareMapper.selectPage".equals(sqlId) |
169 | || "com.skua.modules.edu.mapper.QuestionMapper.selectQuestionList".equals(sqlId)//试题列表 | ||
170 | || "com.skua.modules.edu.mapper.QuestionMapper.queryPageList".equals(sqlId)//试题分页 | ||
169 | ) { | 171 | ) { |
170 | log.debug("************************------sqlId------**************************" + sqlId); | 172 | log.debug("************************------sqlId------**************************" + sqlId); |
171 | return invocation.proceed(); | 173 | return invocation.proceed(); | ... | ... |
-
请 注册 或 登录 后发表评论