houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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<StModelDocDTO> get(@PathVariable("id") String id) {
        StModelDocDTO data = stModelDocService.get(id);
 
        return new CommonResult<StModelDocDTO>().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();
    }
}