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 com.zt.life.sys.dto.OssDto; import com.zt.life.sys.service.SysOssConfigService; 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; @Autowired private SysOssConfigService sysOssConfigService; @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 = "softwareIdentity", value = "项目标识", dataType = Constant.QT.STRING, format = "p.software_identity^LK"), @ApiImplicitParam(name = "pageCode", value = "配置项标识", dataType = Constant.QT.STRING, format = "a.page_code^LK") }) public PageResult page(@ApiIgnore @QueryParam QueryFilter queryFilter){ return PageResult.ok(testReviewCommentService.page(queryFilter)); } @GetMapping("getDto") @ApiOperation("信息") public Result getDto(Long commentId, Long projectId, String pageCode) { ReviewCommentDto data = testReviewCommentService.getDto(commentId, projectId, pageCode); if (commentId!=null) { OssDto ossDto = sysOssConfigService.getOssByBusiType(commentId, "test_review_comment_"+ pageCode); if (ossDto != null) { data.setFiles(ossDto); } } return Result.ok(data); } @PostMapping @ApiOperation("新增") @LogOperation("新增") public Result 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 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); } }