提交 | 用户 | 时间
|
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; |
abba54
|
11 |
import org.springframework.security.access.prepost.PreAuthorize; |
7fd198
|
12 |
import org.springframework.validation.annotation.Validated; |
潘 |
13 |
import org.springframework.web.bind.annotation.*; |
|
14 |
|
|
15 |
import static com.iailab.framework.common.pojo.CommonResult.error; |
|
16 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author PanZhibao |
|
20 |
* @date 2021年04月22日 9:57 |
|
21 |
*/ |
|
22 |
@RestController |
abba54
|
23 |
@RequestMapping("/model/pre/result-table") |
7fd198
|
24 |
public class MmResultTableController { |
潘 |
25 |
|
|
26 |
@Autowired |
|
27 |
private MmResultTableService mmResultTableService; |
|
28 |
|
|
29 |
/** |
|
30 |
* 结果存放列表 |
|
31 |
*/ |
|
32 |
@GetMapping("/page") |
abba54
|
33 |
@PreAuthorize("@ss.hasPermission('model:pre-result:query')") |
7fd198
|
34 |
public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmResultTablePageReqVO reqVO) { |
潘 |
35 |
PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO); |
|
36 |
|
|
37 |
return success(BeanUtils.toBean(page, MmItemTypeRespVO.class)); |
|
38 |
} |
|
39 |
|
d395d2
|
40 |
@GetMapping("/get/{id}") |
abba54
|
41 |
@PreAuthorize("@ss.hasPermission('model:pre-result:query')") |
7fd198
|
42 |
public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){ |
潘 |
43 |
MmResultTableEntity resultTable = mmResultTableService.selectById(id); |
|
44 |
|
|
45 |
return success(resultTable); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* 保存结果存放 |
|
50 |
*/ |
d395d2
|
51 |
@PostMapping("/create") |
abba54
|
52 |
@PreAuthorize("@ss.hasPermission('model:pre-result:create')") |
7fd198
|
53 |
public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){ |
潘 |
54 |
int count = mmResultTableService.check(resultTable); |
|
55 |
if (count > 0) { |
|
56 |
return error(999,"名称重复"); |
|
57 |
} |
|
58 |
mmResultTableService.saveResultTable(resultTable); |
|
59 |
return success(true); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* 修改结果存放 |
|
64 |
*/ |
d395d2
|
65 |
@PutMapping("/update") |
abba54
|
66 |
@PreAuthorize("@ss.hasPermission('model:pre-result:update')") |
7fd198
|
67 |
public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){ |
潘 |
68 |
int count = mmResultTableService.check(resultTable); |
|
69 |
if (count > 0) { |
|
70 |
return error(999,"名称重复"); |
|
71 |
} |
|
72 |
mmResultTableService.update(resultTable); |
|
73 |
return success(true); |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* 删除结果存放 |
|
78 |
*/ |
d395d2
|
79 |
@DeleteMapping("/delete") |
abba54
|
80 |
@PreAuthorize("@ss.hasPermission('model:pre-result:delete')") |
d395d2
|
81 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
L |
82 |
mmResultTableService.deleteBatch(new String[]{id}); |
7fd198
|
83 |
return success(true); |
潘 |
84 |
} |
|
85 |
} |