package com.iailab.module.mcs.controller.admin; import com.iailab.common.annotation.LogOperation; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.util.validation.ValidationUtils; import com.iailab.framework.common.validation.group.DefaultGroup; import com.iailab.framework.common.validation.group.UpdateGroup; import com.iailab.module.mcs.dto.StModelDocDTO; import com.iailab.module.mcs.service.StModelDocService; import io.swagger.v3.oas.annotations.Operation; import javax.annotation.Resource; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/model/mcs/st-model-doc") public class StModelDocController { @Resource private StModelDocService stModelDocService; @GetMapping("{id}") @Operation(summary = "信息") public CommonResult get(@PathVariable("id") String id) { StModelDocDTO data = stModelDocService.get(id); return new CommonResult().setData(data); } @PutMapping @Operation(summary = "修改") @LogOperation("修改") public CommonResult update(@RequestBody StModelDocDTO dto){ //效验数据 ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class); stModelDocService.update(dto); return new CommonResult(); } @PostMapping @Operation(summary = "保存") @LogOperation("保存") @Transactional public CommonResult save(@RequestBody StModelDocDTO dto){ //效验数据 ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class); stModelDocService.save(dto); return new CommonResult(); } }