Merge remote-tracking branch 'origin/master'
| | |
| | | return RestResponse.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/list", method = RequestMethod.GET) |
| | | public RestResponse<PageInfo<ExamTemplatesVO>> list(ExamTemplatesVO examTemplatesVO) throws Exception { |
| | | @RequestMapping(value = "/list", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamTemplatesVO>> list(@RequestBody ExamTemplatesVO examTemplatesVO) throws Exception { |
| | | // 如果是部门管理员,需要做数据权限 |
| | | examTemplatesVO.setDeptId(ObjectUtils.isNotEmpty(examTemplatesVO.getDeptId()) ? examTemplatesVO.getDeptId() : getAdminDeptIds()); |
| | | PageInfo<ExamTemplates> pageInfo = examTemplatesService.getByadmins(examTemplatesVO); |
| | |
| | | import com.mindskip.xzs.domain.Tag; |
| | | import com.mindskip.xzs.domain.vo.TagVO; |
| | | import com.mindskip.xzs.service.TagService; |
| | | import lombok.Data; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping(value = "/api/admin/tag") |
| | | @Data |
| | | @RequiredArgsConstructor |
| | | public class TagController extends BaseApiController { |
| | | |
| | | private final TagService tagService; |
| | |
| | | } |
| | | userDepartmentMapper.insert(userDepartment); |
| | | } |
| | | tagService.removeUserTagByUserId(user.getId()); |
| | | if (ObjectUtils.isNotEmpty(model.getTagIds())) { |
| | | tagService.removeUserTagByUserId(user.getId()); |
| | | tagService.saveBatchUserTag(model.getTagIds().stream().map( |
| | | tagId -> new UserTag() {{ |
| | | setUserId(user.getId()); |
| | |
| | | return RestResponse.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getFailExamUser/{examPaperId}") |
| | | public RestResponse<List<User>> getFailExamUser(@PathVariable Integer examPaperId) { |
| | | return RestResponse.ok(userService.getFailExamUser(examPaperId)); |
| | | } |
| | | |
| | | @GetMapping("/getFailTemplateUser/{templateId}") |
| | | public RestResponse<List<User>> getFailTemplateUser(@PathVariable Integer templateId) { |
| | | return RestResponse.ok(userService.getFailTemplateUser(templateId)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mindskip.xzs.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mindskip.xzs.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | private String name; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date ctime; |
| | | |
| | | private LocalDateTime now; |
| | |
| | | |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * 时间周期 |
| | | */ |
| | | private List<LocalDateTime> period; |
| | | |
| | | } |
| | |
| | | User getUserByExamByTemplateId(ExamPaper examPaper); |
| | | |
| | | List<Integer> getDeptIds(@Param("userId") Integer userId); |
| | | |
| | | List<User> getFailExamUser(Integer examPaperId); |
| | | |
| | | List<User> getFailTemplateUser(Integer templateId); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<Integer> getDeptIds(Integer id); |
| | | |
| | | /** |
| | | * 获取需要补考的用户 |
| | | * @param examPaperId 试卷id |
| | | * @return 用户下拉 |
| | | */ |
| | | List<User> getFailExamUser(Integer examPaperId); |
| | | |
| | | /** |
| | | * 获取需要补考的用户 |
| | | * @param templateId 随机试卷id |
| | | * @return 用户下拉 |
| | | */ |
| | | List<User> getFailTemplateUser(Integer templateId); |
| | | } |
| | |
| | | public List<Integer> getDeptIds(Integer userId) { |
| | | return userMapper.getDeptIds(userId); |
| | | } |
| | | |
| | | @Override |
| | | public List<User> getFailExamUser(Integer examPaperId) { |
| | | return userMapper.getFailExamUser(examPaperId); |
| | | } |
| | | |
| | | @Override |
| | | public List<User> getFailTemplateUser(Integer templateId) { |
| | | return userMapper.getFailTemplateUser(templateId); |
| | | } |
| | | } |
| | |
| | | <if test="excludeTagIds != null and excludeTagIds.size > 0"> |
| | | <if test="tagIds != null and tagIds.size > 0">and</if> |
| | | <foreach collection="excludeTagIds" open="(" separator="and" close=")" item="item"> |
| | | NOT find_in_set(#{item}, group_concat(b.tag_id) OR group_concat(b.tag_id) IS NULL) |
| | | (NOT find_in_set(#{item}, group_concat(b.tag_id)) OR group_concat(b.tag_id) IS NULL) |
| | | </foreach> |
| | | </if> |
| | | order by a.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.create_user |
| | | from t_exam_templates e |
| | | left join t_exam_templates_user u on e.id = u.templates_id |
| | | LEFT JOIN t_exam_templates_subject ts ON e.id = ts.templates_id |
| | | LEFT JOIN t_subject s ON ts.subject_id = s.id |
| | | <where> |
| | | <if test="status != null"> |
| | | and e.status = 0 |
| | |
| | | <if test="deptId != null and deptId.size() > 0"> |
| | | and e.dept_id in <foreach collection="deptId" item="item" separator="," open="(" close=")"> #{item} </foreach> |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and INSTR(e.name, #{name}) |
| | | </if> |
| | | <if test="subjectId != null and subjectId.length > 0"> |
| | | and s.id in <foreach collection="subjectId" item="item" separator="," open="(" close=")"> #{item} </foreach> |
| | | </if> |
| | | <if test="period != null and period.size() > 0"> |
| | | and e.ctime between #{period[0]} and #{period[1]} |
| | | </if> |
| | | <if test="now !=null"> |
| | | and #{now} between e.start_time and e.end_time |
| | | </if> |
| | | </where> |
| | | GROUP BY e.id |
| | | </select> |
| | | |
| | | <select id="getById" resultMap="BaseResultMap"> |
| | |
| | | |
| | | <select id="getDeptAdmins" resultType="com.mindskip.xzs.domain.Department" parameterType="java.lang.Integer"> |
| | | <if test="id != null"> |
| | | select a.id, a.name, a.parent_id from t_department a inner join t_user_department b on a.id = b.department_id where a.deleted = 0 and b.dept_admin = 1 and b.user_id = #{id} order by a.id |
| | | WITH RECURSIVE temp_table AS ( |
| | | select a.id, a.name, a.parent_id from t_department a inner join t_user_department b on a.id = b.department_id where a.deleted = 0 and b.dept_admin = 1 and b.user_id = #{id} |
| | | UNION ALL |
| | | SELECT |
| | | so.id, so.name, so.parent_id FROM t_department so INNER JOIN temp_table tb ON so.parent_id = tb.id |
| | | ) |
| | | SELECT |
| | | id, name, parent_id |
| | | FROM |
| | | temp_table |
| | | </if> |
| | | <if test="id == null"> |
| | | select a.id, a.name, a.parent_id from t_department a where a.deleted = 0 order by a.id |
| | |
| | | SELECT department_id FROM t_user_department WHERE user_id = #{userId} AND dept_admin != 1 |
| | | </select> |
| | | |
| | | <select id="getFailExamUser" resultType="com.mindskip.xzs.domain.User"> |
| | | <![CDATA[ |
| | | SELECT |
| | | DISTINCT d.id, d.real_name |
| | | FROM t_exam_paper a |
| | | LEFT JOIN t_exam_paper_user b ON a.id = b.exam_paper_id AND b.deleted = 0 |
| | | LEFT JOIN t_exam_paper_answer c ON a.id = c.exam_paper_id AND c.create_user = b.user_id |
| | | LEFT JOIN t_user d ON b.user_id = d.id |
| | | WHERE a.id = #{examPaperId} |
| | | AND (c.id IS NULL OR (user_score / paper_score) < 0.6) |
| | | ]]> |
| | | </select> |
| | | |
| | | <select id="getFailTemplateUser" resultType="com.mindskip.xzs.domain.User"> |
| | | SELECT * |
| | | FROM t_user |
| | | WHERE id IN |
| | | (SELECT user_id FROM t_exam_templates_user WHERE templates_id = #{id} AND user_id NOT IN |
| | | (SELECT create_user FROM t_exam_paper_answer WHERE (user_score / paper_score) > 0.6 AND (invalid = 0 OR invalid IS NULL) AND exam_paper_id IN |
| | | (SELECT exam_paper_id FROM t_exam_templates_user_count WHERE exam_templates_id = #{templateId}))) |
| | | </select> |
| | | |
| | | </mapper> |