提交 | 用户 | 时间
|
e41062
|
1 |
package com.iailab.module.data.ind.item.controller; |
潘 |
2 |
|
2a6f08
|
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.data.ind.item.entity.IndItemEntity; |
|
7 |
import com.iailab.module.data.ind.item.service.IndItemService; |
|
8 |
import com.iailab.module.data.ind.item.vo.IndItemPageReqVO; |
|
9 |
import com.iailab.module.data.ind.item.vo.IndItemRespVO; |
|
10 |
import com.iailab.module.data.ind.item.vo.IndItemSaveReqVO; |
|
11 |
import io.swagger.v3.oas.annotations.Operation; |
|
12 |
import io.swagger.v3.oas.annotations.Parameter; |
e41062
|
13 |
import io.swagger.v3.oas.annotations.tags.Tag; |
2a6f08
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
潘 |
15 |
import org.springframework.security.access.prepost.PreAuthorize; |
e41062
|
16 |
import org.springframework.validation.annotation.Validated; |
2a6f08
|
17 |
import org.springframework.web.bind.annotation.*; |
潘 |
18 |
|
|
19 |
import javax.validation.Valid; |
|
20 |
|
|
21 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
e41062
|
22 |
|
潘 |
23 |
/** |
|
24 |
* @author PanZhibao |
|
25 |
* @Description |
|
26 |
* @createTime 2024年09月11日 |
|
27 |
*/ |
2a6f08
|
28 |
@Tag(name = "数据平台 - 指标项") |
e41062
|
29 |
@RestController |
潘 |
30 |
@RequestMapping("/data/ind-item") |
|
31 |
@Validated |
|
32 |
public class IndItemController { |
2a6f08
|
33 |
@Autowired |
潘 |
34 |
private IndItemService indItemService; |
|
35 |
|
|
36 |
@GetMapping("/page") |
|
37 |
@Operation(summary = "获取指标项列表", description = "用于【指标项】界面") |
|
38 |
@PreAuthorize("@ss.hasPermission('data:ind-item:query')") |
|
39 |
public CommonResult<PageResult<IndItemRespVO>> page(IndItemPageReqVO reqVO) { |
|
40 |
PageResult<IndItemEntity> page = indItemService.page(reqVO); |
|
41 |
return success(BeanUtils.toBean(page, IndItemRespVO.class)); |
|
42 |
} |
|
43 |
|
|
44 |
@PostMapping("/create") |
|
45 |
@Operation(summary = "创建指标项") |
|
46 |
@PreAuthorize("@ss.hasPermission('data:ind-item:create')") |
|
47 |
public CommonResult<Boolean> create(@Valid @RequestBody IndItemSaveReqVO createReqVO) { |
|
48 |
indItemService.create(createReqVO); |
|
49 |
return success(true); |
|
50 |
} |
|
51 |
|
|
52 |
@PutMapping("/update") |
|
53 |
@Operation(summary = "修改指标项") |
|
54 |
@PreAuthorize("@ss.hasPermission('data:ind-item:update')") |
|
55 |
public CommonResult<Boolean> update(@Valid @RequestBody IndItemSaveReqVO updateReqVO) { |
|
56 |
indItemService.update(updateReqVO); |
|
57 |
return success(true); |
|
58 |
} |
|
59 |
|
|
60 |
@DeleteMapping("/delete") |
|
61 |
@Operation(summary = "删除指标项") |
|
62 |
@Parameter(name = "id", description = "指标项编号", required= true, example = "1024") |
|
63 |
@PreAuthorize("@ss.hasPermission('data:ind-item:delete')") |
|
64 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
65 |
indItemService.delete(id); |
|
66 |
return success(true); |
|
67 |
} |
|
68 |
|
|
69 |
@GetMapping("/get") |
|
70 |
@Operation(summary = "获取指标项信息") |
|
71 |
@PreAuthorize("@ss.hasPermission('system:ind-item:query')") |
|
72 |
public CommonResult<IndItemRespVO> get(String id) { |
|
73 |
IndItemEntity entity = indItemService.get(id); |
|
74 |
return success(BeanUtils.toBean(entity, IndItemRespVO.class)); |
|
75 |
} |
e41062
|
76 |
} |