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.FileGroupDTO;
|
import com.iailab.module.model.mpk.entity.FileGroupEntity;
|
import com.iailab.module.model.mpk.service.FileGroupService;
|
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/group")
|
public class FileGroupController {
|
@Autowired
|
private FileGroupService fileGroupService;
|
|
@GetMapping("/list")
|
@Operation(summary = "获得列表")
|
public CommonResult<List<FileGroupDTO>> list(@RequestParam("menuId") String menuId) {
|
List<FileGroupDTO> list = fileGroupService.list(menuId);
|
return success(list);
|
}
|
|
@GetMapping("/get")
|
@Operation(summary = "获取详情")
|
public CommonResult<FileGroupDTO> get(@RequestParam("id") String id) {
|
FileGroupDTO data = ConvertUtils.sourceToTarget(fileGroupService.get(id), FileGroupDTO.class);
|
return success(data);
|
}
|
|
@PostMapping("/create")
|
public CommonResult<Boolean> create(@Valid @RequestBody FileGroupEntity entity) {
|
fileGroupService.create(entity);
|
return success(true);
|
}
|
|
@PutMapping("/update")
|
public CommonResult<Boolean> update(@Valid @RequestBody FileGroupEntity entity) {
|
fileGroupService.update(entity);
|
return success(true);
|
}
|
|
@DeleteMapping("/delete")
|
public CommonResult<Boolean> delete(@RequestParam("id") String id) {
|
fileGroupService.deleteById(id);
|
return success(true);
|
}
|
|
}
|