|
@@ -69,6 +69,29 @@ public class TdSpecialtyController extends BaseController {
|
69
|
69
|
return ResponseBean.success(result);
|
70
|
70
|
}
|
71
|
71
|
|
|
72
|
+ /**
|
|
73
|
+ * 分页查询列表
|
|
74
|
+ * @return
|
|
75
|
+ */
|
|
76
|
+ @RequestMapping(value="/admin/specialty",method= RequestMethod.GET)
|
|
77
|
+ @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
|
|
78
|
+ public ResponseBean adminSpecialtyList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
79
|
+ @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
80
|
+ @ApiParam(value = "学校ID", required = false) @RequestParam(value ="schoolId", required = false) String schoolId,
|
|
81
|
+ @ApiParam(value = "名称", required = false) @RequestParam(value ="name", required = false) String name) throws Exception {
|
|
82
|
+
|
|
83
|
+ IPage<TdSpecialty> pg = new Page<>(pageNum, pageSize);
|
|
84
|
+ QueryWrapper<TdSpecialty> queryWrapper = new QueryWrapper<TdSpecialty>()
|
|
85
|
+ .eq(!StringUtils.isEmpty(schoolId),"schoolId", schoolId)
|
|
86
|
+ .like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
|
|
87
|
+ .eq("status", Constants.STATUS_NORMAL)
|
|
88
|
+ .orderByAsc("sort_no")
|
|
89
|
+ .orderByDesc("create_date");
|
|
90
|
+
|
|
91
|
+ IPage<TdSpecialty> result = iTdSpecialtyService.page(pg, queryWrapper);
|
|
92
|
+ return ResponseBean.success(result);
|
|
93
|
+ }
|
|
94
|
+
|
72
|
95
|
/**
|
73
|
96
|
* 保存对象
|
74
|
97
|
* @param tdSpecialty 实体对象
|
|
@@ -85,13 +108,43 @@ public class TdSpecialtyController extends BaseController {
|
85
|
108
|
}
|
86
|
109
|
}
|
87
|
110
|
|
|
111
|
+ /**
|
|
112
|
+ * 保存对象
|
|
113
|
+ * @param tdSpecialty 实体对象
|
|
114
|
+ * @return
|
|
115
|
+ */
|
|
116
|
+ @RequestMapping(value="/admin/specialty",method= RequestMethod.POST)
|
|
117
|
+ @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
|
118
|
+ public ResponseBean specialtyAdd(@ApiParam("保存内容") @RequestBody TdSpecialty tdSpecialty) throws Exception{
|
|
119
|
+
|
|
120
|
+ if (iTdSpecialtyService.save(tdSpecialty)){
|
|
121
|
+ return ResponseBean.success(tdSpecialty);
|
|
122
|
+ }else {
|
|
123
|
+ return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
124
|
+ }
|
|
125
|
+ }
|
|
126
|
+
|
88
|
127
|
/**
|
89
|
128
|
* 根据id删除对象
|
90
|
129
|
* @param id 实体ID
|
91
|
130
|
*/
|
92
|
131
|
@RequestMapping(value="/tdSpecialty/{id}", method= RequestMethod.DELETE)
|
93
|
132
|
@ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
94
|
|
- public ResponseBean tdSpecialtyDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
|
133
|
+ public ResponseBean tdSpecialtyDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
|
134
|
+ if(iTdSpecialtyService.removeById(id)){
|
|
135
|
+ return ResponseBean.success("success");
|
|
136
|
+ }else {
|
|
137
|
+ return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
138
|
+ }
|
|
139
|
+ }
|
|
140
|
+
|
|
141
|
+ /**
|
|
142
|
+ * 根据id删除对象
|
|
143
|
+ * @param id 实体ID
|
|
144
|
+ */
|
|
145
|
+ @RequestMapping(value="/admin/specialty/{id}", method= RequestMethod.DELETE)
|
|
146
|
+ @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
|
147
|
+ public ResponseBean specialtyDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
95
|
148
|
if(iTdSpecialtyService.removeById(id)){
|
96
|
149
|
return ResponseBean.success("success");
|
97
|
150
|
}else {
|