package com.ruoyi.web.controller.api; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.QATestItemStatusEnum; import com.ruoyi.system.dto.TQaTestItemDTO; import com.ruoyi.system.dto.UpAndDownDTO; import com.ruoyi.system.model.TQaTestItem; import com.ruoyi.system.model.TQaTestItemReport; import com.ruoyi.system.query.TQaTestItemQuery; import com.ruoyi.system.service.TQaTestItemReportService; import com.ruoyi.system.service.TQaTestItemService; import com.ruoyi.system.vo.TQaTestItemReportVO; import com.ruoyi.system.vo.TQaTestItemVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; /** *

* QA检测项 前端控制器 *

* * @author xiaochen * @since 2025-04-08 */ @Api(tags = "QA检测项管理") @RestController @RequestMapping("/t-qa-test-item") public class TQaTestItemController { private final TQaTestItemService qaTestItemService; private final TQaTestItemReportService qaTestItemReportService; @Autowired public TQaTestItemController(TQaTestItemService qaTestItemService, TQaTestItemReportService qaTestItemReportService) { this.qaTestItemService = qaTestItemService; this.qaTestItemReportService = qaTestItemReportService; } /** * 获取QA检测项管理管理列表 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:list')") @ApiOperation(value = "获取QA检测项管理分页列表") @PostMapping(value = "/api/t-qa-test-item/pageList") public R> pageList(@RequestBody String param) { TQaTestItemQuery query = JSON.parseObject(param, TQaTestItemQuery.class); return R.ok(qaTestItemService.pageList(query)); } /** * 添加QA检测项管理管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:add')") @Log(title = "QA检测项管理信息-新增QA检测项管理", businessType = BusinessType.INSERT) @ApiOperation(value = "添加QA检测项管理",response = TQaTestItemDTO.class) @PostMapping(value = "/api/t-qa-test-item/add") public R add(@RequestBody String param) { TQaTestItemDTO dto = JSON.parseObject(param,TQaTestItemDTO.class); qaTestItemService.save(dto); return R.ok(); } /** * 修改QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:edit')") @Log(title = "QA检测项管理信息-修改QA检测项管理", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改QA检测项管理") @PostMapping(value = "/api/t-qa-test-item/update") public R update(@RequestBody String param) { TQaTestItemDTO dto = JSON.parseObject(param,TQaTestItemDTO.class); qaTestItemService.updateById(dto); return R.ok(); } /** * 查看QA检测项管理详情 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:detail')") @ApiOperation(value = "查看QA检测项管理详情") @GetMapping(value = "/open/t-qa-test-item/getDetailById") public R getDetailById(@RequestParam String id) { TQaTestItem testItem = qaTestItemService.getById(id); TQaTestItemVO testItemVO = new TQaTestItemVO(); BeanUtils.copyProperties(testItem, testItemVO); // 查询QA检测项检测报告 List qaTestItemReportVOS= qaTestItemReportService.getList(id); testItemVO.setQaTestItemReportList(qaTestItemReportVOS); return R.ok(testItemVO); } /** * 删除QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") @Log(title = "QA检测项管理信息-删除QA检测项管理", businessType = BusinessType.DELETE) @ApiOperation(value = "删除QA检测项管理") @DeleteMapping(value = "/open/t-qa-test-item/deleteById") public R deleteById(@RequestParam String id) { // 删除QA检测项管理成员 qaTestItemReportService.remove(Wrappers.lambdaQuery(TQaTestItemReport.class).eq(TQaTestItemReport::getItemId, id)); return R.ok(qaTestItemService.removeById(id)); } /** * 批量删除QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") @Log(title = "QA检测项管理信息-删除QA检测项管理", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除QA检测项管理") @DeleteMapping(value = "/open/t-qa-test-item/deleteByIds") public R deleteByIds(@RequestBody List ids) { // 删除QA检测项检测报告 qaTestItemReportService.remove(Wrappers.lambdaQuery(TQaTestItemReport.class).in(TQaTestItemReport::getItemId, ids)); return R.ok(qaTestItemService.removeByIds(ids)); } /** * 修改QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:commitEvaluate')") @Log(title = "QA检测项管理信息-提交评价QA检测项管理状态", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改QA检测项管理状态") @PutMapping(value = "/open/t-qa-test-item/commitEvaluate") public R commitEvaluate(@RequestParam String id) { TQaTestItem testItem = qaTestItemService.getById(id); testItem.setStatus(QATestItemStatusEnum.TO_BE_EVALUATED.getCode()); qaTestItemService.updateById(testItem); return R.ok(); } }