From 19ef4ca4f7252c34fe2e2a03b8868fc997ddd86f Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期五, 13 九月 2024 08:37:38 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/controller/IndItemController.java | 64 ++++++++++++++++++++++++++++++- 1 files changed, 61 insertions(+), 3 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/controller/IndItemController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/controller/IndItemController.java index 8a38f21..dbe122c 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/controller/IndItemController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/controller/IndItemController.java @@ -1,18 +1,76 @@ package com.iailab.module.data.ind.item.controller; +import com.iailab.framework.common.pojo.CommonResult; +import com.iailab.framework.common.pojo.PageResult; +import com.iailab.framework.common.util.object.BeanUtils; +import com.iailab.module.data.ind.item.entity.IndItemEntity; +import com.iailab.module.data.ind.item.service.IndItemService; +import com.iailab.module.data.ind.item.vo.IndItemPageReqVO; +import com.iailab.module.data.ind.item.vo.IndItemRespVO; +import com.iailab.module.data.ind.item.vo.IndItemSaveReqVO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ -@Tag(name = "数据平台 - 指标定义") +@Tag(name = "数据平台 - 指标项") @RestController @RequestMapping("/data/ind-item") @Validated public class IndItemController { + @Autowired + private IndItemService indItemService; + + @GetMapping("/page") + @Operation(summary = "获取指标项列表", description = "用于【指标项】界面") + @PreAuthorize("@ss.hasPermission('data:ind-item:query')") + public CommonResult<PageResult<IndItemRespVO>> page(IndItemPageReqVO reqVO) { + PageResult<IndItemEntity> page = indItemService.page(reqVO); + return success(BeanUtils.toBean(page, IndItemRespVO.class)); + } + + @PostMapping("/create") + @Operation(summary = "创建指标项") + @PreAuthorize("@ss.hasPermission('data:ind-item:create')") + public CommonResult<Boolean> create(@Valid @RequestBody IndItemSaveReqVO createReqVO) { + indItemService.create(createReqVO); + return success(true); + } + + @PutMapping("/update") + @Operation(summary = "修改指标项") + @PreAuthorize("@ss.hasPermission('data:ind-item:update')") + public CommonResult<Boolean> update(@Valid @RequestBody IndItemSaveReqVO updateReqVO) { + indItemService.update(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除指标项") + @Parameter(name = "id", description = "指标项编号", required= true, example = "1024") + @PreAuthorize("@ss.hasPermission('data:ind-item:delete')") + public CommonResult<Boolean> delete(@RequestParam("id") String id) { + indItemService.delete(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获取指标项信息") + @PreAuthorize("@ss.hasPermission('system:ind-item:query')") + public CommonResult<IndItemRespVO> get(String id) { + IndItemEntity entity = indItemService.get(id); + return success(BeanUtils.toBean(entity, IndItemRespVO.class)); + } } \ No newline at end of file -- Gitblit v1.9.3