package com.iailab.module.model.mcs.pre.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.model.mcs.pre.entity.MmItemAccuracyRateEntity; import com.iailab.module.model.mcs.pre.service.MmItemAccuracyRateService; import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyRatePageReqVO; import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyRateRespVO; import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyRateSaveReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author lirm * @Description * @createTime 2024年11月25日 */ @RestController @RequestMapping("/model/item/accuracy-rate") public class MmItemAccuracyRateController { @Autowired private MmItemAccuracyRateService mmItemAccuracyRateService; @PostMapping("/create") @Operation(summary = "创建预测精准度配置") @PreAuthorize("@ss.hasPermission('item:accuracy-rate:create')") public CommonResult create(@Valid @RequestBody MmItemAccuracyRateSaveReqVO createReqVO) { mmItemAccuracyRateService.create(createReqVO); return success(true); } @PutMapping("/update") @Operation(summary = "更新预测精准度配置") @PreAuthorize("@ss.hasPermission('item:accuracy-rate:update')") public CommonResult update(@Valid @RequestBody MmItemAccuracyRateSaveReqVO updateReqVO) { mmItemAccuracyRateService.update(updateReqVO); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除预测精准度配置") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('item:accuracy-rate:delete')") public CommonResult deleteTenant(@RequestParam("id") String id) { mmItemAccuracyRateService.delete(id); return success(true); } @GetMapping("/get/{id}") @Operation(summary = "获得预测精准度配置") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('item:accuracy-rate:query')") public CommonResult getInfo(@PathVariable("id") String id) { MmItemAccuracyRateEntity entity = mmItemAccuracyRateService.getInfo(id); return success(BeanUtils.toBean(entity, MmItemAccuracyRateRespVO.class)); } @GetMapping("/page") @Operation(summary = "获得预测精准度配置分页") @PreAuthorize("@ss.hasPermission('item:accuracy-rate:query')") public CommonResult> getTenantPage(@Valid MmItemAccuracyRatePageReqVO pageVO) { PageResult pageResult = mmItemAccuracyRateService.page(pageVO); return success(BeanUtils.toBean(pageResult, MmItemAccuracyRateRespVO.class)); } }