Explorar el Código

查询条件list

xiaof hace 3 años
padre
commit
0a481b2036

+ 114 - 0
src/main/java/cn/com/qmth/print/manage/controller/ConditionController.java

@@ -0,0 +1,114 @@
+package cn.com.qmth.print.manage.controller;
+
+import cn.com.qmth.print.manage.entity.ExamStudentEntity;
+import cn.com.qmth.print.manage.enums.GroupType;
+import cn.com.qmth.print.manage.enums.RecordStatus;
+import cn.com.qmth.print.manage.enums.dto.EnumDto;
+import cn.com.qmth.print.manage.service.ExamStudentService;
+import cn.com.qmth.print.manage.utils.result.ResultUtil;
+import com.qmth.boot.api.constant.ApiConstant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Date: 2021/11/16.
+ */
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/condition")
+public class ConditionController {
+
+    @Autowired
+    private ExamStudentService examStudentService;
+
+    /**
+     * 分组字段列表
+     *
+     * @return
+     */
+    @RequestMapping(value = "/list_group_type", method = RequestMethod.POST)
+    public Object listGroupType() {
+        return GroupType.listGroupType();
+    }
+
+    /**
+     * 状态列表
+     *
+     * @return
+     */
+    @RequestMapping(value = "/list_record_status", method = RequestMethod.POST)
+    public Object listRecordStatus() {
+        return RecordStatus.listRecordStatus();
+    }
+
+    /**
+     * 准考证列表
+     *
+     * @param examId 批次ID
+     * @return
+     */
+    @RequestMapping(value = "/list_exam_number", method = RequestMethod.POST)
+    public Object listExamNumber(@RequestParam Long examId) {
+        List<ExamStudentEntity> studentEntityList = examStudentService.listByExamId(examId);
+        List<String> examNumberList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(studentEntityList)) {
+            examNumberList = studentEntityList.stream().map(m -> m.getExamNumber()).distinct().collect(Collectors.toList());
+        }
+        return examNumberList;
+    }
+
+    /**
+     * 科目列表
+     *
+     * @param examId 批次ID
+     * @return
+     */
+    @RequestMapping(value = "/list_course_code", method = RequestMethod.POST)
+    public Object listCourseCode(@RequestParam Long examId) {
+        List<ExamStudentEntity> studentEntityList = examStudentService.listByExamId(examId);
+        List<String> courseCodeList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(studentEntityList)) {
+            courseCodeList = studentEntityList.stream().map(m -> m.getCourseCode()).distinct().collect(Collectors.toList());
+        }
+        return courseCodeList;
+    }
+
+    /**
+     * 考点列表
+     *
+     * @param examId 批次ID
+     * @return
+     */
+    @RequestMapping(value = "/list_exam_site", method = RequestMethod.POST)
+    public Object listExamSite(@RequestParam Long examId) {
+        List<ExamStudentEntity> studentEntityList = examStudentService.listByExamId(examId);
+        List<String> examSiteList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(studentEntityList)) {
+            examSiteList = studentEntityList.stream().map(m -> m.getExamSite()).distinct().collect(Collectors.toList());
+        }
+        return examSiteList;
+    }
+
+    /**
+     * 考场列表
+     *
+     * @param examId 批次ID
+     * @return
+     */
+    @RequestMapping(value = "/list_exam_room", method = RequestMethod.POST)
+    public Object listExamRoom(@RequestParam Long examId) {
+        List<ExamStudentEntity> studentEntityList = examStudentService.listByExamId(examId);
+        List<String> examRoomList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(studentEntityList)) {
+            examRoomList = studentEntityList.stream().map(m -> m.getExamRoom()).distinct().collect(Collectors.toList());
+        }
+        return examRoomList;
+    }
+}

+ 77 - 0
src/main/java/cn/com/qmth/print/manage/controller/ExamController.java

@@ -0,0 +1,77 @@
+package cn.com.qmth.print.manage.controller;
+
+import cn.com.qmth.print.manage.entity.UserEntity;
+import cn.com.qmth.print.manage.service.ExamService;
+import cn.com.qmth.print.manage.service.query.UserQuery;
+import com.qmth.boot.api.constant.ApiConstant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Date: 2021/11/16.
+ */
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/exam")
+public class ExamController {
+
+    @Autowired
+    private ExamService examService;
+
+    /**
+     * 批次分页查询
+     *
+     * @param query
+     * @return
+     */
+    @RequestMapping(value = "/page", method = RequestMethod.POST)
+    public Object page(@Validated UserQuery query) {
+        return null;
+    }
+
+    /**
+     * 批次查询
+     *
+     * @return
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    public Object list() {
+        return null;
+    }
+
+
+    /**
+     * 新增/修改批次
+     *
+     * @param user
+     * @return
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public Object save(UserEntity user) {
+
+        return null;
+    }
+
+    /**
+     * 导入考生数据
+     *
+     * @return
+     */
+    @RequestMapping(value = "/import", method = RequestMethod.POST)
+    public Object importFile() {
+        return null;
+    }
+
+    /**
+     * 分页考生详情
+     *
+     * @return
+     */
+    @RequestMapping(value = "/student_detail", method = RequestMethod.POST)
+    public Object studentDetail() {
+        return null;
+    }
+
+}

