提交 | 用户 | 时间
|
532d0b
|
1 |
package com.iailab.module.pms.production.work.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.work.enity.ProdAccidentEntity; |
|
7 |
import com.iailab.module.pms.production.work.service.ProdAccidentService; |
|
8 |
import com.iailab.module.pms.production.work.vo.ProdAccidentPageReqVO; |
|
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月05日 15:09:00 |
|
24 |
*/ |
|
25 |
@RestController |
e16f4e
|
26 |
@RequestMapping("/xmcpms/prod/work/prodAccident") |
532d0b
|
27 |
public class ProdAccidentController { |
D |
28 |
|
|
29 |
@Resource |
|
30 |
private ProdAccidentService prodAccidentService; |
|
31 |
|
|
32 |
@PostMapping("/create") |
|
33 |
@Operation(summary = "新增") |
|
34 |
public CommonResult<String> createProdAccident(@Valid @RequestBody ProdAccidentEntity createEntity) { |
|
35 |
return success(prodAccidentService.create(createEntity)); |
|
36 |
} |
|
37 |
|
|
38 |
@PutMapping("/update") |
|
39 |
@Operation(summary = "更新") |
|
40 |
public CommonResult<Boolean> updateProdAccident(@Valid @RequestBody ProdAccidentEntity updateEntity) { |
|
41 |
prodAccidentService.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> deleteProdAccident(@RequestParam("id") String id) { |
|
49 |
prodAccidentService.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<ProdAccidentEntity> getProdAccident(@RequestParam("id") String id) { |
|
57 |
ProdAccidentEntity data = prodAccidentService.getInfo(id); |
|
58 |
return success(BeanUtils.toBean(data, ProdAccidentEntity.class)); |
|
59 |
} |
|
60 |
|
|
61 |
@GetMapping("/page") |
|
62 |
@Operation(summary = "分页") |
|
63 |
public CommonResult<PageResult<ProdAccidentEntity>> getProdAccidentPage(@Valid ProdAccidentPageReqVO pageVO) { |
|
64 |
PageResult<ProdAccidentEntity> pageResult = prodAccidentService.getPage(pageVO); |
|
65 |
return success(BeanUtils.toBean(pageResult, ProdAccidentEntity.class)); |
|
66 |
} |
|
67 |
} |