liriming
2024-09-23 5c60072c51928a5c8a0732191b1df17a88c68b99
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemTypeController.java
@@ -1,8 +1,10 @@
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.MmItemTypeEntity;
import com.iailab.module.model.mcs.pre.service.MmItemTypeService;
import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO;
@@ -11,6 +13,9 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
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;
@@ -37,13 +42,21 @@
        return success(BeanUtils.toBean(page, MmItemTypeRespVO.class));
    }
    @GetMapping("/list")
    @PreAuthorize("@ss.hasPermission('model:pre-item:query')")
    public CommonResult<List<MmItemTypeEntity>> list(@RequestParam Map<String, Object> params) {
        List<MmItemTypeEntity> list = mmItemTypeService.list(params);
        return success(list);
    }
    /**
     * 预测项类型信息
     */
    @GetMapping("/get/{id}")
    @PreAuthorize("@ss.hasPermission('model:pre-item:query')")
    public CommonResult<MmItemTypeEntity> info(@PathVariable("id") String id) {
        MmItemTypeEntity itemType = mmItemTypeService.selectById(id);
        MmItemTypeEntity itemType = mmItemTypeService.info(id);
        return success(itemType);
    }
@@ -53,6 +66,7 @@
     */
    @PostMapping("/create")
    @PreAuthorize("@ss.hasPermission('model:pre-item:create')")
    @DSTransactional(rollbackFor= Exception.class)
    public CommonResult<Boolean> save(@RequestBody MmItemTypeEntity itemType) {
        int count = mmItemTypeService.check(itemType);
        if (count > 0) {
@@ -67,6 +81,7 @@
     */
    @PutMapping("/update")
    @PreAuthorize("@ss.hasPermission('model:pre-item:update')")
    @DSTransactional(rollbackFor= Exception.class)
    public CommonResult<Boolean> update(@RequestBody MmItemTypeEntity itemType) {
        int count = mmItemTypeService.check(itemType);
        if (count > 0) {
@@ -81,6 +96,7 @@
     */
    @DeleteMapping("/delete")
    @PreAuthorize("@ss.hasPermission('model:pre-item:delete')")
    @DSTransactional(rollbackFor= Exception.class)
    public CommonResult<Boolean> delete(@RequestParam("id") String id) {
        mmItemTypeService.deleteBatch(new String[]{id});
        return success(true);