提交 | 用户 | 时间
|
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; |
5c6007
|
6 |
import com.iailab.framework.common.util.object.BeanUtils; |
7fd198
|
7 |
import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
48c57b
|
8 |
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
L |
9 |
import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
5c6007
|
10 |
import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity; |
48c57b
|
11 |
import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
L |
12 |
import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
7fd198
|
13 |
import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
48c57b
|
14 |
import com.iailab.module.model.mcs.pre.service.MmResultTableService; |
5d299c
|
15 |
import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO; |
L |
16 |
import com.iailab.module.model.mcs.pre.vo.MmPredictItemPageReqVO; |
|
17 |
import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
7fd198
|
18 |
import org.springframework.beans.factory.annotation.Autowired; |
abba54
|
19 |
import org.springframework.security.access.prepost.PreAuthorize; |
5c6007
|
20 |
import org.springframework.validation.annotation.Validated; |
7fd198
|
21 |
import org.springframework.web.bind.annotation.*; |
潘 |
22 |
import org.springframework.web.multipart.MultipartFile; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.List; |
|
26 |
import java.util.Map; |
|
27 |
|
|
28 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
29 |
|
|
30 |
/** |
|
31 |
* @author PanZhibao |
|
32 |
* @date 2021年04月26日 14:42 |
|
33 |
*/ |
|
34 |
@RestController |
abba54
|
35 |
@RequestMapping("/model/pre/predict-item") |
7fd198
|
36 |
public class MmPredictItemController { |
潘 |
37 |
|
|
38 |
@Autowired |
|
39 |
private MmPredictItemService mmPredictItemService; |
|
40 |
|
48c57b
|
41 |
@Autowired |
L |
42 |
private MmItemTypeService mmItemTypeService; |
|
43 |
|
|
44 |
@Autowired |
|
45 |
private MmItemOutputService mmItemOutputService; |
|
46 |
|
|
47 |
@Autowired |
|
48 |
private MmResultTableService mmResultTableService; |
|
49 |
|
7fd198
|
50 |
/** |
潘 |
51 |
* 预测项列表 |
|
52 |
*/ |
|
53 |
@GetMapping("/page") |
905742
|
54 |
@PreAuthorize("@ss.hasPermission('model:pre-item:query')") |
5c6007
|
55 |
public CommonResult<PageResult<MmPredictItemRespVO>> page(@Validated MmPredictItemPageReqVO reqVO) { |
L |
56 |
PageResult<MmPredictItemEntity> page = mmPredictItemService.queryPage(reqVO); |
48c57b
|
57 |
PageResult<MmPredictItemRespVO> result = BeanUtils.toBean(page, MmPredictItemRespVO.class); |
L |
58 |
for (MmPredictItemRespVO item : result.getList()){ |
|
59 |
|
|
60 |
MmItemTypeEntity mmItemTypeEntity = mmItemTypeService.info(item.getItemtypeid()); |
|
61 |
item.setItemtypename(mmItemTypeEntity== null ? "" :mmItemTypeEntity.getItemtypename()); |
|
62 |
|
|
63 |
MmItemOutputEntity mmItemOutputEntity = mmItemOutputService.getByItemid(item.getId()); |
|
64 |
item.setTagname(mmItemOutputEntity== null ? "" :mmItemOutputEntity.getTagname()); |
|
65 |
item.setResulttableid(mmItemOutputEntity== null ? "" :mmItemOutputEntity.getResulttableid()); |
|
66 |
item.setTablename(item == null ? "" : mmResultTableService.info(item.getResulttableid()).getTablename()); |
|
67 |
} |
|
68 |
return success(result); |
7fd198
|
69 |
} |
潘 |
70 |
|
5d299c
|
71 |
@GetMapping("/list") |
48c57b
|
72 |
public CommonResult<List<MmPredictItemEntity>> list() { |
L |
73 |
List<MmPredictItemEntity> list = mmPredictItemService.list(); |
5d299c
|
74 |
|
L |
75 |
return success(list); |
|
76 |
} |
|
77 |
|
7fd198
|
78 |
/** |
潘 |
79 |
* 预测项信息 |
|
80 |
*/ |
d395d2
|
81 |
@GetMapping("/get/{id}") |
905742
|
82 |
@PreAuthorize("@ss.hasPermission('model:pre-item:query')") |
5c6007
|
83 |
public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id){ |
L |
84 |
MmPredictItemDTO predictItem = mmPredictItemService.info(id); |
7fd198
|
85 |
return success(predictItem); |
潘 |
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* 保存预测项 |
|
90 |
*/ |
d395d2
|
91 |
@PostMapping("/create") |
905742
|
92 |
@PreAuthorize("@ss.hasPermission('model:pre-item:create')") |
5c6007
|
93 |
@DSTransactional(rollbackFor= Exception.class) |
5d299c
|
94 |
public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
L |
95 |
mmPredictItemService.add(mmPredictItemDto); |
7fd198
|
96 |
return success(true); |
潘 |
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* 修改预测项 |
|
101 |
*/ |
d395d2
|
102 |
@PutMapping("/update") |
905742
|
103 |
@PreAuthorize("@ss.hasPermission('model:pre-item:update')") |
5c6007
|
104 |
@DSTransactional(rollbackFor= Exception.class) |
5d299c
|
105 |
public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDTO){ |
L |
106 |
mmPredictItemService.update(mmPredictItemDTO); |
7fd198
|
107 |
return success(true); |
潘 |
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* 删除预测项 |
|
112 |
*/ |
d395d2
|
113 |
@DeleteMapping("/delete") |
905742
|
114 |
@PreAuthorize("@ss.hasPermission('model:pre-item:delete')") |
5c6007
|
115 |
@DSTransactional(rollbackFor= Exception.class) |
d395d2
|
116 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
L |
117 |
mmPredictItemService.deleteBatch(new String[]{id}); |
7fd198
|
118 |
return success(true); |
潘 |
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* 预测项列表 |
|
123 |
*/ |
|
124 |
@GetMapping("/count-itemtype") |
|
125 |
public CommonResult<List<CountItemtypeVO>> countItemtype(@RequestParam Map<String, Object> params){ |
|
126 |
List<CountItemtypeVO> list = new ArrayList<>(); |
|
127 |
return success(list); |
|
128 |
} |
|
129 |
|
5c6007
|
130 |
// /** |
L |
131 |
// * 数量 |
|
132 |
// */ |
|
133 |
// @GetMapping("/count") |
|
134 |
// public CommonResult<Long> count() { |
|
135 |
// Long count = mmPredictItemService.count(); |
|
136 |
// return success(count); |
|
137 |
// } |
7fd198
|
138 |
|
潘 |
139 |
/** |
|
140 |
* 上传模型 |
|
141 |
*/ |
|
142 |
@PostMapping("/uploadModel") |
|
143 |
public CommonResult<Boolean> uploadModel(@RequestParam("file") MultipartFile file) throws Exception { |
|
144 |
|
|
145 |
return success(true); |
|
146 |
} |
|
147 |
} |