|
@@ -0,0 +1,101 @@
|
|
1
|
+package com.yunzhi.nanyang.controller;
|
|
2
|
+
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
4
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
5
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
6
|
+import com.yunzhi.nanyang.common.BaseController;
|
|
7
|
+import com.yunzhi.nanyang.common.ResponseBean;
|
|
8
|
+import java.util.List;
|
|
9
|
+import io.swagger.annotations.Api;
|
|
10
|
+import io.swagger.annotations.ApiOperation;
|
|
11
|
+import io.swagger.annotations.ApiParam;
|
|
12
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
13
|
+import org.springframework.web.bind.annotation.*;
|
|
14
|
+import com.yunzhi.nanyang.entity.TcBind;
|
|
15
|
+import com.yunzhi.nanyang.service.TcBindService;
|
|
16
|
+
|
|
17
|
+ /**
|
|
18
|
+ * 绑定表;(tc_bind)表控制层
|
|
19
|
+ * @author : http://njyunzhi.com
|
|
20
|
+ * @date : 2022-11-22
|
|
21
|
+ */
|
|
22
|
+@Api(tags = "绑定表对象功能接口")
|
|
23
|
+@RestController
|
|
24
|
+@RequestMapping("/")
|
|
25
|
+public class TcBindController extends BaseController {
|
|
26
|
+
|
|
27
|
+ @Autowired
|
|
28
|
+ private TcBindService tcBindService;
|
|
29
|
+
|
|
30
|
+ /**
|
|
31
|
+ * 通过ID查询单条数据
|
|
32
|
+ *
|
|
33
|
+ * @param serialNo 主键
|
|
34
|
+ * @return 实例对象
|
|
35
|
+ */
|
|
36
|
+ @ApiOperation("通过ID查询单条数据")
|
|
37
|
+ @GetMapping("/tcBind/{id}")
|
|
38
|
+ public ResponseBean queryById(@ApiParam("对象ID") @PathVariable Integer id) throws Exception {
|
|
39
|
+ return ResponseBean.success(tcBindService.getById(id));
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ /**
|
|
43
|
+ * 分页查询
|
|
44
|
+ *
|
|
45
|
+ * @param pageNum 当前页码
|
|
46
|
+ * @param pageSize 每页条数
|
|
47
|
+ * @return 查询结果
|
|
48
|
+ */
|
|
49
|
+ @ApiOperation("分页查询")
|
|
50
|
+ @GetMapping("/tcBind")
|
|
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<TcBind> pg = new Page<>(pageNum, pageSize);
|
|
55
|
+ // QueryWrapper<TcBind> queryWrapper = new QueryWrapper<>();
|
|
56
|
+ // queryWrapper.orderByDesc("create_date");
|
|
57
|
+ IPage<TcBind> result = tcBindService.page(pg);
|
|
58
|
+
|
|
59
|
+ return ResponseBean.success(result);
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+ /**
|
|
63
|
+ * 新增数据
|
|
64
|
+ *
|
|
65
|
+ * @param tcBind 实例对象
|
|
66
|
+ * @return 实例对象
|
|
67
|
+ */
|
|
68
|
+ @ApiOperation("新增数据")
|
|
69
|
+ @PostMapping("/tcBind")
|
|
70
|
+ public ResponseBean add(@ApiParam("对象实体") @RequestBody TcBind tcBind) throws Exception {
|
|
71
|
+ tcBindService.save(tcBind);
|
|
72
|
+ return ResponseBean.success(tcBind);
|
|
73
|
+ }
|
|
74
|
+
|
|
75
|
+ /**
|
|
76
|
+ * 更新数据
|
|
77
|
+ *
|
|
78
|
+ * @param tcBind 实例对象
|
|
79
|
+ * @return 实例对象
|
|
80
|
+ */
|
|
81
|
+ @ApiOperation("更新数据")
|
|
82
|
+ @PutMapping("/tcBind/{id}")
|
|
83
|
+ public ResponseBean edit(@ApiParam("对象实体") @RequestBody TcBind tcBind,
|
|
84
|
+ @ApiParam("对象ID") @PathVariable Integer id ) throws Exception {
|
|
85
|
+ tcBindService.updateById(tcBind);
|
|
86
|
+ return ResponseBean.success(tcBind);
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+ /**
|
|
90
|
+ * 通过主键删除数据
|
|
91
|
+ *
|
|
92
|
+ * @param serialNo 主键
|
|
93
|
+ * @return 是否成功
|
|
94
|
+ */
|
|
95
|
+ @ApiOperation("通过主键删除数据")
|
|
96
|
+ @DeleteMapping("/tcBind/{id}")
|
|
97
|
+ public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
|
|
98
|
+ tcBindService.removeLogicById(id);
|
|
99
|
+ return ResponseBean.success("success");
|
|
100
|
+ }
|
|
101
|
+}
|