|
@@ -16,7 +16,7 @@ import com.example.civilizedcity.entity.TdQuestion;
|
16
|
16
|
import com.example.civilizedcity.service.TdQuestionService;
|
17
|
17
|
|
18
|
18
|
/**
|
19
|
|
- * 点位问题;(td_loc_question)表控制层
|
|
19
|
+ * 点位问题;(td_question)表控制层
|
20
|
20
|
* @author : http://njyunzhi.com
|
21
|
21
|
* @date : 2022-12-13
|
22
|
22
|
*/
|
|
@@ -26,10 +26,10 @@ import com.example.civilizedcity.service.TdQuestionService;
|
26
|
26
|
public class TdQuestionController extends BaseController {
|
27
|
27
|
|
28
|
28
|
@Autowired
|
29
|
|
- private TdQuestionService tdLocQuestionService;
|
|
29
|
+ private TdQuestionService tdQuestionService;
|
30
|
30
|
|
31
|
31
|
@Autowired
|
32
|
|
- private TdQuAnswerService tdLocQuAnswerService;
|
|
32
|
+ private TdQuAnswerService tdQuAnswerService;
|
33
|
33
|
|
34
|
34
|
/**
|
35
|
35
|
* 通过ID查询单条数据
|
|
@@ -38,9 +38,9 @@ public class TdQuestionController extends BaseController {
|
38
|
38
|
* @return 实例对象
|
39
|
39
|
*/
|
40
|
40
|
@ApiOperation("通过ID查询单条数据")
|
41
|
|
- @GetMapping("/tdLocQuestion/{id}")
|
|
41
|
+ @GetMapping("/tdQuestion/{id}")
|
42
|
42
|
public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
|
43
|
|
- return ResponseBean.success(tdLocQuestionService.getById(id));
|
|
43
|
+ return ResponseBean.success(tdQuestionService.getById(id));
|
44
|
44
|
}
|
45
|
45
|
|
46
|
46
|
/**
|
|
@@ -51,14 +51,14 @@ public class TdQuestionController extends BaseController {
|
51
|
51
|
* @return 查询结果
|
52
|
52
|
*/
|
53
|
53
|
@ApiOperation("分页查询")
|
54
|
|
- @GetMapping("/tdLocQuestion")
|
|
54
|
+ @GetMapping("/tdQuestion")
|
55
|
55
|
public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
56
|
56
|
@ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
|
57
|
57
|
|
58
|
58
|
IPage<TdQuestion> pg = new Page<>(pageNum, pageSize);
|
59
|
|
- // QueryWrapper<TdLocQuestion> queryWrapper = new QueryWrapper<>();
|
|
59
|
+ // QueryWrapper<TdQuestion> queryWrapper = new QueryWrapper<>();
|
60
|
60
|
// queryWrapper.orderByDesc("create_date");
|
61
|
|
- IPage<TdQuestion> result = tdLocQuestionService.page(pg);
|
|
61
|
+ IPage<TdQuestion> result = tdQuestionService.page(pg);
|
62
|
62
|
|
63
|
63
|
return ResponseBean.success(result);
|
64
|
64
|
}
|
|
@@ -66,37 +66,37 @@ public class TdQuestionController extends BaseController {
|
66
|
66
|
/**
|
67
|
67
|
* 新增数据
|
68
|
68
|
*
|
69
|
|
- * @param tdLocQuestion 实例对象
|
|
69
|
+ * @param tdQuestion 实例对象
|
70
|
70
|
* @return 实例对象
|
71
|
71
|
*/
|
72
|
72
|
@ApiOperation("新增数据")
|
73
|
|
- @PostMapping("/tdLocQuestion")
|
74
|
|
- public ResponseBean add(@ApiParam("对象实体") @RequestBody TdQuestion tdLocQuestion) throws Exception {
|
75
|
|
- String quId = tdLocQuestion.getQuId();
|
|
73
|
+ @PostMapping("/tdQuestion")
|
|
74
|
+ public ResponseBean add(@ApiParam("对象实体") @RequestBody TdQuestion tdQuestion) throws Exception {
|
|
75
|
+ String quId = tdQuestion.getQuId();
|
76
|
76
|
|
77
|
77
|
if (StringUtils.isEmpty(quId)) {
|
78
|
78
|
// 新增
|
79
|
|
- tdLocQuestionService.save(tdLocQuestion);
|
|
79
|
+ tdQuestionService.save(tdQuestion);
|
80
|
80
|
} else {
|
81
|
|
- tdLocQuestionService.updateById(tdLocQuestion);
|
|
81
|
+ tdQuestionService.updateById(tdQuestion);
|
82
|
82
|
}
|
83
|
83
|
|
84
|
|
- tdLocQuAnswerService.mergeData(tdLocQuestion.getQuId(), tdLocQuestion.getQuAnswerList());
|
85
|
|
- return ResponseBean.success(tdLocQuestion);
|
|
84
|
+ tdQuAnswerService.mergeData(tdQuestion.getQuId(), tdQuestion.getQuAnswerList());
|
|
85
|
+ return ResponseBean.success(tdQuestion);
|
86
|
86
|
}
|
87
|
87
|
|
88
|
88
|
/**
|
89
|
89
|
* 更新数据
|
90
|
90
|
*
|
91
|
|
- * @param tdLocQuestion 实例对象
|
|
91
|
+ * @param tdQuestion 实例对象
|
92
|
92
|
* @return 实例对象
|
93
|
93
|
*/
|
94
|
94
|
@ApiOperation("更新数据")
|
95
|
|
- @PutMapping("/tdLocQuestion/{id}")
|
96
|
|
- public ResponseBean edit(@ApiParam("对象实体") @RequestBody TdQuestion tdLocQuestion,
|
|
95
|
+ @PutMapping("/tdQuestion/{id}")
|
|
96
|
+ public ResponseBean edit(@ApiParam("对象实体") @RequestBody TdQuestion tdQuestion,
|
97
|
97
|
@ApiParam("对象ID") @PathVariable String id ) throws Exception {
|
98
|
|
- tdLocQuestionService.updateById(tdLocQuestion);
|
99
|
|
- return ResponseBean.success(tdLocQuestion);
|
|
98
|
+ tdQuestionService.updateById(tdQuestion);
|
|
99
|
+ return ResponseBean.success(tdQuestion);
|
100
|
100
|
}
|
101
|
101
|
|
102
|
102
|
/**
|
|
@@ -106,9 +106,9 @@ public class TdQuestionController extends BaseController {
|
106
|
106
|
* @return 是否成功
|
107
|
107
|
*/
|
108
|
108
|
@ApiOperation("通过主键删除数据")
|
109
|
|
- @DeleteMapping("/tdLocQuestion/{id}")
|
|
109
|
+ @DeleteMapping("/tdQuestion/{id}")
|
110
|
110
|
public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
|
111
|
|
- tdLocQuestionService.removeLogicById(id);
|
|
111
|
+ tdQuestionService.removeLogicById(id);
|
112
|
112
|
return ResponseBean.success("success");
|
113
|
113
|
}
|
114
|
114
|
}
|