提交 | 用户 | 时间
|
c06f48
|
1 |
package com.iailab.module.model.mcs.pre.controller.admin; |
7fd198
|
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.pre.entity.MmResultTableEntity; |
|
7 |
import com.iailab.module.model.mcs.pre.service.MmResultTableService; |
|
8 |
import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO; |
|
9 |
import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
|
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年04月22日 9:57 |
|
20 |
*/ |
|
21 |
@RestController |
|
22 |
@RequestMapping("/pre/result-table") |
|
23 |
public class MmResultTableController { |
|
24 |
|
|
25 |
@Autowired |
|
26 |
private MmResultTableService mmResultTableService; |
|
27 |
|
|
28 |
/** |
|
29 |
* 结果存放列表 |
|
30 |
*/ |
|
31 |
@GetMapping("/page") |
|
32 |
public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmResultTablePageReqVO reqVO) { |
|
33 |
PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO); |
|
34 |
|
|
35 |
return success(BeanUtils.toBean(page, MmItemTypeRespVO.class)); |
|
36 |
} |
|
37 |
|
d395d2
|
38 |
@GetMapping("/get/{id}") |
7fd198
|
39 |
public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){ |
潘 |
40 |
MmResultTableEntity resultTable = mmResultTableService.selectById(id); |
|
41 |
|
|
42 |
return success(resultTable); |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* 保存结果存放 |
|
47 |
*/ |
d395d2
|
48 |
@PostMapping("/create") |
7fd198
|
49 |
public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){ |
潘 |
50 |
int count = mmResultTableService.check(resultTable); |
|
51 |
if (count > 0) { |
|
52 |
return error(999,"名称重复"); |
|
53 |
} |
|
54 |
mmResultTableService.saveResultTable(resultTable); |
|
55 |
return success(true); |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* 修改结果存放 |
|
60 |
*/ |
d395d2
|
61 |
@PutMapping("/update") |
7fd198
|
62 |
public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){ |
潘 |
63 |
int count = mmResultTableService.check(resultTable); |
|
64 |
if (count > 0) { |
|
65 |
return error(999,"名称重复"); |
|
66 |
} |
|
67 |
mmResultTableService.update(resultTable); |
|
68 |
return success(true); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* 删除结果存放 |
|
73 |
*/ |
d395d2
|
74 |
@DeleteMapping("/delete") |
L |
75 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
76 |
mmResultTableService.deleteBatch(new String[]{id}); |
7fd198
|
77 |
return success(true); |
潘 |
78 |
} |
|
79 |
} |