提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mcs.sche.controller; |
潘 |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.framework.common.pojo.PageResult; |
|
5 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
6 |
import com.iailab.module.model.mcs.sche.entity.StScheduleObjectEntity; |
|
7 |
import com.iailab.module.model.mcs.sche.service.StScheduleObjectService; |
|
8 |
import com.iailab.module.model.mcs.sche.vo.StScheduleObjectPageReqVO; |
|
9 |
import com.iailab.module.model.mcs.sche.vo.StScheduleObjectRespVO; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.validation.annotation.Validated; |
|
12 |
import org.springframework.web.bind.annotation.*; |
|
13 |
|
|
14 |
import static com.iailab.framework.common.pojo.CommonResult.error; |
|
15 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
16 |
|
|
17 |
/** |
|
18 |
* @author PanZhibao |
|
19 |
* @date 2021年07月21日 8:50 |
|
20 |
*/ |
|
21 |
@RestController |
|
22 |
@RequestMapping("/sche/schedule-object") |
|
23 |
public class StScheduleObjectController { |
|
24 |
@Autowired |
|
25 |
private StScheduleObjectService stScheduleObjectService; |
|
26 |
|
|
27 |
/** |
|
28 |
* 调度对象类型列表 |
|
29 |
*/ |
|
30 |
@GetMapping("/page") |
|
31 |
public CommonResult<PageResult<StScheduleObjectRespVO>> page(@Validated StScheduleObjectPageReqVO reqVO) { |
|
32 |
PageResult<StScheduleObjectEntity> page = stScheduleObjectService.page(reqVO); |
|
33 |
|
|
34 |
return success(BeanUtils.toBean(page, StScheduleObjectRespVO.class)); |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* 调度对象类型信息 |
|
39 |
*/ |
|
40 |
@GetMapping("/info/{id}") |
|
41 |
public CommonResult<StScheduleObjectEntity> info(@PathVariable("id") String id) { |
|
42 |
StScheduleObjectEntity scheduleObject = stScheduleObjectService.selectById(id); |
|
43 |
return success(scheduleObject); |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* 保存调度对象类型 |
|
48 |
*/ |
|
49 |
@PostMapping("/create") |
|
50 |
public CommonResult<Boolean> save(@RequestBody StScheduleObjectEntity scheduleObject) { |
|
51 |
int count = stScheduleObjectService.check(scheduleObject); |
|
52 |
if (count > 0) { |
|
53 |
return error(999, "名称或编号重复"); |
|
54 |
} |
|
55 |
stScheduleObjectService.saveStScheduleObject(scheduleObject); |
|
56 |
return success(true); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* 修改调度对象类型 |
|
61 |
*/ |
|
62 |
@PutMapping("/update") |
|
63 |
public CommonResult<Boolean> update(@RequestBody StScheduleObjectEntity scheduleObject) { |
|
64 |
int count = stScheduleObjectService.check(scheduleObject); |
|
65 |
if (count > 0) { |
|
66 |
return error(999, "名称或编号重复"); |
|
67 |
} |
|
68 |
stScheduleObjectService.update(scheduleObject); |
|
69 |
return success(true); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* 删除调度对象类型 |
|
74 |
*/ |
|
75 |
@DeleteMapping("/delete") |
|
76 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
77 |
stScheduleObjectService.deleteBatch(new String[]{id}); |
|
78 |
return success(true); |
|
79 |
} |
|
80 |
} |