package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dto.FileMenuDTO; import com.iailab.module.model.mpk.entity.FileMenuEntity; import com.iailab.module.model.mpk.service.FileMenuService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; 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年09月22日 */ @Tag(name = "模型服务 - 模型文件菜单管理") @RestController @RequestMapping("/model/mpk/menu") public class FileMenuController { @Autowired private FileMenuService fileMenuService; @GetMapping("/list") @Operation(summary = "获得列表") public CommonResult> list() { List list = fileMenuService.list(); return success(list); } @GetMapping("/get") @Operation(summary = "获取详情") public CommonResult get(@RequestParam("id") String id) { FileMenuEntity data = fileMenuService.get(id); return success(ConvertUtils.sourceToTarget(data, FileMenuDTO.class)); } @PostMapping("/create") public CommonResult create(@Valid @RequestBody FileMenuEntity entity) { fileMenuService.create(entity); return success(true); } @PostMapping("/update") public CommonResult update(@Valid @RequestBody FileMenuEntity entity) { fileMenuService.update(entity); return success(true); } @DeleteMapping("/delete") public CommonResult delete(@RequestParam("id") String id) { fileMenuService.deleteById(id); return success(true); } }