|
@@ -0,0 +1,69 @@
|
|
|
|
+package cn.com.qmth.stmms.ms.log.controller;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.MarkLog;
|
|
|
|
+import cn.com.qmth.stmms.ms.core.repository.MarkLogRepo;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+
|
|
|
|
+@Api(tags = "纪检审计接口controller")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("api/marklog")
|
|
|
|
+public class MarkLogController {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ MarkLogRepo markLogRepo;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "纪检审计查询接口")
|
|
|
|
+ @GetMapping("/selectMarkLog")
|
|
|
|
+ public Page<MarkLog> selectMarkLog(@ApiParam(value = "科目", required = false) @RequestParam(required = false) String subject,
|
|
|
|
+ @ApiParam(value = "准考证号", required = false) @RequestParam(required = false) Long examNumber,
|
|
|
|
+ @ApiParam(value = "学生姓名", required = false) @RequestParam(required = false) String studentName,
|
|
|
|
+ @ApiParam(value = "操作类型(1:分档,2:打分,3:回评档位,4:回评分数,5:档位打回,6:档位打回回评,7:一键定档,8:标准卷设置)", required = false) @RequestParam(required = false) Integer operType,
|
|
|
|
+ @ApiParam(value = "开始时间", required = false) @RequestParam(required = false) String startTime,
|
|
|
|
+ @ApiParam(value = "结束时间", required = false) @RequestParam(required = false) String endTime,
|
|
|
|
+ @RequestParam Integer curPage,
|
|
|
|
+ @RequestParam Integer pageSize) {
|
|
|
|
+ Pageable pageable = new PageRequest(curPage, pageSize, Sort.Direction.DESC, "createTime");
|
|
|
|
+ Specification<MarkLog> specification = (root, query, cb) -> {
|
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
|
+ predicates.add(cb.equal(root.get("subject"), subject));
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(examNumber)) {
|
|
|
|
+ predicates.add(cb.equal(root.get("examNumber"), examNumber));
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(studentName)) {
|
|
|
|
+ predicates.add(cb.like(root.get("studentName").as(String.class), "%" + studentName + "%"));
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(operType)) {
|
|
|
|
+ predicates.add(cb.equal(root.get("operType"), operType));
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(startTime)) {
|
|
|
|
+ //大于或等于传入时间
|
|
|
|
+ predicates.add(cb.greaterThanOrEqualTo(root.get("createTime").as(String.class), startTime));
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
|
+ //小于或等于传入时间
|
|
|
|
+ predicates.add(cb.lessThanOrEqualTo(root.get("createTime").as(String.class), endTime));
|
|
|
|
+ }
|
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
|
+ };
|
|
|
|
+ return markLogRepo.findAll(specification, pageable);
|
|
|
|
+ }
|
|
|
|
+}
|