提交 | 用户 | 时间
|
c06f48
|
1 |
package com.iailab.module.model.mcs.pre.controller.admin; |
7fd198
|
2 |
|
5c6007
|
3 |
import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
7fd198
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
潘 |
5 |
import com.iailab.framework.common.pojo.PageResult; |
|
6 |
import com.iailab.framework.common.util.object.BeanUtils; |
5c6007
|
7 |
import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
7fd198
|
8 |
import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
潘 |
9 |
import com.iailab.module.model.mcs.pre.service.MmResultTableService; |
|
10 |
import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO; |
|
11 |
import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
5c6007
|
12 |
import com.iailab.module.model.mcs.pre.vo.MmResultTableRespVO; |
L |
13 |
import io.swagger.v3.oas.annotations.Operation; |
7fd198
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
abba54
|
15 |
import org.springframework.security.access.prepost.PreAuthorize; |
7fd198
|
16 |
import org.springframework.validation.annotation.Validated; |
潘 |
17 |
import org.springframework.web.bind.annotation.*; |
5c6007
|
18 |
|
L |
19 |
import javax.validation.Valid; |
|
20 |
import java.util.List; |
|
21 |
import java.util.Map; |
7fd198
|
22 |
|
潘 |
23 |
import static com.iailab.framework.common.pojo.CommonResult.error; |
|
24 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author PanZhibao |
|
28 |
* @date 2021年04月22日 9:57 |
|
29 |
*/ |
|
30 |
@RestController |
abba54
|
31 |
@RequestMapping("/model/pre/result-table") |
7fd198
|
32 |
public class MmResultTableController { |
潘 |
33 |
|
|
34 |
@Autowired |
|
35 |
private MmResultTableService mmResultTableService; |
|
36 |
|
|
37 |
/** |
|
38 |
* 结果存放列表 |
|
39 |
*/ |
|
40 |
@GetMapping("/page") |
5c6007
|
41 |
public CommonResult<PageResult<MmResultTableRespVO>> page(@Validated MmResultTablePageReqVO reqVO) { |
7fd198
|
42 |
PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO); |
潘 |
43 |
|
5c6007
|
44 |
return success(BeanUtils.toBean(page, MmResultTableRespVO.class)); |
L |
45 |
} |
|
46 |
|
|
47 |
|
|
48 |
@GetMapping("/list") |
|
49 |
public CommonResult<List<MmResultTableEntity>> list(@Valid @RequestParam Map<String, Object> params) { |
|
50 |
List<MmResultTableEntity> list = mmResultTableService.list(params); |
|
51 |
return success(list); |
7fd198
|
52 |
} |
潘 |
53 |
|
d395d2
|
54 |
@GetMapping("/get/{id}") |
abba54
|
55 |
@PreAuthorize("@ss.hasPermission('model:pre-result:query')") |
7fd198
|
56 |
public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){ |
5c6007
|
57 |
MmResultTableEntity resultTable = mmResultTableService.info(id); |
7fd198
|
58 |
|
潘 |
59 |
return success(resultTable); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* 保存结果存放 |
|
64 |
*/ |
d395d2
|
65 |
@PostMapping("/create") |
abba54
|
66 |
@PreAuthorize("@ss.hasPermission('model:pre-result:create')") |
5c6007
|
67 |
@DSTransactional(rollbackFor= Exception.class) |
7fd198
|
68 |
public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){ |
潘 |
69 |
int count = mmResultTableService.check(resultTable); |
|
70 |
if (count > 0) { |
|
71 |
return error(999,"名称重复"); |
|
72 |
} |
|
73 |
mmResultTableService.saveResultTable(resultTable); |
|
74 |
return success(true); |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* 修改结果存放 |
|
79 |
*/ |
d395d2
|
80 |
@PutMapping("/update") |
abba54
|
81 |
@PreAuthorize("@ss.hasPermission('model:pre-result:update')") |
5c6007
|
82 |
@DSTransactional(rollbackFor= Exception.class) |
7fd198
|
83 |
public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){ |
潘 |
84 |
int count = mmResultTableService.check(resultTable); |
|
85 |
if (count > 0) { |
|
86 |
return error(999,"名称重复"); |
|
87 |
} |
|
88 |
mmResultTableService.update(resultTable); |
|
89 |
return success(true); |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* 删除结果存放 |
|
94 |
*/ |
d395d2
|
95 |
@DeleteMapping("/delete") |
abba54
|
96 |
@PreAuthorize("@ss.hasPermission('model:pre-result:delete')") |
5c6007
|
97 |
@DSTransactional(rollbackFor= Exception.class) |
d395d2
|
98 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
L |
99 |
mmResultTableService.deleteBatch(new String[]{id}); |
7fd198
|
100 |
return success(true); |
潘 |
101 |
} |
|
102 |
} |