Your Name 4 年前
父节点
当前提交
7af5606b4e

+ 2
- 31
src/main/java/com/yunzhi/demo/controller/TaPersonController.java 查看文件

70
 
70
 
71
 		    IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
71
 		    IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
72
             QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<TaPerson>()
72
             QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<TaPerson>()
73
+                    .gt("student_id", "")
73
                     .gt("status", Constants.STATUS_DELETED)
74
                     .gt("status", Constants.STATUS_DELETED)
74
                     .like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
75
                     .like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
75
                     .eq(!StringUtils.isEmpty(schoolId), "school_id", schoolId)
76
                     .eq(!StringUtils.isEmpty(schoolId), "school_id", schoolId)
78
                     .like(!StringUtils.isEmpty(studentId), "student_id", "%"+studentId+"%")
79
                     .like(!StringUtils.isEmpty(studentId), "student_id", "%"+studentId+"%")
79
                     .orderByDesc("create_date");
80
                     .orderByDesc("create_date");
80
 
81
 
81
-            IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
82
+            IPage<TaPerson> result = iTaPersonService.getStudentInfoPagedBy(pg, name, schoolId, specialtyId, phone, studentId);
82
             return ResponseBean.success(result);
83
             return ResponseBean.success(result);
83
     }
84
     }
84
 
85
 
85
-//    /**
86
-//     * 保存对象
87
-//     * @param taPerson 实体对象
88
-//     * @return
89
-//     */
90
-//    @RequestMapping(value="/taPerson",method= RequestMethod.POST)
91
-//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
92
-//    public ResponseBean taPersonAdd(@ApiParam("保存内容") @RequestBody TaPerson taPerson) throws Exception{
93
-//
94
-//        if (iTaPersonService.save(taPerson)){
95
-//            return ResponseBean.success(taPerson);
96
-//        }else {
97
-//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
98
-//        }
99
-//    }
100
-
101
-//    /**
102
-//     * 根据id删除对象
103
-//     * @param id  实体ID
104
-//     */
105
-//    @RequestMapping(value="/taPerson/{id}", method= RequestMethod.DELETE)
106
-//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
107
-//    public ResponseBean taPersonDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
108
-//        if(iTaPersonService.removeById(id)){
109
-//            return ResponseBean.success("success");
110
-//        }else {
111
-//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
112
-//        }
113
-//    }
114
-
115
     /**
86
     /**
116
      * 小程序完善信息
87
      * 小程序完善信息
117
      * @param taPerson 实体对象
88
      * @param taPerson 实体对象

+ 9
- 2
src/main/java/com/yunzhi/demo/controller/TaPostController.java 查看文件

118
      */
118
      */
119
     @RequestMapping(value="/admin/post/{id}", method= RequestMethod.DELETE)
119
     @RequestMapping(value="/admin/post/{id}", method= RequestMethod.DELETE)
120
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
120
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
121
-    public ResponseBean taPostDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
122
-        if(iTaPostService.removeById(id)){
121
+    public ResponseBean taPostDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception {
122
+        TaPost taPost = iTaPostService.getById(id);
123
+        if (null == taPost || Constants.STATUS_DELETED.equals(taPost.getStatus())) {
124
+            return ResponseBean.success("success");
125
+        }
126
+
127
+        taPost.setStatus(Constants.STATUS_DELETED);
128
+
129
+        if(iTaPostService.updateById(taPost)){
123
             return ResponseBean.success("success");
130
             return ResponseBean.success("success");
124
         }else {
131
         }else {
125
             return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
132
             return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);

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

47
      * @param pageSize
47
      * @param pageSize
48
      * @return
48
      * @return
49
      */
49
      */
50
-    @RequestMapping(value="/admin/post-type",method= RequestMethod.GET)
50
+    @RequestMapping(value="/{client}/post-type",method= RequestMethod.GET)
51
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
52
-    public ResponseBean tdPostTypeList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
53
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
52
+    public ResponseBean tdPostTypeList(@ApiParam("客户端") @PathVariable String client,
53
+                                       @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
54
+                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
55
+                                       @ApiParam("状态") @RequestParam(value = "status", required = false) Integer status) throws Exception{
54
 
56
 
55
 		    IPage<TdPostType> pg = new Page<>(pageNum, pageSize);
57
 		    IPage<TdPostType> pg = new Page<>(pageNum, pageSize);
56
             QueryWrapper<TdPostType> queryWrapper = new QueryWrapper<>();
58
             QueryWrapper<TdPostType> queryWrapper = new QueryWrapper<>();
57
-            queryWrapper.eq("status", Constants.STATUS_NORMAL);
59
+            queryWrapper.eq(null != status, "status", status);
60
+            queryWrapper.gt("status", Constants.STATUS_DELETED);
58
             queryWrapper.orderByDesc("sort_no");
61
             queryWrapper.orderByDesc("sort_no");
59
             queryWrapper.orderByDesc("create_date");
62
             queryWrapper.orderByDesc("create_date");
60
 
63
 

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

24
                                         @Param("specialtyId") String specialtyId,
24
                                         @Param("specialtyId") String specialtyId,
25
                                         @Param("asc") String asc,
25
                                         @Param("asc") String asc,
26
                                         @Param("desc") String desc);
26
                                         @Param("desc") String desc);
27
+
28
+    IPage<TaPerson> getStudentInfoPagedBy(IPage<TaPerson> pg,
29
+                                          @Param("name") String name,
30
+                                          @Param("schoolId") String schoolId,
31
+                                          @Param("specialtyId") String specialtyId,
32
+                                          @Param("phone") String phone,
33
+                                          @Param("studentId") String studentId);
27
 }
