Your Name 4 vuotta sitten
vanhempi
commit
7af5606b4e

+ 2
- 31
src/main/java/com/yunzhi/demo/controller/TaPersonController.java Näytä tiedosto

@@ -70,6 +70,7 @@ public class TaPersonController extends BaseController {
70 70
 
71 71
 		    IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
72 72
             QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<TaPerson>()
73
+                    .gt("student_id", "")
73 74
                     .gt("status", Constants.STATUS_DELETED)
74 75
                     .like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
75 76
                     .eq(!StringUtils.isEmpty(schoolId), "school_id", schoolId)
@@ -78,40 +79,10 @@ public class TaPersonController extends BaseController {
78 79
                     .like(!StringUtils.isEmpty(studentId), "student_id", "%"+studentId+"%")
79 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 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 88
      * @param taPerson 实体对象

+ 9
- 2
src/main/java/com/yunzhi/demo/controller/TaPostController.java Näytä tiedosto

@@ -118,8 +118,15 @@ public class TaPostController extends BaseController {
118 118
      */
119 119
     @RequestMapping(value="/admin/post/{id}", method= RequestMethod.DELETE)
120 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 130
             return ResponseBean.success("success");
124 131
         }else {
125 132
             return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);

+ 7
- 4
src/main/java/com/yunzhi/demo/controller/TdPostTypeController.java Näytä tiedosto

@@ -47,14 +47,17 @@ public class TdPostTypeController extends BaseController {
47 47
      * @param pageSize
48 48
      * @return
49 49
      */
50
-    @RequestMapping(value="/admin/post-type",method= RequestMethod.GET)
50
+    @RequestMapping(value="/{client}/post-type",method= RequestMethod.GET)
51 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 57
 		    IPage<TdPostType> pg = new Page<>(pageNum, pageSize);
56 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 61
             queryWrapper.orderByDesc("sort_no");
59 62
             queryWrapper.orderByDesc("create_date");
60 63
 

+ 7
- 0
src/main/java/com/yunzhi/demo/mapper/TaPersonMapper.java Näytä tiedosto

@@ -24,4 +24,11 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
24 24
                                         @Param("specialtyId") String specialtyId,
25 25
                                         @Param("asc") String asc,
26 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 Näytä tiedosto

@@ -22,4 +22,6 @@ public interface ITaPersonService extends IService<TaPerson> {
22 22
     int countStudent();
23 23
 
24 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 Näytä tiedosto

@@ -50,6 +50,11 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
50 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 58
     private String getDBFieldBy(String name) {
54 59
         if (StringUtils.isEmpty(name)) {
55 60
             return null;

+ 29
- 0
src/main/resources/mapper/TaPersonMapper.xml Näytä tiedosto

@@ -32,4 +32,33 @@
32 32
             ${desc} DESC
33 33
         </if>
34 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 64
 </mapper>