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