Your Name 4 年之前
父節點
當前提交
510ec0264a

+ 7
- 6
src/main/java/com/yunzhi/demo/controller/TaTestLogController.java 查看文件

@@ -7,6 +7,7 @@ import com.yunzhi.demo.common.BaseController;
7 7
 import com.yunzhi.demo.common.Constants;
8 8
 import com.yunzhi.demo.common.ResponseBean;
9 9
 import com.yunzhi.demo.entity.TaPerson;
10
+import com.yunzhi.demo.vo.StudentTestLog;
10 11
 import io.swagger.annotations.Api;
11 12
 import io.swagger.annotations.ApiOperation;
12 13
 import io.swagger.annotations.ApiParam;
@@ -73,14 +74,14 @@ public class TaTestLogController extends BaseController {
73 74
     @RequestMapping(value="/admin/testLog",method= RequestMethod.GET)
74 75
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
75 76
     public ResponseBean testLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
76
-                                      @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
77
+                                    @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
78
+                                    @ApiParam("学校") @RequestParam(value ="schoolId", required = false) String schoolId,
79
+                                    @ApiParam("专业") @RequestParam(value ="schoolId", required = false) String specialtyId,
80
+                                    @ApiParam("学号") @RequestParam(value ="studentNo", required = false) String studentNo) throws Exception{
77 81
 
78
-        IPage<TaTestLog> pg = new Page<>(pageNum, pageSize);
79
-        QueryWrapper<TaTestLog> queryWrapper = new QueryWrapper<>();
80
-        queryWrapper.gt("status", Constants.STATUS_DELETED);
81
-        queryWrapper.orderByDesc("create_date");
82
+        IPage<StudentTestLog> pg = new Page<>(pageNum, pageSize);
82 83
 
83
-        IPage<TaTestLog> result = iTaTestLogService.page(pg, queryWrapper);
84
+        IPage<StudentTestLog> result = iTaTestLogService.queryWithStudent(pg, schoolId, specialtyId, studentNo);
84 85
         return ResponseBean.success(result);
85 86
     }
86 87
 

+ 4
- 0
src/main/java/com/yunzhi/demo/mapper/TaTestLogMapper.java 查看文件

@@ -1,8 +1,11 @@
1 1
 package com.yunzhi.demo.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.demo.entity.TaTestLog;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.demo.vo.StudentTestLog;
5 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
6 9
 
7 10
 /**
8 11
  * <p>
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
15 18
 @Mapper
16 19
 public interface TaTestLogMapper extends BaseMapper<TaTestLog> {
17 20
 
21
+    IPage<StudentTestLog> getTestLogWithStudent(IPage<StudentTestLog> pg, @Param("schoolId") String schoolId, @Param("specialtyId") String specialtyId, @Param("studentNo") String studentNo);
18 22
 }

+ 3
- 0
src/main/java/com/yunzhi/demo/service/ITaTestLogService.java 查看文件

@@ -1,7 +1,9 @@
1 1
 package com.yunzhi.demo.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.demo.entity.TaTestLog;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.yunzhi.demo.vo.StudentTestLog;
5 7
 
6 8
 /**
7 9
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 15
  */
14 16
 public interface ITaTestLogService extends IService<TaTestLog> {
15 17
 
18
+    IPage<StudentTestLog> queryWithStudent(IPage<StudentTestLog> pg, String schoolId, String specialtyId, String studentNo);
16 19
 }

+ 10
- 0
src/main/java/com/yunzhi/demo/service/impl/TaTestLogServiceImpl.java 查看文件

@@ -1,9 +1,12 @@
1 1
 package com.yunzhi.demo.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.demo.entity.TaTestLog;
4 5
 import com.yunzhi.demo.mapper.TaTestLogMapper;
5 6
 import com.yunzhi.demo.service.ITaTestLogService;
6 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
+import com.yunzhi.demo.vo.StudentTestLog;
9
+import org.springframework.beans.factory.annotation.Autowired;
7 10
 import org.springframework.stereotype.Service;
8 11
 
9 12
 /**
@@ -17,4 +20,11 @@ import org.springframework.stereotype.Service;
17 20
 @Service
18 21
 public class TaTestLogServiceImpl extends ServiceImpl<TaTestLogMapper, TaTestLog> implements ITaTestLogService {
19 22
 
23
+    @Autowired
24
+    TaTestLogMapper taTestLogMapper;
25
+
26
+    @Override
27
+    public IPage<StudentTestLog> queryWithStudent(IPage<StudentTestLog> pg, String schoolId, String specialtyId, String studentNo) {
28
+        return taTestLogMapper.getTestLogWithStudent(pg, schoolId, specialtyId, studentNo);
29
+    }
20 30
 }

+ 22
- 0
src/main/java/com/yunzhi/demo/vo/StudentTestLog.java 查看文件

@@ -0,0 +1,22 @@
1
+package com.yunzhi.demo.vo;
2
+
3
+import com.yunzhi.demo.entity.TaStudent;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+
9
+@ApiModel(description = "学生体检信息")
10
+@Data
11
+public class StudentTestLog extends TaStudent {
12
+
13
+
14
+    @ApiModelProperty(value = "体检ID")
15
+    private Integer serialNo;
16
+
17
+    @ApiModelProperty(value = "体检名称")
18
+    private String testName;
19
+
20
+    @ApiModelProperty(value = "体检报告")
21
+    private String attchment;
22
+}

+ 27
- 0
src/main/resources/mapper/TaTestLogMapper.xml 查看文件

@@ -2,4 +2,31 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.demo.mapper.TaTestLogMapper">
4 4
 
5
+    <select id="getTestLogWithStudent" resultType="com.yunzhi.demo.vo.StudentTestLog">
6
+        SELECT
7
+            b.*,
8
+            a.`name` as test_name,
9
+            a.serial_no,
10
+            a.attchment,
11
+            c.`name` as school_name,
12
+            d.`name` as specialty_name
13
+        FROM
14
+            ta_test_log a
15
+            LEFT JOIN ta_student b on a.student_id = b.student_id
16
+            LEFT JOIN td_school c on b.school_id = c.school_id
17
+            LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id
18
+        WHERE
19
+            a.`status` > - 1
20
+        <if test="studentNo != null and studentNo != ''">
21
+            AND b.student_no LIKE CONCAT( '%', #{studentNo}, '%' )
22
+        </if>
23
+        <if test="schoolId != null and schoolId != ''">
24
+            AND b.school_id = #{schoolId}
25
+        </if>
26
+        <if test="specialtyId != null and specialtyId != ''">
27
+            AND b.specialty_id = #{specialtyId}
28
+        </if>
29
+        ORDER BY
30
+            a.create_date DESC
31
+    </select>
5 32
 </mapper>