|
@@ -5,7 +5,9 @@ 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
|
7
|
import com.example.civilizedcity.common.ResponseBean;
|
|
8
|
+
|
8
|
9
|
import java.util.List;
|
|
10
|
+
|
9
|
11
|
import io.swagger.annotations.Api;
|
10
|
12
|
import io.swagger.annotations.ApiOperation;
|
11
|
13
|
import io.swagger.annotations.ApiParam;
|
|
@@ -14,8 +16,9 @@ import org.springframework.web.bind.annotation.*;
|
14
|
16
|
import com.example.civilizedcity.entity.TaCheckItemAn;
|
15
|
17
|
import com.example.civilizedcity.service.TaCheckItemAnService;
|
16
|
18
|
|
17
|
|
- /**
|
|
19
|
+/**
|
18
|
20
|
* 项目问题答案;(ta_check_item_an)表控制层
|
|
21
|
+ *
|
19
|
22
|
* @author : http://njyunzhi.com
|
20
|
23
|
* @date : 2022-12-16
|
21
|
24
|
*/
|
|
@@ -23,12 +26,12 @@ import com.example.civilizedcity.service.TaCheckItemAnService;
|
23
|
26
|
@RestController
|
24
|
27
|
@RequestMapping("/")
|
25
|
28
|
public class TaCheckItemAnController extends BaseController {
|
26
|
|
-
|
|
29
|
+
|
27
|
30
|
@Autowired
|
28
|
31
|
private TaCheckItemAnService taCheckItemAnService;
|
29
|
|
-
|
30
|
|
- /**
|
31
|
|
- * 通过ID查询单条数据
|
|
32
|
+
|
|
33
|
+ /**
|
|
34
|
+ * 通过ID查询单条数据
|
32
|
35
|
*
|
33
|
36
|
* @param answerId 主键
|
34
|
37
|
* @return 实例对象
|
|
@@ -38,28 +41,26 @@ public class TaCheckItemAnController extends BaseController {
|
38
|
41
|
public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
|
39
|
42
|
return ResponseBean.success(taCheckItemAnService.getById(id));
|
40
|
43
|
}
|
41
|
|
-
|
42
|
|
- /**
|
|
44
|
+
|
|
45
|
+ /**
|
43
|
46
|
* 分页查询
|
44
|
47
|
*
|
45
|
|
- * @param pageNum 当前页码
|
46
|
|
- * @param pageSize 每页条数
|
|
48
|
+ * @param quId 问题ID
|
47
|
49
|
* @return 查询结果
|
48
|
50
|
*/
|
49
|
51
|
@ApiOperation("分页查询")
|
50
|
52
|
@GetMapping("/taCheckItemAn")
|
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<TaCheckItemAn> pg = new Page<>(pageNum, pageSize);
|
55
|
|
- // QueryWrapper<TaCheckItemAn> queryWrapper = new QueryWrapper<>();
|
56
|
|
- // queryWrapper.orderByDesc("create_date");
|
57
|
|
- IPage<TaCheckItemAn> result = taCheckItemAnService.page(pg);
|
58
|
|
-
|
|
53
|
+ public ResponseBean list(@ApiParam("问题ID") @RequestParam(value = "quId") String quId) throws Exception {
|
|
54
|
+
|
|
55
|
+ QueryWrapper<TaCheckItemAn> queryWrapper = new QueryWrapper<>();
|
|
56
|
+ queryWrapper.eq("qu_id", quId);
|
|
57
|
+ queryWrapper.orderByAsc("sort_no");
|
|
58
|
+ List<TaCheckItemAn> result = taCheckItemAnService.list(queryWrapper);
|
|
59
|
+
|
59
|
60
|
return ResponseBean.success(result);
|
60
|
61
|
}
|
61
|
|
-
|
62
|
|
- /**
|
|
62
|
+
|
|
63
|
+ /**
|
63
|
64
|
* 新增数据
|
64
|
65
|
*
|
65
|
66
|
* @param taCheckItemAn 实例对象
|
|
@@ -71,8 +72,8 @@ public class TaCheckItemAnController extends BaseController {
|
71
|
72
|
taCheckItemAnService.save(taCheckItemAn);
|
72
|
73
|
return ResponseBean.success(taCheckItemAn);
|
73
|
74
|
}
|
74
|
|
-
|
75
|
|
- /**
|
|
75
|
+
|
|
76
|
+ /**
|
76
|
77
|
* 更新数据
|
77
|
78
|
*
|
78
|
79
|
* @param taCheckItemAn 实例对象
|
|
@@ -81,12 +82,12 @@ public class TaCheckItemAnController extends BaseController {
|
81
|
82
|
@ApiOperation("更新数据")
|
82
|
83
|
@PutMapping("/taCheckItemAn/{id}")
|
83
|
84
|
public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckItemAn taCheckItemAn,
|
84
|
|
- @ApiParam("对象ID") @PathVariable String id ) throws Exception {
|
|
85
|
+ @ApiParam("对象ID") @PathVariable String id) throws Exception {
|
85
|
86
|
taCheckItemAnService.updateById(taCheckItemAn);
|
86
|
87
|
return ResponseBean.success(taCheckItemAn);
|
87
|
88
|
}
|
88
|
|
-
|
89
|
|
- /**
|
|
89
|
+
|
|
90
|
+ /**
|
90
|
91
|
* 通过主键删除数据
|
91
|
92
|
*
|
92
|
93
|
* @param answerId 主键
|
|
@@ -94,7 +95,7 @@ public class TaCheckItemAnController extends BaseController {
|
94
|
95
|
*/
|
95
|
96
|
@ApiOperation("通过主键删除数据")
|
96
|
97
|
@DeleteMapping("/taCheckItemAn/{id}")
|
97
|
|
- public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
|
|
98
|
+ public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
|
98
|
99
|
taCheckItemAnService.removeLogicById(id);
|
99
|
100
|
return ResponseBean.success("success");
|
100
|
101
|
}
|