package com.iailab.module.model.mpk.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.mpk.entity.PackEntity; import com.iailab.module.model.mpk.service.PackService; import com.iailab.module.model.mpk.vo.PackPageReqVO; 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年11月05日 */ @Tag(name = "模型服务 - MDK包名管理") @RestController @RequestMapping("/model/mpk/pack") public class PackController { @Autowired private PackService packService; @GetMapping("/page") @Operation(summary = "获得分页") public CommonResult> page(@Valid PackPageReqVO reqVO) { PageResult page = packService.page(reqVO); return success(BeanUtils.toBean(page, PackEntity.class)); } @GetMapping("/list") @Operation(summary = "获得列表") public CommonResult> list() { List list = packService.list(); return success(list); } @GetMapping("/get") @Operation(summary = "获得详情") public CommonResult get(@RequestParam("id") String id) { PackEntity data = packService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "创建") public CommonResult save(@Valid @RequestBody PackEntity entity) { packService.create(entity); return success(true); } @PutMapping("/update") @Operation(summary = "更新") public CommonResult update(@Valid @RequestBody PackEntity entity) { packService.update(entity); return success(true); } @DeleteMapping("/delete") public CommonResult delete(@RequestParam("id") String id) { packService.delete(id); return success(true); } }