+ 2 - 3
src/main/java/cn/com/qmth/print/manage/controller/OrgController.java

@@ -3,18 +3,17 @@ package cn.com.qmth.print.manage.controller;
 import cn.com.qmth.print.manage.service.OrgService;
 import cn.com.qmth.print.manage.service.query.OrgQuery;
 import com.qmth.boot.api.constant.ApiConstant;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.annotation.Resource;
-
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/org")
 public class OrgController {
 
-    @Resource
+    @Autowired
     private OrgService orgService;
 
     /**

+ 27 - 0
src/main/java/cn/com/qmth/print/manage/controller/SysController.java

@@ -0,0 +1,27 @@
+package cn.com.qmth.print.manage.controller;
+
+import com.qmth.boot.api.constant.ApiConstant;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Date: 2021/11/17.
+ */
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX)
+public class SysController {
+
+    /**
+     * 登录
+     *
+     * @param loginName
+     * @param password
+     * @return
+     */
+    @RequestMapping(value = "/login", method = RequestMethod.POST)
+    public Object login(@RequestParam String loginName, @RequestParam String password) {
+        return null;
+    }
+}

+ 5 - 5
src/main/java/cn/com/qmth/print/manage/controller/UserController.java

@@ -4,13 +4,13 @@ import cn.com.qmth.print.manage.entity.UserEntity;
 import cn.com.qmth.print.manage.service.UserService;
 import cn.com.qmth.print.manage.service.query.UserQuery;
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.boot.core.exception.StatusException;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.annotation.Resource;
-
 /**
  * @Date: 2021/11/16.
  */
@@ -18,7 +18,7 @@ import javax.annotation.Resource;
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/user")
 public class UserController {
 
-    @Resource
+    @Autowired
     private UserService userService;
 
     /**
@@ -54,10 +54,10 @@ public class UserController {
         if (user.getId() != null) {
             UserEntity userEntity = userService.getById(user.getId());
             if (userEntity == null) {
-                throw new RuntimeException("用户不存在");
+                throw new StatusException("用户不存在");
             }
             if (!user.getLoginName().equals(userEntity.getLoginName())) {
-                throw new RuntimeException("用户名不能修改");
+                throw new StatusException("用户名不能修改");
             }
         }
         return userService.saveOrUpdate(user);

+ 21 - 0
src/main/java/cn/com/qmth/print/manage/enums/GroupType.java

@@ -1,5 +1,10 @@
 package cn.com.qmth.print.manage.enums;
 
+import cn.com.qmth.print.manage.enums.dto.EnumDto;
+
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 
  * @Description: 分组类型
@@ -48,4 +53,20 @@ public enum GroupType {
         return null;
     }
 
+    /**
+     * @return
+     */
+    public static List<EnumDto> listGroupType() {
+        List<EnumDto> list = new ArrayList<>();
+        for (GroupType value : GroupType.values()) {
+            EnumDto dto = new EnumDto();
+            dto.setId(value.getId());
+            dto.setCode(value.name());
+            dto.setName(value.getName());
+            dto.setOrdinal(value.ordinal());
+            list.add(dto);
+        }
+        return list;
+    }
+
 }

+ 21 - 0
src/main/java/cn/com/qmth/print/manage/enums/RecordStatus.java

@@ -1,5 +1,10 @@
 package cn.com.qmth.print.manage.enums;
 
+import cn.com.qmth.print.manage.enums.dto.EnumDto;
+
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 
  * @Description: 校验状态
@@ -48,4 +53,20 @@ public enum RecordStatus {
         return null;
     }
 
+    /**
+     * @return
+     */
+    public static List<EnumDto> listRecordStatus() {
+        List<EnumDto> list = new ArrayList<>();
+        for (RecordStatus value : RecordStatus.values()) {
+            EnumDto dto = new EnumDto();
+            dto.setId(value.getId());
+            dto.setCode(value.name());
+            dto.setName(value.getName());
+            dto.setOrdinal(value.ordinal());
+            list.add(dto);
+        }
+        return list;
+    }
+
 }

+ 57 - 0
src/main/java/cn/com/qmth/print/manage/enums/dto/EnumDto.java

