|
@@ -67,6 +67,25 @@ public class TdSchoolController extends BaseController {
|
67
|
67
|
return ResponseBean.success(result);
|
68
|
68
|
}
|
69
|
69
|
|
|
70
|
+ /**
|
|
71
|
+ * 分页查询列表
|
|
72
|
+ * @param pageNum
|
|
73
|
+ * @param pageSize
|
|
74
|
+ * @return
|
|
75
|
+ */
|
|
76
|
+ @RequestMapping(value="/admin/school",method= RequestMethod.GET)
|
|
77
|
+ @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
|
|
78
|
+ public ResponseBean schoolList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
79
|
+ @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
|
|
80
|
+
|
|
81
|
+ IPage<TdSchool> pg = new Page<>(pageNum, pageSize);
|
|
82
|
+ QueryWrapper<TdSchool> queryWrapper = new QueryWrapper<>();
|
|
83
|
+ queryWrapper.orderByDesc("create_date");
|
|
84
|
+
|
|
85
|
+ IPage<TdSchool> result = iTdSchoolService.page(pg, queryWrapper);
|
|
86
|
+ return ResponseBean.success(result);
|
|
87
|
+ }
|
|
88
|
+
|
70
|
89
|
/**
|
71
|
90
|
* 保存对象
|
72
|
91
|
* @param tdSchool 实体对象
|
|
@@ -83,13 +102,43 @@ public class TdSchoolController extends BaseController {
|
83
|
102
|
}
|
84
|
103
|
}
|
85
|
104
|
|
|
105
|
+ /**
|
|
106
|
+ * 保存对象
|
|
107
|
+ * @param tdSchool 实体对象
|
|
108
|
+ * @return
|
|
109
|
+ */
|
|
110
|
+ @RequestMapping(value="/admin/school",method= RequestMethod.POST)
|
|
111
|
+ @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
|
112
|
+ public ResponseBean schoolAdd(@ApiParam("保存内容") @RequestBody TdSchool tdSchool) throws Exception{
|
|
113
|
+
|
|
114
|
+ if (iTdSchoolService.save(tdSchool)){
|
|
115
|
+ return ResponseBean.success(tdSchool);
|
|
116
|
+ }else {
|
|
117
|
+ return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
118
|
+ }
|
|
119
|
+ }
|
|
120
|
+
|
86
|
121
|
/**
|
87
|
122
|
* 根据id删除对象
|
88
|
123
|
* @param id 实体ID
|
89
|
124
|
*/
|
90
|
125
|
@RequestMapping(value="/tdSchool/{id}", method= RequestMethod.DELETE)
|
91
|
126
|
@ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
92
|
|
- public ResponseBean tdSchoolDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
|
127
|
+ public ResponseBean tdSchoolDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
|
128
|
+ if(iTdSchoolService.removeById(id)){
|
|
129
|
+ return ResponseBean.success("success");
|
|
130
|
+ }else {
|
|
131
|
+ return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
132
|
+ }
|
|
133
|
+ }
|
|
134
|
+
|
|
135
|
+ /**
|
|
136
|
+ * 根据id删除对象
|
|
137
|
+ * @param id 实体ID
|
|
138
|
+ */
|
|
139
|
+ @RequestMapping(value="/admin/school/{id}", method= RequestMethod.DELETE)
|
|
140
|
+ @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
|
141
|
+ public ResponseBean schoolDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
93
|
142
|
if(iTdSchoolService.removeById(id)){
|
94
|
143
|
return ResponseBean.success("success");
|
95
|
144
|
}else {
|
|
@@ -105,7 +154,7 @@ public class TdSchoolController extends BaseController {
|
105
|
154
|
*/
|
106
|
155
|
@RequestMapping(value="/tdSchool/{id}",method= RequestMethod.PUT)
|
107
|
156
|
@ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
108
|
|
- public ResponseBean tdSchoolUpdate(@ApiParam("对象ID") @PathVariable Integer id,
|
|
157
|
+ public ResponseBean tdSchoolUpdate(@ApiParam("对象ID") @PathVariable String id,
|
109
|
158
|
@ApiParam("更新内容") @RequestBody TdSchool tdSchool) throws Exception{
|
110
|
159
|
|
111
|
160
|
if (iTdSchoolService.updateById(tdSchool)){
|
|
@@ -115,13 +164,41 @@ public class TdSchoolController extends BaseController {
|
115
|
164
|
}
|
116
|
165
|
}
|
117
|
166
|
|
|
167
|
+ /**
|
|
168
|
+ * 修改对象
|
|
169
|
+ * @param id 实体ID
|
|
170
|
+ * @param tdSchool 实体对象
|
|
171
|
+ * @return
|
|
172
|
+ */
|
|
173
|
+ @RequestMapping(value="/admin/school/{id}",method= RequestMethod.PUT)
|
|
174
|
+ @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
|
175
|
+ public ResponseBean schoolUpdate(@ApiParam("对象ID") @PathVariable String id,
|
|
176
|
+ @ApiParam("更新内容") @RequestBody TdSchool tdSchool) throws Exception{
|
|
177
|
+
|
|
178
|
+ if (iTdSchoolService.updateById(tdSchool)){
|
|
179
|
+ return ResponseBean.success(iTdSchoolService.getById(id));
|
|
180
|
+ }else {
|
|
181
|
+ return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
182
|
+ }
|
|
183
|
+ }
|
|
184
|
+
|
118
|
185
|
/**
|
119
|
186
|
* 根据id查询对象
|
120
|
187
|
* @param id 实体ID
|
121
|
188
|
*/
|
122
|
189
|
@RequestMapping(value="/tdSchool/{id}",method= RequestMethod.GET)
|
123
|
190
|
@ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
124
|
|
- public ResponseBean tdSchoolGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
|
191
|
+ public ResponseBean tdSchoolGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
|
192
|
+ return ResponseBean.success(iTdSchoolService.getById(id));
|
|
193
|
+ }
|
|
194
|
+
|
|
195
|
+ /**
|
|
196
|
+ * 根据id查询对象
|
|
197
|
+ * @param id 实体ID
|
|
198
|
+ */
|
|
199
|
+ @RequestMapping(value="/admin/school/{id}",method= RequestMethod.GET)
|
|
200
|
+ @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
|
201
|
+ public ResponseBean schoolGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
125
|
202
|
return ResponseBean.success(iTdSchoolService.getById(id));
|
126
|
203
|
}
|
127
|
204
|
}
|