|
@@ -38,10 +38,10 @@ public class TdSpecialtyController extends BaseController {
|
38
|
38
|
|
39
|
39
|
@GetMapping("/ma/specialty")
|
40
|
40
|
@ApiOperation(value="小程序学科专业字典", notes = "学科专业", httpMethod = "GET", response = ResponseBean.class)
|
41
|
|
- public ResponseBean maSchoolList(@ApiParam(value = "学校ID", required = false) @RequestParam(value ="school", required = false) String school,
|
|
41
|
+ public ResponseBean maSchoolList(@ApiParam(value = "学校ID", required = false) @RequestParam(value ="schoolId", required = false) String schoolId,
|
42
|
42
|
@ApiParam(value = "名称", required = false) @RequestParam(value ="name", required = false) String name) throws Exception {
|
43
|
43
|
QueryWrapper<TdSpecialty> queryWrapper = new QueryWrapper<TdSpecialty>()
|
44
|
|
- .eq(!StringUtils.isEmpty(school),"school_id", school)
|
|
44
|
+ .eq(!StringUtils.isEmpty(schoolId),"school_id", schoolId)
|
45
|
45
|
.like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
|
46
|
46
|
.eq("status", Constants.STATUS_NORMAL)
|
47
|
47
|
.orderByAsc("sort_no")
|
|
@@ -61,12 +61,13 @@ public class TdSpecialtyController extends BaseController {
|
61
|
61
|
public ResponseBean tdSpecialtyList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
62
|
62
|
@ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
|
63
|
63
|
|
64
|
|
- IPage<TdSpecialty> pg = new Page<>(pageNum, pageSize);
|
65
|
|
- QueryWrapper<TdSpecialty> queryWrapper = new QueryWrapper<>();
|
66
|
|
- queryWrapper.orderByDesc("create_date");
|
|
64
|
+ IPage<TdSpecialty> pg = new Page<>(pageNum, pageSize);
|
|
65
|
+ QueryWrapper<TdSpecialty> queryWrapper = new QueryWrapper<>();
|
|
66
|
+ queryWrapper.gt("status", Constants.STATUS_DELETED);
|
|
67
|
+ queryWrapper.orderByDesc("create_date");
|
67
|
68
|
|
68
|
|
- IPage<TdSpecialty> result = iTdSpecialtyService.page(pg, queryWrapper);
|
69
|
|
- return ResponseBean.success(result);
|
|
69
|
+ IPage<TdSpecialty> result = iTdSpecialtyService.page(pg, queryWrapper);
|
|
70
|
+ return ResponseBean.success(result);
|
70
|
71
|
}
|
71
|
72
|
|
72
|
73
|
/**
|
|
@@ -145,7 +146,13 @@ public class TdSpecialtyController extends BaseController {
|
145
|
146
|
@RequestMapping(value="/admin/specialty/{id}", method= RequestMethod.DELETE)
|
146
|
147
|
@ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
147
|
148
|
public ResponseBean specialtyDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
148
|
|
- if(iTdSpecialtyService.removeById(id)){
|
|
149
|
+ TdSpecialty tdSpecialty = iTdSpecialtyService.getById(id);
|
|
150
|
+ if (null == tdSpecialty || Constants.STATUS_DELETED.equals(tdSpecialty.getStatus())) {
|
|
151
|
+ return ResponseBean.success("success");
|
|
152
|
+ }
|
|
153
|
+
|
|
154
|
+ tdSpecialty.setStatus(Constants.STATUS_DELETED);
|
|
155
|
+ if(iTdSpecialtyService.updateById(tdSpecialty)){
|
149
|
156
|
return ResponseBean.success("success");
|
150
|
157
|
}else {
|
151
|
158
|
return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|