From 1373561069f7e19383dbc178c19787c4b3f0df3b Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 26 九月 2024 10:37:36 +0800 Subject: [PATCH] MDK 上传 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java | 43 +++++++++++++++++++++++++++++++++---------- 1 files changed, 33 insertions(+), 10 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java index ac0803e..55f0017 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java @@ -1,15 +1,24 @@ package com.iailab.module.model.mcs.pre.controller.admin; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; 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.DmModuleEntity; import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; import com.iailab.module.model.mcs.pre.service.MmResultTableService; import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO; import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; +import com.iailab.module.model.mcs.pre.vo.MmResultTableRespVO; +import io.swagger.v3.oas.annotations.Operation; 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 java.util.Map; import static com.iailab.framework.common.pojo.CommonResult.error; import static com.iailab.framework.common.pojo.CommonResult.success; @@ -19,7 +28,7 @@ * @date 2021年04月22日 9:57 */ @RestController -@RequestMapping("/pre/result-table") +@RequestMapping("/model/pre/result-table") public class MmResultTableController { @Autowired @@ -29,15 +38,23 @@ * 结果存放列表 */ @GetMapping("/page") - public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmResultTablePageReqVO reqVO) { + public CommonResult<PageResult<MmResultTableRespVO>> page(@Validated MmResultTablePageReqVO reqVO) { PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO); - return success(BeanUtils.toBean(page, MmItemTypeRespVO.class)); + return success(BeanUtils.toBean(page, MmResultTableRespVO.class)); } - @GetMapping("/info/{id}") + + @GetMapping("/list") + public CommonResult<List<MmResultTableEntity>> list(@Valid @RequestParam Map<String, Object> params) { + List<MmResultTableEntity> list = mmResultTableService.list(params); + return success(list); + } + + @GetMapping("/get/{id}") + @PreAuthorize("@ss.hasPermission('model:pre-result:query')") public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){ - MmResultTableEntity resultTable = mmResultTableService.selectById(id); + MmResultTableEntity resultTable = mmResultTableService.info(id); return success(resultTable); } @@ -45,7 +62,9 @@ /** * 保存结果存放 */ - @PostMapping + @PostMapping("/create") + @PreAuthorize("@ss.hasPermission('model:pre-result:create')") + @DSTransactional(rollbackFor= Exception.class) public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){ int count = mmResultTableService.check(resultTable); if (count > 0) { @@ -58,7 +77,9 @@ /** * 修改结果存放 */ - @PutMapping + @PutMapping("/update") + @PreAuthorize("@ss.hasPermission('model:pre-result:update')") + @DSTransactional(rollbackFor= Exception.class) public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){ int count = mmResultTableService.check(resultTable); if (count > 0) { @@ -71,9 +92,11 @@ /** * 删除结果存放 */ - @DeleteMapping("{id}") - public CommonResult<Boolean> delete(@RequestBody String[] ids){ - mmResultTableService.deleteBatch(ids); + @DeleteMapping("/delete") + @PreAuthorize("@ss.hasPermission('model:pre-result:delete')") + @DSTransactional(rollbackFor= Exception.class) + public CommonResult<Boolean> delete(@RequestParam("id") String id) { + mmResultTableService.deleteBatch(new String[]{id}); return success(true); } } -- Gitblit v1.9.3