src/main/java/com/mindskip/xzs/controller/admin/ExamPaperController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mindskip/xzs/domain/vo/UserVO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mindskip/xzs/repository/ExamPaperMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mindskip/xzs/service/ExamPaperService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/ExamPaperMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/ExamTemplatesMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/mindskip/xzs/controller/admin/ExamPaperController.java
@@ -6,6 +6,7 @@ import com.mindskip.xzs.domain.ExamPaper; import com.mindskip.xzs.domain.ExamPaperSubject; import com.mindskip.xzs.domain.vo.PaperExcelVO; import com.mindskip.xzs.domain.vo.UserVO; import com.mindskip.xzs.service.ExamPaperDepartmentService; import com.mindskip.xzs.service.ExamPaperService; import com.mindskip.xzs.service.ExamPaperSubjectService; @@ -24,7 +25,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -84,12 +84,12 @@ @RequestMapping(value = "/edit", method = RequestMethod.POST) public RestResponse<ExamPaperEditRequestVO> edit(@RequestBody @Valid ExamPaperEditRequestVM model) throws Exception { Object[] obj = Arrays.stream(model.getUserIds()).sorted().distinct().toArray(); Integer[] userIds = new Integer[obj.length]; for(int i = 0;i<obj.length;i++) { userIds[i] = (Integer)obj[i]; } model.setUserIds(userIds); // Object[] obj = Arrays.stream(model.getUserIds()).sorted().distinct().toArray(); // Integer[] userIds = new Integer[obj.length]; // for(int i = 0;i<obj.length;i++) { // userIds[i] = (Integer)obj[i]; // } // model.setUserIds(userIds); ExamPaper examPaper = examPaperService.savePaperFromVM(model, getCurrentUser()); ExamPaperEditRequestVO newVM = examPaperService.examPaperToVM(examPaper.getId()); @@ -135,4 +135,9 @@ List<Integer> deptIds = isDeptAdmin() ? getAdminDeptIds() : null; return RestResponse.ok(examPaperService.list(deptIds)); } @RequestMapping(value = "/selectStudent", method = RequestMethod.POST) public RestResponse<PageInfo<UserVO>> selectStudent(@RequestBody UserVO userVO) { return RestResponse.ok(examPaperService.selectStudent(userVO)); } } src/main/java/com/mindskip/xzs/domain/vo/UserVO.java
@@ -89,6 +89,46 @@ private String conditionDetail; private Integer tagId; private Integer deptId; private Integer pageIndex; private Integer pageSize; public Integer getPageIndex() { return pageIndex; } public void setPageIndex(Integer pageIndex) { this.pageIndex = pageIndex; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public Integer getTagId() { return tagId; } public void setTagId(Integer tagId) { this.tagId = tagId; } public Integer getDeptId() { return deptId; } public void setDeptId(Integer deptId) { this.deptId = deptId; } public String getConditionDetail() { return conditionDetail; } src/main/java/com/mindskip/xzs/repository/ExamPaperMapper.java
@@ -3,6 +3,7 @@ import com.mindskip.xzs.domain.ExamPaper; import com.mindskip.xzs.domain.other.KeyValue; import com.mindskip.xzs.domain.vo.PaperExcelVO; import com.mindskip.xzs.domain.vo.UserVO; import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM; import com.mindskip.xzs.viewmodel.student.dashboard.PaperFilter; import com.mindskip.xzs.viewmodel.student.dashboard.PaperInfo; @@ -39,4 +40,6 @@ List<PaperExcelVO> getPaperExcelById(@Param("id") Integer id); List<ExamPaper> list(List<Integer> deptIds); List<UserVO> selectStudent(UserVO userVO); } src/main/java/com/mindskip/xzs/service/ExamPaperService.java
@@ -4,6 +4,7 @@ import com.mindskip.xzs.domain.ExamPaper; import com.mindskip.xzs.domain.User; import com.mindskip.xzs.domain.vo.PaperExcelVO; import com.mindskip.xzs.domain.vo.UserVO; import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVO; import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM; @@ -40,4 +41,6 @@ void missExam(ExamPaperEditRequestVM model); List<ExamPaper> list(List<Integer> deptIds); PageInfo<UserVO> selectStudent(UserVO userVO); } src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java
@@ -10,6 +10,7 @@ import com.mindskip.xzs.domain.exam.ExamPaperTitleItemObject; import com.mindskip.xzs.domain.other.KeyValue; import com.mindskip.xzs.domain.vo.PaperExcelVO; import com.mindskip.xzs.domain.vo.UserVO; import com.mindskip.xzs.repository.ExamPaperAnswerMapper; import com.mindskip.xzs.repository.ExamPaperMapper; import com.mindskip.xzs.repository.QuestionMapper; @@ -628,4 +629,10 @@ public List<ExamPaper> list(List<Integer> deptIds) { return examPaperMapper.list(deptIds); } @Override public PageInfo<UserVO> selectStudent(UserVO userVO) { return PageHelper.startPage(userVO.getPageIndex(), userVO.getPageSize()).doSelectPageInfo(() -> examPaperMapper.selectStudent(userVO)); } } src/main/resources/mapper/ExamPaperMapper.xml
@@ -449,4 +449,23 @@ order by create_time desc </select> <select id="selectStudent" resultType="com.mindskip.xzs.domain.vo.UserVO" parameterType="com.mindskip.xzs.domain.vo.UserVO"> SELECT a.id, a.real_name FROM t_user a left join t_user_tag b on a.id = b.user_id left join t_user_department c on a.id = c.user_id where user_name != 'admin' <if test="tagId != null and tagId != ''"> and b.tag_id = #{tagId} </if> <if test="deptId != null and deptId != ''"> and c.department_id = #{deptId} </if> group by a.id, a.real_name order by a.id </select> </mapper> src/main/resources/mapper/ExamTemplatesMapper.xml
@@ -16,7 +16,7 @@ <sql id="Base_Column_List"> id , name, paper_type, suggest_time, title_name, ctime, status, menu_ids,start_time,end_time , name, paper_type, suggest_time, title_name, ctime, status, menu_ids,start_time,end_time, dept_id </sql> <insert id="add" parameterType="com.mindskip.xzs.domain.ExamTemplates" useGeneratedKeys="true" keyProperty="id">