|
@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
4
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.example.civilizedcity.common.BaseController;
|
|
7
|
+import com.example.civilizedcity.common.Constants;
|
7
|
8
|
import com.example.civilizedcity.common.ResponseBean;
|
|
9
|
+
|
8
|
10
|
import java.util.List;
|
|
11
|
+
|
|
12
|
+import com.example.civilizedcity.common.StringUtils;
|
9
|
13
|
import io.swagger.annotations.Api;
|
10
|
14
|
import io.swagger.annotations.ApiOperation;
|
11
|
15
|
import io.swagger.annotations.ApiParam;
|
|
@@ -14,8 +18,9 @@ import org.springframework.web.bind.annotation.*;
|
14
|
18
|
import com.example.civilizedcity.entity.TaCheckStand;
|
15
|
19
|
import com.example.civilizedcity.service.TaCheckStandService;
|
16
|
20
|
|
17
|
|
- /**
|
|
21
|
+/**
|
18
|
22
|
* 测评标准;(ta_check_stand)表控制层
|
|
23
|
+ *
|
19
|
24
|
* @author : http://njyunzhi.com
|
20
|
25
|
* @date : 2023-1-29
|
21
|
26
|
*/
|
|
@@ -23,12 +28,12 @@ import com.example.civilizedcity.service.TaCheckStandService;
|
23
|
28
|
@RestController
|
24
|
29
|
@RequestMapping("/")
|
25
|
30
|
public class TaCheckStandController extends BaseController {
|
26
|
|
-
|
|
31
|
+
|
27
|
32
|
@Autowired
|
28
|
33
|
private TaCheckStandService taCheckStandService;
|
29
|
|
-
|
30
|
|
- /**
|
31
|
|
- * 通过ID查询单条数据
|
|
34
|
+
|
|
35
|
+ /**
|
|
36
|
+ * 通过ID查询单条数据
|
32
|
37
|
*
|
33
|
38
|
* @param statndId 主键
|
34
|
39
|
* @return 实例对象
|
|
@@ -38,41 +43,44 @@ public class TaCheckStandController extends BaseController {
|
38
|
43
|
public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
|
39
|
44
|
return ResponseBean.success(taCheckStandService.getById(id));
|
40
|
45
|
}
|
41
|
|
-
|
42
|
|
-// /**
|
43
|
|
-// * 分页查询
|
44
|
|
-// *
|
45
|
|
-// * @param pageNum 当前页码
|
46
|
|
-// * @param pageSize 每页条数
|
47
|
|
-// * @return 查询结果
|
48
|
|
-// */
|
49
|
|
-// @ApiOperation("分页查询")
|
50
|
|
-// @GetMapping("/taCheckStand")
|
51
|
|
-// public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
52
|
|
-// @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
|
53
|
|
-//
|
54
|
|
-// IPage<TaCheckStand> pg = new Page<>(pageNum, pageSize);
|
55
|
|
-// // QueryWrapper<TaCheckStand> queryWrapper = new QueryWrapper<>();
|
56
|
|
-// // queryWrapper.orderByDesc("create_date");
|
57
|
|
-// IPage<TaCheckStand> result = taCheckStandService.page(pg);
|
58
|
|
-//
|
59
|
|
-// return ResponseBean.success(result);
|
60
|
|
-// }
|
61
|
|
-//
|
62
|
|
-// /**
|
63
|
|
-// * 新增数据
|
64
|
|
-// *
|
65
|
|
-// * @param taCheckStand 实例对象
|
66
|
|
-// * @return 实例对象
|
67
|
|
-// */
|
68
|
|
-// @ApiOperation("新增数据")
|
69
|
|
-// @PostMapping("/taCheckStand")
|
70
|
|
-// public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheckStand taCheckStand) throws Exception {
|
71
|
|
-// taCheckStandService.save(taCheckStand);
|
72
|
|
-// return ResponseBean.success(taCheckStand);
|
73
|
|
-// }
|
74
|
|
-
|
75
|
|
- /**
|
|
46
|
+
|
|
47
|
+ /**
|
|
48
|
+ * 分页查询
|
|
49
|
+ *
|
|
50
|
+ * @param pageNum 当前页码
|
|
51
|
+ * @param pageSize 每页条数
|
|
52
|
+ * @return 查询结果
|
|
53
|
+ */
|
|
54
|
+ @ApiOperation("分页查询")
|
|
55
|
+ @GetMapping("/taCheckStand")
|
|
56
|
+ public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
57
|
+ @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
|
58
|
+ @ApiParam("点位ID") @RequestParam(value = "locId", required = false) String locId) throws Exception {
|
|
59
|
+
|
|
60
|
+ IPage<TaCheckStand> pg = new Page<>(pageNum, pageSize);
|
|
61
|
+ QueryWrapper<TaCheckStand> queryWrapper = new QueryWrapper<>();
|
|
62
|
+ queryWrapper.eq(StringUtils.isNotEmpty(locId), "loc_id", locId);
|
|
63
|
+ queryWrapper.eq("status", Constants.STATUS_NORMAL);
|
|
64
|
+ queryWrapper.orderByDesc("create_date");
|
|
65
|
+ IPage<TaCheckStand> result = taCheckStandService.page(pg);
|
|
66
|
+
|
|
67
|
+ return ResponseBean.success(result);
|
|
68
|
+ }
|
|
69
|
+
|
|
70
|
+ /**
|
|
71
|
+ * 新增数据
|
|
72
|
+ *
|
|
73
|
+ * @param taCheckStand 实例对象
|
|
74
|
+ * @return 实例对象
|
|
75
|
+ */
|
|
76
|
+ @ApiOperation("新增数据")
|
|
77
|
+ @PostMapping("/taCheckStand")
|
|
78
|
+ public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheckStand taCheckStand) throws Exception {
|
|
79
|
+ taCheckStandService.save(taCheckStand);
|
|
80
|
+ return ResponseBean.success(taCheckStand);
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ /**
|
76
|
84
|
* 更新数据
|
77
|
85
|
*
|
78
|
86
|
* @param taCheckStand 实例对象
|
|
@@ -81,7 +89,7 @@ public class TaCheckStandController extends BaseController {
|
81
|
89
|
@ApiOperation("更新数据")
|
82
|
90
|
@PutMapping("/taCheckStand/{id}")
|
83
|
91
|
public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckStand taCheckStand,
|
84
|
|
- @ApiParam("对象ID") @PathVariable String id ) throws Exception {
|
|
92
|
+ @ApiParam("对象ID") @PathVariable String id) throws Exception {
|
85
|
93
|
taCheckStand.setStatndId(id);
|
86
|
94
|
taCheckStandService.updateById(taCheckStand);
|
87
|
95
|
return ResponseBean.success(taCheckStand);
|