package com.iailab.module.data.plan.data.controller.admin; 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.plan.data.entity.PlanDataSetEntity; import com.iailab.module.data.plan.data.service.PlanDataSetService; import com.iailab.module.data.plan.data.vo.PlanDataSetPageReqVO; import com.iailab.module.data.plan.data.vo.PlanDataSetRespVO; import com.iailab.module.data.plan.data.vo.PlanDataSetSaveReqVO; 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.*; import javax.validation.Valid; import java.util.List; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年11月01日 */ @Tag(name = "数据平台 - 计划数据集") @RestController @RequestMapping("/data/plan/data-set") @Validated public class PlanDataSetController { @Autowired private PlanDataSetService indDataSetService; @GetMapping("/page") @Operation(summary = "获取计划数据集列表", description = "用于【计划数据集】界面") @PreAuthorize("@ss.hasPermission('data:plan-data-set:query')") public CommonResult> page(PlanDataSetPageReqVO reqVO) { PageResult page = indDataSetService.page(reqVO); return success(BeanUtils.toBean(page, PlanDataSetRespVO.class)); } @PostMapping("/create") @Operation(summary = "创建计划数据集") @PreAuthorize("@ss.hasPermission('data:plan-data-set:create')") public CommonResult create(@Valid @RequestBody PlanDataSetSaveReqVO createReqVO) { indDataSetService.create(createReqVO); return success(true); } @PutMapping("/update") @Operation(summary = "修改计划数据集") @PreAuthorize("@ss.hasPermission('data:plan-data-set:update')") public CommonResult update(@Valid @RequestBody PlanDataSetSaveReqVO updateReqVO) { indDataSetService.update(updateReqVO); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除计划数据集") @Parameter(name = "id", description = "计划数据集编号", required= true, example = "1024") @PreAuthorize("@ss.hasPermission('data:plan-data-set:delete')") public CommonResult delete(@RequestParam("id") String id) { indDataSetService.delete(id); return success(true); } @GetMapping("/get") @Operation(summary = "获取计划数据集信息") @PreAuthorize("@ss.hasPermission('data:plan-data-set:query')") public CommonResult get(String id) { PlanDataSetEntity entity = indDataSetService.get(id); return success(BeanUtils.toBean(entity, PlanDataSetRespVO.class)); } @GetMapping("/list-all-simple") @Operation(summary = "获取计划数据集列表", description = "用于【计划数据集】界面") @PreAuthorize("@ss.hasPermission('data:plan-data-set:query')") public CommonResult> list(PlanDataSetPageReqVO reqVO) { List list = indDataSetService.list(reqVO); return success(BeanUtils.toBean(list, PlanDataSetRespVO.class)); } }