jinlin
2023-12-28 954ad75b793d1c74cd2912ed8eef923bc588674a
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.zt.life.modules.testReviewComment.controller;
 
 
import com.zt.common.annotation.LogOperation;
import com.zt.common.constant.Constant;
import com.zt.common.annotation.QueryParam;
import com.zt.common.db.query.QueryFilter;
import com.zt.common.servlet.Result;
import com.zt.common.servlet.PageResult;
import com.zt.common.validator.AssertUtils;
import com.zt.common.validator.ValidatorUtils;
import com.zt.common.validator.group.AddGroup;
import com.zt.common.validator.group.DefaultGroup;
import com.zt.common.validator.group.UpdateGroup;
import com.zt.life.modules.baselineRelease.dto.BaselineDto;
import com.zt.life.modules.testReviewComment.dto.ReviewCommentDto;
import com.zt.life.modules.testReviewComment.model.TestReviewComment;
import com.zt.life.modules.testReviewComment.service.TestReviewCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
 
/**
 * test_review_comment
 *
 * @author zt generator 
 * @since 1.0.0 2023-12-28
 */
@RestController
@RequestMapping("/testReviewComment/TestReviewComment/")
@Api(tags="test_review_comment")
public class TestReviewCommentController {
    @Autowired
    private TestReviewCommentService testReviewCommentService;
 
    @GetMapping("page")
    @ApiOperation("分页")
    @ApiImplicitParams({
        @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
        @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
        @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING),
        @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING),
        @ApiImplicitParam(name = "code", value = "测试评审编号", dataType = Constant.QT.STRING, format = "a.code^LK"),
        @ApiImplicitParam(name = "softwareName", value = "项目名称", dataType = Constant.QT.STRING, format = "p.software_name^LK"),
        @ApiImplicitParam(name = "pageCode", value = "配置项标识", dataType = Constant.QT.STRING, format = "a.page_code^LK")
})
    public PageResult<TestReviewComment> page(@ApiIgnore @QueryParam QueryFilter queryFilter){
        return PageResult.ok(testReviewCommentService.page(queryFilter));
    }
 
    @GetMapping("getDto")
    @ApiOperation("信息")
    public Result<ReviewCommentDto> getDto(Long commentId, Long projectId, String pageCode) {
        ReviewCommentDto data = testReviewCommentService.getDto(commentId, projectId, pageCode);
        return Result.ok(data);
    }
 
    @PostMapping
    @ApiOperation("新增")
    @LogOperation("新增")
    public Result<Long> insert(@RequestBody ReviewCommentDto reviewCommentDto) {
        //效验数据
        ValidatorUtils.validateEntity(reviewCommentDto, AddGroup.class, DefaultGroup.class);
        Long result = testReviewCommentService.save(reviewCommentDto);
        return Result.ok(result);
    }
 
    @PutMapping
    @ApiOperation("修改")
    @LogOperation("修改")
    public Result<Long> update(@RequestBody ReviewCommentDto reviewCommentDto) {
        //效验数据
        ValidatorUtils.validateEntity(reviewCommentDto, UpdateGroup.class, DefaultGroup.class);
        Long result = testReviewCommentService.save(reviewCommentDto);
        return Result.ok(result);
    }
 
    @DeleteMapping("deleteReviewComment")
    @ApiOperation("删除")
    @LogOperation("删除")
    public Result delete(@RequestBody Long[] ids){
        //效验数据
        AssertUtils.isArrayEmpty(ids, "id");
        testReviewCommentService.delete(ids);
        return Result.ok();
    }
    @GetMapping("exportReviewComment")
    @ApiOperation("打印基线发布书")
    @LogOperation("打印基线发布书")
    public void exportBaseline(Long id, String pageCode, HttpServletRequest request, HttpServletResponse response) {
        testReviewCommentService.exportReviewComment(id,pageCode, request, response);
    }
 
}