提交 | 用户 | 时间
|
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.MmItemTypeEntity; |
|
7 |
import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
|
8 |
import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO; |
|
9 |
import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO; |
|
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/item-type") |
|
23 |
public class MmItemTypeController { |
|
24 |
|
|
25 |
@Autowired |
|
26 |
private MmItemTypeService mmItemTypeService; |
|
27 |
|
|
28 |
/** |
|
29 |
* 预测项类型列表 |
|
30 |
*/ |
|
31 |
@GetMapping("/page") |
|
32 |
public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmItemTypePageReqVO reqVO) { |
|
33 |
PageResult<MmItemTypeEntity> page = mmItemTypeService.page(reqVO); |
|
34 |
|
|
35 |
return success(BeanUtils.toBean(page, MmItemTypeRespVO.class)); |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* 预测项类型信息 |
|
40 |
*/ |
d395d2
|
41 |
@GetMapping("/get/{id}") |
7fd198
|
42 |
public CommonResult<MmItemTypeEntity> info(@PathVariable("id") String id) { |
潘 |
43 |
MmItemTypeEntity itemType = mmItemTypeService.selectById(id); |
|
44 |
|
|
45 |
return success(itemType); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* 保存预测项类型 |
|
50 |
*/ |
|
51 |
@PostMapping("/create") |
|
52 |
public CommonResult<Boolean> save(@RequestBody MmItemTypeEntity itemType) { |
|
53 |
int count = mmItemTypeService.check(itemType); |
|
54 |
if (count > 0) { |
|
55 |
return error(999,"名称重复"); |
|
56 |
} |
|
57 |
mmItemTypeService.saveItemType(itemType); |
|
58 |
return success(true); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* 修改预测项类型 |
|
63 |
*/ |
|
64 |
@PutMapping("/update") |
|
65 |
public CommonResult<Boolean> update(@RequestBody MmItemTypeEntity itemType) { |
|
66 |
int count = mmItemTypeService.check(itemType); |
|
67 |
if (count > 0) { |
|
68 |
return error(999,"名称重复"); |
|
69 |
} |
|
70 |
mmItemTypeService.update(itemType); |
|
71 |
return success(true); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* 删除预测项类型 |
|
76 |
*/ |
|
77 |
@DeleteMapping("/delete") |
|
78 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
79 |
mmItemTypeService.deleteBatch(new String[]{id}); |
|
80 |
return success(true); |
|
81 |
} |
|
82 |
} |