提交 | 用户 | 时间
|
532d0b
|
1 |
package com.iailab.module.pms.production.device.controller.admin; |
D |
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.pms.production.device.entity.RunTimeEntity; |
|
7 |
import com.iailab.module.pms.production.device.service.RunTimeService; |
|
8 |
import com.iailab.module.pms.production.device.vo.RunTimePageReqVO; |
|
9 |
import io.swagger.v3.oas.annotations.Operation; |
|
10 |
import io.swagger.v3.oas.annotations.Parameter; |
|
11 |
import org.springframework.web.bind.annotation.*; |
|
12 |
|
|
13 |
import javax.annotation.Resource; |
|
14 |
import javax.validation.Valid; |
|
15 |
|
|
16 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
17 |
|
|
18 |
/** |
|
19 |
* 运行时长统计 |
|
20 |
* |
|
21 |
* @author DongYukun |
|
22 |
* @Description |
|
23 |
* @createTime 2023年01月10日 11:15:00 |
|
24 |
*/ |
|
25 |
@RestController |
e16f4e
|
26 |
@RequestMapping("/xmcpms/prod/device/runTime") |
532d0b
|
27 |
public class RunTimeController { |
D |
28 |
|
|
29 |
@Resource |
|
30 |
private RunTimeService runTimeService; |
|
31 |
|
|
32 |
@PostMapping("/create") |
|
33 |
@Operation(summary = "新增") |
|
34 |
public CommonResult<String> createRunTime(@Valid @RequestBody RunTimeEntity createEntity) { |
|
35 |
return success(runTimeService.create(createEntity)); |
|
36 |
} |
|
37 |
|
|
38 |
@PutMapping("/update") |
|
39 |
@Operation(summary = "更新") |
|
40 |
public CommonResult<Boolean> updateRunTime(@Valid @RequestBody RunTimeEntity updateEntity) { |
|
41 |
runTimeService.update(updateEntity); |
|
42 |
return success(true); |
|
43 |
} |
|
44 |
|
|
45 |
@DeleteMapping("/delete") |
|
46 |
@Operation(summary = "删除") |
|
47 |
@Parameter(name = "id", description = "ID", required = true, example = "1024") |
|
48 |
public CommonResult<Boolean> deleteRunTime(@RequestParam("id") String id) { |
|
49 |
runTimeService.delete(id); |
|
50 |
return success(true); |
|
51 |
} |
|
52 |
|
|
53 |
@GetMapping("/get") |
|
54 |
@Operation(summary = "详情") |
|
55 |
@Parameter(name = "id", description = "ID", required = true, example = "1024") |
|
56 |
public CommonResult<RunTimeEntity> getRunTime(@RequestParam("id") String id) { |
|
57 |
RunTimeEntity data = runTimeService.getInfo(id); |
|
58 |
return success(BeanUtils.toBean(data, RunTimeEntity.class)); |
|
59 |
} |
|
60 |
|
|
61 |
@GetMapping("/page") |
|
62 |
@Operation(summary = "分页") |
|
63 |
public CommonResult<PageResult<RunTimeEntity>> getRunTimePage(@Valid RunTimePageReqVO pageVO) { |
|
64 |
PageResult<RunTimeEntity> pageResult = runTimeService.getPage(pageVO); |
|
65 |
return success(BeanUtils.toBean(pageResult, RunTimeEntity.class)); |
|
66 |
} |
|
67 |
} |