| | |
| | | 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.project.dto.SoftwareTestOrderDto; |
| | | import com.zt.life.modules.project.model.SoftwareTestOrder; |
| | | import com.zt.life.modules.project.model.SoftwareTestOrderMeasured; |
| | | import com.zt.life.modules.project.service.ProjectService; |
| | | import com.zt.life.modules.project.service.SoftwareTestOrderDeliverableService; |
| | | import com.zt.life.modules.project.service.SoftwareTestOrderMeasuredService; |
| | | import com.zt.life.modules.project.service.SoftwareTestOrderService; |
| | | import com.zt.life.modules.sysBaseInfo.service.TestAgencyInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * software_test_order |
| | | * |
| | | * @author zt generator |
| | | * @author zt generator |
| | | * @since 1.0.0 2023-11-08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/project/SoftwareTestOrder/") |
| | | @Api(tags="software_test_order") |
| | | @Api(tags = "software_test_order") |
| | | public class SoftwareTestOrderController { |
| | | @Autowired |
| | | private SoftwareTestOrderService softwareTestOrderService; |
| | | |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | @Autowired |
| | | private SoftwareTestOrderDeliverableService softwareTestOrderDeliverableService; |
| | | @Autowired |
| | | private SoftwareTestOrderMeasuredService softwareTestOrderMeasuredService; |
| | | @Autowired |
| | | private TestAgencyInfoService testAgencyInfoService; |
| | | |
| | | @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 = "testBasis", value = "测试依据", dataType = Constant.QT.STRING, format = "test_basis^EQ"), |
| | | @ApiImplicitParam(name = "testType", value = "测试类型", dataType = Constant.QT.STRING, format = "test_type^EQ"), |
| | | @ApiImplicitParam(name = "testStandard", value = "测试标准", dataType = Constant.QT.STRING, format = "test_standard^EQ"), |
| | | @ApiImplicitParam(name = "articleNature", value = "物品性质", dataType = Constant.QT.STRING, format = "article_nature^EQ")}) |
| | | public PageResult<SoftwareTestOrder> page(@ApiIgnore @QueryParam QueryFilter queryFilter){ |
| | | @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 = "testBasis", value = "测试依据", dataType = Constant.QT.STRING, format = "test_basis^EQ"), |
| | | @ApiImplicitParam(name = "testType", value = "测试类型", dataType = Constant.QT.STRING, format = "test_type^EQ"), |
| | | @ApiImplicitParam(name = "testStandard", value = "测试标准", dataType = Constant.QT.STRING, format = "test_standard^EQ"), |
| | | @ApiImplicitParam(name = "articleNature", value = "物品性质", dataType = Constant.QT.STRING, format = "article_nature^EQ")}) |
| | | public PageResult<SoftwareTestOrder> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | return PageResult.ok(softwareTestOrderService.page(queryFilter)); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | @ApiOperation("信息") |
| | | public Result<SoftwareTestOrder> get(@PathVariable("id") Long id){ |
| | | SoftwareTestOrder data = softwareTestOrderService.get(id); |
| | | public Result<SoftwareTestOrderDto> get(@PathVariable("id") Long id, @PathVariable("projectId") Long projectId) { |
| | | SoftwareTestOrderDto data = new SoftwareTestOrderDto(); |
| | | |
| | | if (id != null) { |
| | | data.setId(id); |
| | | SoftwareTestOrder softwareTestOrder = softwareTestOrderService.get(id); |
| | | data.setSoftwareTestOrder(softwareTestOrder); |
| | | |
| | | if (projectId == null) |
| | | projectId = softwareTestOrder.getProjectId(); |
| | | |
| | | data.setTestAgencyInfo(testAgencyInfoService.get(id)); |
| | | data.setSoftwareTestOrderDeliverableList(softwareTestOrderDeliverableService.childrenTables(id)); |
| | | data.setSoftwareTestOrderMeasuredList(softwareTestOrderMeasuredService.childrenTables(id)); |
| | | } else { |
| | | data.setTestAgencyInfo(testAgencyInfoService.get(10000L)); |
| | | } |
| | | if (projectId != null) { |
| | | data.setProjectId(projectId); |
| | | data.setProject(projectService.get(projectId)); |
| | | } |
| | | |
| | | |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody SoftwareTestOrder softwareTestOrder){ |
| | | public Result insert(@RequestBody SoftwareTestOrderDto softwareTestOrderDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(softwareTestOrder, AddGroup.class, DefaultGroup.class); |
| | | softwareTestOrderService.insert(softwareTestOrder); |
| | | |
| | | ValidatorUtils.validateEntity(softwareTestOrderDto.getSoftwareTestOrder(), AddGroup.class, DefaultGroup.class); |
| | | |
| | | Boolean result = softwareTestOrderService.save(softwareTestOrderDto); |
| | | |
| | | |
| | | return Result.ok(); |
| | | } |
| | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("修改") |
| | | public Result update(@RequestBody SoftwareTestOrder softwareTestOrder){ |
| | | public Result update(@RequestBody SoftwareTestOrderDto softwareTestOrderDtor) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(softwareTestOrder, UpdateGroup.class, DefaultGroup.class); |
| | | softwareTestOrderService.update(softwareTestOrder); |
| | | |
| | | ValidatorUtils.validateEntity(softwareTestOrderDtor.getSoftwareTestOrder(), UpdateGroup.class, DefaultGroup.class); |
| | | Boolean result = softwareTestOrderService.save(softwareTestOrderDtor); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |
| | | public Result delete(@RequestBody Long[] ids){ |
| | | public Result delete(@RequestBody Long[] ids) { |
| | | //效验数据 |
| | | AssertUtils.isArrayEmpty(ids, "id"); |
| | | softwareTestOrderService.delete(ids); |