34
 }

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

22
     int countStudent();
22
     int countStudent();
23
 
23
 
24
     IPage<StatisPerson> getStudentStatis(IPage<StatisPerson> pg, String name, String schoolId, String specialtyId, String asc, String desc);
24
     IPage<StatisPerson> getStudentStatis(IPage<StatisPerson> pg, String name, String schoolId, String specialtyId, String asc, String desc);
25
+
26
+    IPage<TaPerson> getStudentInfoPagedBy(IPage<TaPerson> pg, String name, String schoolId, String specialtyId, String phone, String studentId);
25
 }
27
 }

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

50
         return taPersonMapper.getStudentStatis(pg, name, schoolId, specialtyId, getDBFieldBy(asc), getDBFieldBy(desc));
50
         return taPersonMapper.getStudentStatis(pg, name, schoolId, specialtyId, getDBFieldBy(asc), getDBFieldBy(desc));
51
     }
51
     }
52
 
52
 
53
+    @Override
54
+    public IPage<TaPerson> getStudentInfoPagedBy(IPage<TaPerson> pg, String name, String schoolId, String specialtyId, String phone, String studentId) {
55
+        return taPersonMapper.getStudentInfoPagedBy(pg, name, schoolId, specialtyId, phone, studentId);
56
+    }
57
+
53
     private String getDBFieldBy(String name) {
58
     private String getDBFieldBy(String name) {
54
         if (StringUtils.isEmpty(name)) {
59
         if (StringUtils.isEmpty(name)) {
55
             return null;
60
             return null;

+ 29
- 0
src/main/resources/mapper/TaPersonMapper.xml 查看文件

32
             ${desc} DESC
32
             ${desc} DESC
33
         </if>
33
         </if>
34
     </select>
34
     </select>
35
+    <select id="getStudentInfoPagedBy" resultType="com.yunzhi.demo.entity.TaPerson">
36
+        SELECT
37
+            t.*,
38
+            s.`name` AS school_name,
39
+            m.`name` AS specialty_name
40
+        FROM
41
+            ta_person t
42
+                INNER JOIN td_school s ON t.school_id = s.school_id
43
+                INNER JOIN td_specialty m ON t.specialty_id = m.specialty_id
44
+        WHERE
45
+            t.`status` > - 1
46
+        <if test="name != null and name != ''">
47
+          AND t.`name` LIKE CONCAT( '%', #{name}, '%' )
48
+        </if>
49
+        <if test="phone != null and phone != ''">
50
+          AND t.phone LIKE CONCAT( '%', #{phone}, '%' )
51
+        </if>
52
+        <if test="studentId != null and studentId != ''">
53
+          AND t.student_id = LIKE CONCAT( '%', #{studentId}, '%' )
54
+        </if>
55
+        <if test="schoolId != null and schoolId != ''">
56
+          AND t.school_id = #{schoolId}
57
+        </if>
58
+        <if test="specialtyId != null and specialtyId != ''">
59
+          AND t.specialty_id = #{specialtyId}
60
+        </if>
61
+        ORDER BY
62
+            t.create_date DESC
63
+    </select>
35
 </mapper>
64
 </mapper>