Merge remote-tracking branch 'origin/master'
| | |
| | | import com.mindskip.xzs.utility.excel.ExcelUtils; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.*; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | vm.setSubjectId(examPaperSubjectService.getByExamPaperId(vm.getId()) |
| | | .stream().map(ExamPaperSubject::getSubjectId).toArray(Integer[]::new)); |
| | | vm.setCreateDepartment(examPaperDepartmentService.selectByUserId(vm.getCreateUser())); |
| | | return vm; |
| | | }); |
| | | return RestResponse.ok(page); |
| | |
| | | import com.mindskip.xzs.domain.ExamTemplates; |
| | | import com.mindskip.xzs.domain.ExamTemplatesSubject; |
| | | import com.mindskip.xzs.domain.vo.ExamTemplatesVO; |
| | | import com.mindskip.xzs.repository.DepartmentMapper; |
| | | import com.mindskip.xzs.repository.ExamTemplatesSubjectMapper; |
| | | import com.mindskip.xzs.service.ExamPaperDepartmentService; |
| | | import com.mindskip.xzs.service.ExamTemplatesService; |
| | | import com.mindskip.xzs.utility.PageInfoHelper; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | |
| | | private final ExamTemplatesService examTemplatesService; |
| | | private final ExamTemplatesSubjectMapper examTemplatesSubjectMapper; |
| | | private final WebContext webContext; |
| | | private final DepartmentMapper departmentMapper; |
| | | private final ExamPaperDepartmentService examPaperDepartmentService; |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse edit(@RequestBody @Valid ExamPaperEditRequestVM model) { |
| | | model.setCreateUser(getCurrentUser().getId()); |
| | | examTemplatesService.add(model); |
| | | return RestResponse.ok(); |
| | | } |
| | |
| | | String subjectNames = subjectList.stream().map(ExamTemplatesSubject::getSubjectName).collect(Collectors.joining("、")); |
| | | vo.setSubjectNames(subjectNames); |
| | | vo.setSubjectId(ids); |
| | | vo.setCreateDepartment(examPaperDepartmentService.selectByUserId(e.getCreateUser())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(info); |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private Date startTime; |
| | | private Date endTime; |
| | | private Integer deptId; |
| | | private Integer createUser; |
| | | |
| | | } |
| | |
| | | |
| | | private List<Integer> paperIds; |
| | | |
| | | private String createDepartment; |
| | | |
| | | private Integer createUser; |
| | | |
| | | } |
| | |
| | | Integer removeByExamPaperId(Integer id); |
| | | |
| | | Integer removeByExamPaperIds(@Param("ids") Integer[] ids); |
| | | |
| | | /** |
| | | * 根据用户id获取部门名称 |
| | | * @param userId 用户 |
| | | * @return 所在部门 |
| | | */ |
| | | String selectByUserId(Integer userId); |
| | | } |
| | |
| | | Integer removeByExamPaperId(Integer id); |
| | | |
| | | Integer removeByExamPaperIds(Integer[] ids); |
| | | |
| | | /** |
| | | * 根据用户id获取部门名称 |
| | | * @param userId 用户 |
| | | * @return 所在部门 |
| | | */ |
| | | String selectByUserId(Integer userId); |
| | | } |
| | |
| | | public Integer removeByExamPaperIds(Integer[] ids) { |
| | | return examPaperDepartmentMapper.removeByExamPaperIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public String selectByUserId(Integer userId) { |
| | | return examPaperDepartmentMapper.selectByUserId(userId); |
| | | } |
| | | } |
| | |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperTitleItemVM; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.QuestionTypeVM; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | examTemplates.setTitleName(model.getTitleItems().get(0).getName()); |
| | | examTemplates.setStatus(model.getStatus()); |
| | | examTemplates.setMenuIds(model.getMenuIds()); |
| | | examTemplates.setCreateUser(model.getCreateUser()); |
| | | examTemplatesMapper.add(examTemplates); |
| | | |
| | | List<ExamTemplatesQuestion> examTemplatesQuestions = ExamTemplatesClassConvert.INSTANCE.QuestionTypeVMListToExamTemplatesQuestionList(model.getQuestionTypeVMS()) |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private String status; |
| | | private String menuIds; |
| | | private Integer examPaperId; |
| | | private Integer createUser; |
| | | |
| | | } |
| | |
| | | package com.mindskip.xzs.viewmodel.admin.exam; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class ExamResponseVM { |
| | | private Integer id; |
| | | |
| | |
| | | |
| | | private Integer createUser; |
| | | |
| | | private String createDepartment; |
| | | |
| | | private Integer[] subjectId; |
| | | |
| | | private Integer paperType; |
| | | |
| | | private Integer frameTextContentId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getQuestionCount() { |
| | | return questionCount; |
| | | } |
| | | |
| | | public void setQuestionCount(Integer questionCount) { |
| | | this.questionCount = questionCount; |
| | | } |
| | | |
| | | public Integer getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Integer score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Integer[] getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(Integer[] subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | public Integer getPaperType() { |
| | | return paperType; |
| | | } |
| | | |
| | | public void setPaperType(Integer paperType) { |
| | | this.paperType = paperType; |
| | | } |
| | | |
| | | public Integer getFrameTextContentId() { |
| | | return frameTextContentId; |
| | | } |
| | | |
| | | public void setFrameTextContentId(Integer frameTextContentId) { |
| | | this.frameTextContentId = frameTextContentId; |
| | | } |
| | | } |
| | |
| | | where exam_paper_id = #{id} and deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectByUserId" resultType="java.lang.String"> |
| | | SELECT b.name FROM t_user_department a INNER JOIN t_department b ON a.department_id = b.id WHERE a.user_id = #{userId} |
| | | </select> |
| | | |
| | | <delete id="removeByExamPaperId" parameterType="java.lang.Integer"> |
| | | delete from t_exam_paper_department |
| | | where exam_paper_id = #{id} |
| | |
| | | </sql> |
| | | |
| | | <insert id="add" parameterType="com.mindskip.xzs.domain.ExamTemplates" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_exam_templates (name, paper_type, dept_id, suggest_time, title_name, ctime, status, menu_ids,start_time,end_time) |
| | | values (#{name}, #{paperType}, #{deptId}, #{suggestTime}, #{titleName}, #{ctime}, #{status}, #{menuIds},#{startTime},#{endTime}) |
| | | insert into t_exam_templates (name, paper_type, dept_id, suggest_time, title_name, ctime, status, menu_ids,start_time,end_time,create_user) |
| | | values (#{name}, #{paperType}, #{deptId}, #{suggestTime}, #{titleName}, #{ctime}, #{status}, #{menuIds},#{startTime},#{endTime}, #{createUser}) |
| | | </insert> |
| | | |
| | | <select id="getTime" resultMap="BaseResultMap"> |
| | |
| | | <select id="getByadmins" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.domain.vo.ExamTemplatesVO"> |
| | | select |
| | | DISTINCT e.id |
| | | , e.name, e.paper_type, e.suggest_time, e.title_name, e.ctime, e.status, e.menu_ids,e.start_time,e.end_time |
| | | , e.name, e.paper_type, e.suggest_time, e.title_name, e.ctime, e.status, e.menu_ids,e.start_time,e.end_time, e.create_user |
| | | from t_exam_templates e |
| | | left join t_exam_templates_user u on e.id = u.templates_id |
| | | <where> |