@@ -0,0 +1,57 @@
+package cn.com.qmth.print.manage.enums.dto;
+
+/**
+ * @Date: 2021/3/23.
+ */
+public class EnumDto {
+
+    private Long id;
+
+    /**
+     * enum getName()
+     */
+    private String name;
+
+    /**
+     * enum ordinal
+     */
+    private Integer ordinal;
+
+    /**
+     * enum name()
+     */
+    private String code;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getOrdinal() {
+        return ordinal;
+    }
+
+    public void setOrdinal(Integer ordinal) {
+        this.ordinal = ordinal;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+}

+ 3 - 0
src/main/java/cn/com/qmth/print/manage/service/ExamStudentService.java

@@ -5,10 +5,13 @@ import cn.com.qmth.print.manage.enums.GroupType;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 public interface ExamStudentService extends IService<ExamStudentEntity> {
 
     ExamStudentEntity findByExamIdAndExamNumber(Long examId, String startNumber);
 
     Long findSortNoByExamIdAndGroupTypeAndSort(Long examId, GroupType type, String groupName, boolean isAse);
 
+    List<ExamStudentEntity> listByExamId(Long examId);
 }

+ 9 - 0
src/main/java/cn/com/qmth/print/manage/service/impl/ExamStudentServiceImpl.java

@@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.core.exception.StatusException;
 
+import java.util.List;
+
 @Service
 public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStudentEntity> implements
         ExamStudentService {
@@ -54,4 +56,11 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
         ExamStudentEntity entity = this.getOne(wrapper);
         return entity.getSortNo();
     }
+
+    @Override
+    public List<ExamStudentEntity> listByExamId(Long examId) {
+        QueryWrapper<ExamStudentEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamStudentEntity::getExamId, examId);
+        return this.list(queryWrapper);
+    }
 }

+ 5 - 8
src/main/java/cn/com/qmth/print/manage/service/impl/OrgServiceImpl.java

@@ -24,9 +24,6 @@ import java.util.stream.Collectors;
 @Service
 public class OrgServiceImpl extends ServiceImpl<OrgDao, OrgEntity> implements OrgService {
 
-    @Resource
-    private OrgDao orgDao;
-
     @Autowired
     private SolarUtils solarUtils;
 
@@ -41,21 +38,21 @@ public class OrgServiceImpl extends ServiceImpl<OrgDao, OrgEntity> implements Or
         }
         queryWrapper.lambda().orderByAsc(OrgEntity::getId);
         Page<OrgEntity> page = new Page<>(query.getPageNumber(), query.getPageSize());
-        return orgDao.selectPage(page, queryWrapper);
+        return this.page(page, queryWrapper);
     }
 
     @Override
     public List<OrgEntity> listByEnable() {
         QueryWrapper<OrgEntity> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(OrgEntity::getEnable, true).orderByAsc(OrgEntity::getId);
-        return orgDao.selectList(queryWrapper);
+        return this.list(queryWrapper);
     }
 
     @Transactional
     @Override
     public void pull() {
         List<Map> mapList = solarUtils.pullSchool();
-        List<OrgEntity> orgEntities = orgDao.selectList(null);
+        List<OrgEntity> orgEntities = this.list();
         List<OrgEntity> notExist;
         if (CollectionUtils.isEmpty(mapList)) {
             notExist = orgEntities;
@@ -80,7 +77,7 @@ public class OrgServiceImpl extends ServiceImpl<OrgDao, OrgEntity> implements Or
                 if (entity == null) {
                     entity = new OrgEntity();
                     // 中心的学校ID被占用,则使用自增ID
-                    OrgEntity orgById = orgDao.selectById(orgId);
+                    OrgEntity orgById = this.getById(orgId);
                     if (orgById == null) {
                         entity.setId(orgId);
                     }
@@ -98,7 +95,7 @@ public class OrgServiceImpl extends ServiceImpl<OrgDao, OrgEntity> implements Or
         if (!CollectionUtils.isEmpty(notExist)) {
             for (OrgEntity orgEntity : notExist) {
                 orgEntity.setEnable(false);
-                orgDao.updateById(orgEntity);
+                this.updateById(orgEntity);
             }
         }
     }

+ 2 - 6
src/main/java/cn/com/qmth/print/manage/service/impl/UserServiceImpl.java

@@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -20,9 +19,6 @@ import java.util.List;
 @Service
 public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
 
-    @Resource
-    private UserDao userDao;
-
     @Override
     public IPage<UserEntity> pageQuery(UserQuery query) {
         QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
@@ -34,13 +30,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
         }
         queryWrapper.lambda().eq(UserEntity::isEnable, query.isEnable()).orderByAsc(UserEntity::getId);
         Page<UserEntity> page = new Page<>(query.getPageNumber(), query.getPageSize());
-        return userDao.selectPage(page, queryWrapper);
+        return this.page(page, queryWrapper);
     }
 
     @Override
     public List<UserEntity> listByEnable() {
         QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(UserEntity::isEnable, true);
-        return userDao.selectList(queryWrapper);
+        return this.list(queryWrapper);
     }
 }