From d4a5b4db79055dbb4de27260126148e619129624 Mon Sep 17 00:00:00 2001 From: yangk Date: Tue, 30 Jun 2026 16:15:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(asset):=20=E6=96=B0=E5=A2=9E=E6=8A=A5?= =?UTF-8?q?=E4=BF=AE=E7=BB=B4=E4=BF=AE=E6=98=8E=E7=BB=86=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建 AmsRepairDetailReport 实体类,包含报修单号、资产信息、维修详情等字段 - 实现 AmsRepairDetailReportController 控制器,提供报表查询和导出功能 - 开发 AmsRepairDetailReportMapper 数据访问接口及对应的 XML 映射文件 - 实现 AmsRepairDetailReportService 业务逻辑层,处理报表数据查询逻辑 - 添加单元测试验证报表服务的功能正确性 - 创建前端页面模板实现报表查询界面和数据展示 - 定义 RepairOrderStatus 常量类规范维修单状态枚举值 - 实现权限控制和 Excel 导出功能 --- .../asset/constant/RepairOrderStatus.java | 31 ++ .../AmsRepairDetailReportController.java | 85 +++++ .../asset/domain/AmsRepairDetailReport.java | 343 ++++++++++++++++++ .../mapper/AmsRepairDetailReportMapper.java | 24 ++ .../IAmsRepairDetailReportService.java | 20 + .../AmsRepairDetailReportServiceImpl.java | 38 ++ .../asset/AmsRepairDetailReportMapper.xml | 112 ++++++ .../templates/asset/report/repair.html | 181 +++++++++ .../AmsRepairDetailReportServiceImplTest.java | 84 +++++ 9 files changed, 918 insertions(+) create mode 100644 ruoyi-asset/src/main/java/com/ruoyi/asset/constant/RepairOrderStatus.java create mode 100644 ruoyi-asset/src/main/java/com/ruoyi/asset/controller/AmsRepairDetailReportController.java create mode 100644 ruoyi-asset/src/main/java/com/ruoyi/asset/domain/AmsRepairDetailReport.java create mode 100644 ruoyi-asset/src/main/java/com/ruoyi/asset/mapper/AmsRepairDetailReportMapper.java create mode 100644 ruoyi-asset/src/main/java/com/ruoyi/asset/service/IAmsRepairDetailReportService.java create mode 100644 ruoyi-asset/src/main/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImpl.java create mode 100644 ruoyi-asset/src/main/resources/mapper/asset/AmsRepairDetailReportMapper.xml create mode 100644 ruoyi-asset/src/main/resources/templates/asset/report/repair.html create mode 100644 ruoyi-asset/src/test/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImplTest.java diff --git a/ruoyi-asset/src/main/java/com/ruoyi/asset/constant/RepairOrderStatus.java b/ruoyi-asset/src/main/java/com/ruoyi/asset/constant/RepairOrderStatus.java new file mode 100644 index 0000000..c5d31c6 --- /dev/null +++ b/ruoyi-asset/src/main/java/com/ruoyi/asset/constant/RepairOrderStatus.java @@ -0,0 +1,31 @@ +package com.ruoyi.asset.constant; + +/** + * 维修单状态常量定义 + * + * @author Yangk + */ +public final class RepairOrderStatus +{ + /** 草稿 */ + public static final String DRAFT = "DRAFT"; + + /** 待确认 */ + public static final String PENDING_CONFIRM = "PENDING_CONFIRM"; + + /** 待维修 */ + public static final String WAIT_REPAIR = "WAIT_REPAIR"; + + /** 已驳回 */ + public static final String REJECTED = "REJECTED"; + + /** 维修中 */ + public static final String REPAIRING = "REPAIRING"; + + /** 已完成维修 */ + public static final String REPAIR_DONE = "REPAIR_DONE"; + + private RepairOrderStatus() + { + } +} diff --git a/ruoyi-asset/src/main/java/com/ruoyi/asset/controller/AmsRepairDetailReportController.java b/ruoyi-asset/src/main/java/com/ruoyi/asset/controller/AmsRepairDetailReportController.java new file mode 100644 index 0000000..a1f684b --- /dev/null +++ b/ruoyi-asset/src/main/java/com/ruoyi/asset/controller/AmsRepairDetailReportController.java @@ -0,0 +1,85 @@ +package com.ruoyi.asset.controller; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.asset.domain.AmsAssetCategory; +import com.ruoyi.asset.domain.AmsRepairDetailReport; +import com.ruoyi.asset.service.IAmsAssetCategoryService; +import com.ruoyi.asset.service.IAmsRepairDetailReportService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; + +/** + * 报修维修明细报表Controller + * + * @author Yangk + */ +@Controller +@RequestMapping("/asset/report/repair") +public class AmsRepairDetailReportController extends BaseController +{ + private static final String ENABLED_YES = "Y"; + + private String prefix = "asset/report"; + + @Autowired + private IAmsRepairDetailReportService amsRepairDetailReportService; + + @Autowired + private IAmsAssetCategoryService amsAssetCategoryService; + + @RequiresPermissions("asset:report:repair:view") + @GetMapping() + public String repair(ModelMap mmap) + { + mmap.put("categoryList", selectEnabledCategoryList()); + return prefix + "/repair"; + } + + /** + * 查询报修维修明细报表列表。 + */ + @RequiresPermissions("asset:report:repair:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(AmsRepairDetailReport amsRepairDetailReport) + { + startPage(); + List list = amsRepairDetailReportService + .selectRepairDetailReportList(amsRepairDetailReport); + return getDataTable(list); + } + + /** + * 导出报修维修明细报表。 + */ + @RequiresPermissions("asset:report:repair:export") + @Log(title = "报修维修明细报表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(AmsRepairDetailReport amsRepairDetailReport) + { + List list = amsRepairDetailReportService + .selectRepairDetailReportList(amsRepairDetailReport); + ExcelUtil util = new ExcelUtil(AmsRepairDetailReport.class); + return util.exportExcel(list, "报修维修明细报表数据"); + } + + private List selectEnabledCategoryList() + { + AmsAssetCategory category = new AmsAssetCategory(); + category.setEnabled(ENABLED_YES); + return amsAssetCategoryService.selectAmsAssetCategoryList(category); + } +} diff --git a/ruoyi-asset/src/main/java/com/ruoyi/asset/domain/AmsRepairDetailReport.java b/ruoyi-asset/src/main/java/com/ruoyi/asset/domain/AmsRepairDetailReport.java new file mode 100644 index 0000000..22e36c7 --- /dev/null +++ b/ruoyi-asset/src/main/java/com/ruoyi/asset/domain/AmsRepairDetailReport.java @@ -0,0 +1,343 @@ +package com.ruoyi.asset.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 报修维修明细报表对象 + * + * @author Yangk + */ +public class AmsRepairDetailReport extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报修单号 */ + @Excel(name = "报修单号") + private String repairNo; + + /** 资产编码 */ + @Excel(name = "资产编码") + private String assetCode; + + /** 资产名称 */ + @Excel(name = "资产名称") + private String assetName; + + /** 资产类别ID */ + private Long categoryId; + + /** 资产类别 */ + @Excel(name = "资产类别") + private String categoryName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specModel; + + /** 品牌 */ + @Excel(name = "品牌") + private String brand; + + /** 报修人 */ + @Excel(name = "报修人") + private String reportUserName; + + /** 故障描述 */ + @Excel(name = "故障描述") + private String faultDesc; + + /** 报修时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "报修时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date reportTime; + + /** 预计完成时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "预计完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectedFinishTime; + + /** 维修方类型 */ + @Excel(name = "维修方类型", dictType = "ams_repairer_type") + private String repairerType; + + /** 维修人 */ + @Excel(name = "维修人") + private String repairUserName; + + /** 维修单位 */ + @Excel(name = "维修单位") + private String repairOrgName; + + /** 维修联系电话 */ + @Excel(name = "维修联系电话") + private String repairContactPhone; + + /** 开始维修时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "开始维修时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date repairStartTime; + + /** 维修完成时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "维修完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date repairFinishTime; + + /** 维修结果 */ + @Excel(name = "维修结果") + private String repairResult; + + /** 维修费用 */ + @Excel(name = "维修费用") + private BigDecimal repairCost; + + /** 单据状态 */ + @Excel(name = "单据状态", dictType = "ams_repair_status") + private String orderStatus; + + /** 是否超期,仅用于报表查询过滤 */ + private String overdueFlag; + + public void setRepairNo(String repairNo) + { + this.repairNo = repairNo; + } + + public String getRepairNo() + { + return repairNo; + } + + public void setAssetCode(String assetCode) + { + this.assetCode = assetCode; + } + + public String getAssetCode() + { + return assetCode; + } + + public void setAssetName(String assetName) + { + this.assetName = assetName; + } + + public String getAssetName() + { + return assetName; + } + + public void setCategoryId(Long categoryId) + { + this.categoryId = categoryId; + } + + public Long getCategoryId() + { + return categoryId; + } + + public void setCategoryName(String categoryName) + { + this.categoryName = categoryName; + } + + public String getCategoryName() + { + return categoryName; + } + + public void setSpecModel(String specModel) + { + this.specModel = specModel; + } + + public String getSpecModel() + { + return specModel; + } + + public void setBrand(String brand) + { + this.brand = brand; + } + + public String getBrand() + { + return brand; + } + + public void setReportUserName(String reportUserName) + { + this.reportUserName = reportUserName; + } + + public String getReportUserName() + { + return reportUserName; + } + + public void setFaultDesc(String faultDesc) + { + this.faultDesc = faultDesc; + } + + public String getFaultDesc() + { + return faultDesc; + } + + public void setReportTime(Date reportTime) + { + this.reportTime = reportTime; + } + + public Date getReportTime() + { + return reportTime; + } + + public void setExpectedFinishTime(Date expectedFinishTime) + { + this.expectedFinishTime = expectedFinishTime; + } + + public Date getExpectedFinishTime() + { + return expectedFinishTime; + } + + public void setRepairerType(String repairerType) + { + this.repairerType = repairerType; + } + + public String getRepairerType() + { + return repairerType; + } + + public void setRepairUserName(String repairUserName) + { + this.repairUserName = repairUserName; + } + + public String getRepairUserName() + { + return repairUserName; + } + + public void setRepairOrgName(String repairOrgName) + { + this.repairOrgName = repairOrgName; + } + + public String getRepairOrgName() + { + return repairOrgName; + } + + public void setRepairContactPhone(String repairContactPhone) + { + this.repairContactPhone = repairContactPhone; + } + + public String getRepairContactPhone() + { + return repairContactPhone; + } + + public void setRepairStartTime(Date repairStartTime) + { + this.repairStartTime = repairStartTime; + } + + public Date getRepairStartTime() + { + return repairStartTime; + } + + public void setRepairFinishTime(Date repairFinishTime) + { + this.repairFinishTime = repairFinishTime; + } + + public Date getRepairFinishTime() + { + return repairFinishTime; + } + + public void setRepairResult(String repairResult) + { + this.repairResult = repairResult; + } + + public String getRepairResult() + { + return repairResult; + } + + public void setRepairCost(BigDecimal repairCost) + { + this.repairCost = repairCost; + } + + public BigDecimal getRepairCost() + { + return repairCost; + } + + public void setOrderStatus(String orderStatus) + { + this.orderStatus = orderStatus; + } + + public String getOrderStatus() + { + return orderStatus; + } + + public void setOverdueFlag(String overdueFlag) + { + this.overdueFlag = overdueFlag; + } + + public String getOverdueFlag() + { + return overdueFlag; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("repairNo", getRepairNo()) + .append("assetCode", getAssetCode()) + .append("assetName", getAssetName()) + .append("categoryId", getCategoryId()) + .append("categoryName", getCategoryName()) + .append("specModel", getSpecModel()) + .append("brand", getBrand()) + .append("reportUserName", getReportUserName()) + .append("faultDesc", getFaultDesc()) + .append("reportTime", getReportTime()) + .append("expectedFinishTime", getExpectedFinishTime()) + .append("repairerType", getRepairerType()) + .append("repairUserName", getRepairUserName()) + .append("repairOrgName", getRepairOrgName()) + .append("repairContactPhone", getRepairContactPhone()) + .append("repairStartTime", getRepairStartTime()) + .append("repairFinishTime", getRepairFinishTime()) + .append("repairResult", getRepairResult()) + .append("repairCost", getRepairCost()) + .append("orderStatus", getOrderStatus()) + .append("overdueFlag", getOverdueFlag()) + .toString(); + } +} diff --git a/ruoyi-asset/src/main/java/com/ruoyi/asset/mapper/AmsRepairDetailReportMapper.java b/ruoyi-asset/src/main/java/com/ruoyi/asset/mapper/AmsRepairDetailReportMapper.java new file mode 100644 index 0000000..dc449ab --- /dev/null +++ b/ruoyi-asset/src/main/java/com/ruoyi/asset/mapper/AmsRepairDetailReportMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.asset.mapper; + +import java.util.List; +import com.ruoyi.asset.domain.AmsRepairDetailReport; +import org.apache.ibatis.annotations.Param; + +/** + * 报修维修明细报表Mapper接口 + * + * @author Yangk + */ +public interface AmsRepairDetailReportMapper +{ + /** + * 查询报修维修明细报表列表。 + * + * @param report 查询条件 + * @param effectiveStatuses 已形成维修事实的单据状态 + * @return 报修维修明细报表集合 + */ + public List selectRepairDetailReportList( + @Param("report") AmsRepairDetailReport report, + @Param("effectiveStatuses") List effectiveStatuses); +} diff --git a/ruoyi-asset/src/main/java/com/ruoyi/asset/service/IAmsRepairDetailReportService.java b/ruoyi-asset/src/main/java/com/ruoyi/asset/service/IAmsRepairDetailReportService.java new file mode 100644 index 0000000..41b758a --- /dev/null +++ b/ruoyi-asset/src/main/java/com/ruoyi/asset/service/IAmsRepairDetailReportService.java @@ -0,0 +1,20 @@ +package com.ruoyi.asset.service; + +import java.util.List; +import com.ruoyi.asset.domain.AmsRepairDetailReport; + +/** + * 报修维修明细报表Service接口 + * + * @author Yangk + */ +public interface IAmsRepairDetailReportService +{ + /** + * 查询报修维修明细报表列表。 + * + * @param amsRepairDetailReport 报修维修明细报表查询条件 + * @return 报修维修明细报表集合 + */ + public List selectRepairDetailReportList(AmsRepairDetailReport amsRepairDetailReport); +} diff --git a/ruoyi-asset/src/main/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImpl.java b/ruoyi-asset/src/main/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImpl.java new file mode 100644 index 0000000..71ae53b --- /dev/null +++ b/ruoyi-asset/src/main/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImpl.java @@ -0,0 +1,38 @@ +package com.ruoyi.asset.service.impl; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.asset.constant.RepairOrderStatus; +import com.ruoyi.asset.domain.AmsRepairDetailReport; +import com.ruoyi.asset.mapper.AmsRepairDetailReportMapper; +import com.ruoyi.asset.service.IAmsRepairDetailReportService; + +/** + * 报修维修明细报表Service业务层处理 + * + * @author Yangk + */ +@Service +public class AmsRepairDetailReportServiceImpl implements IAmsRepairDetailReportService +{ + private static final List EFFECTIVE_REPAIR_STATUSES = Collections.unmodifiableList(Arrays.asList( + RepairOrderStatus.WAIT_REPAIR, RepairOrderStatus.REPAIRING, RepairOrderStatus.REPAIR_DONE)); + + @Autowired + private AmsRepairDetailReportMapper amsRepairDetailReportMapper; + + /** + * 查询报修维修明细报表列表。 + */ + @Override + public List selectRepairDetailReportList(AmsRepairDetailReport amsRepairDetailReport) + { + AmsRepairDetailReport query = amsRepairDetailReport == null ? new AmsRepairDetailReport() + : amsRepairDetailReport; + // 报表只统计已受理后的维修事实,排除草稿、待确认、驳回,避免过程申请数据污染报表口径。 + return amsRepairDetailReportMapper.selectRepairDetailReportList(query, EFFECTIVE_REPAIR_STATUSES); + } +} diff --git a/ruoyi-asset/src/main/resources/mapper/asset/AmsRepairDetailReportMapper.xml b/ruoyi-asset/src/main/resources/mapper/asset/AmsRepairDetailReportMapper.xml new file mode 100644 index 0000000..1bdafdf --- /dev/null +++ b/ruoyi-asset/src/main/resources/mapper/asset/AmsRepairDetailReportMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + repair_no, + asset_code, + asset_name, + category_id, + category_name, + spec_model, + brand, + report_user_name, + fault_desc, + report_time, + expected_finish_time, + repairer_type, + repair_user_name, + repair_org_name, + repair_contact_phone, + repair_start_time, + repair_finish_time, + repair_result, + repair_cost, + order_status + + + + + del_flag = '0' + and order_status in + + #{status} + + + and repair_no like concat(#{report.repairNo}, '%') + + + and asset_code like concat(#{report.assetCode}, '%') + + + and category_id = #{report.categoryId} + + + and report_user_name like concat('%', #{report.reportUserName}, '%') + + + and report_time >= #{report.params.beginReportTime} + + + and report_time < date_add(#{report.params.endReportTime}, interval 1 day) + + + and order_status = #{report.orderStatus} + + + and repairer_type = #{report.repairerType} + + + and repair_user_name like concat('%', #{report.repairUserName}, '%') + + + and repair_org_name like concat('%', #{report.repairOrgName}, '%') + + + and expected_finish_time is not null + and expected_finish_time < now() + and order_status != 'REPAIR_DONE' + + + and ( + expected_finish_time is null + or expected_finish_time >= now() + or order_status = 'REPAIR_DONE' + ) + + + + + + diff --git a/ruoyi-asset/src/main/resources/templates/asset/report/repair.html b/ruoyi-asset/src/main/resources/templates/asset/report/repair.html new file mode 100644 index 0000000..cc35d84 --- /dev/null +++ b/ruoyi-asset/src/main/resources/templates/asset/report/repair.html @@ -0,0 +1,181 @@ + + + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + + - + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + +  搜索 + + +  重置 + +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + + + diff --git a/ruoyi-asset/src/test/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImplTest.java b/ruoyi-asset/src/test/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImplTest.java new file mode 100644 index 0000000..3548b2e --- /dev/null +++ b/ruoyi-asset/src/test/java/com/ruoyi/asset/service/impl/AmsRepairDetailReportServiceImplTest.java @@ -0,0 +1,84 @@ +package com.ruoyi.asset.service.impl; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.math.BigDecimal; +import java.util.List; +import com.ruoyi.asset.constant.RepairOrderStatus; +import com.ruoyi.asset.domain.AmsRepairDetailReport; +import com.ruoyi.asset.mapper.AmsRepairDetailReportMapper; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class AmsRepairDetailReportServiceImplTest +{ + @Mock + private AmsRepairDetailReportMapper amsRepairDetailReportMapper; + + @InjectMocks + private AmsRepairDetailReportServiceImpl service; + + /** 报表只展示已受理后的维修事实,避免草稿、待确认、驳回单据污染统计口径。 */ + @Test + void selectRepairDetailReportListShouldAlwaysUseEffectiveStatuses() + { + AmsRepairDetailReport query = new AmsRepairDetailReport(); + query.setRepairerType("INTERNAL"); + query.setOrderStatus(RepairOrderStatus.REPAIRING); + when(amsRepairDetailReportMapper.selectRepairDetailReportList(query, List.of( + RepairOrderStatus.WAIT_REPAIR, RepairOrderStatus.REPAIRING, RepairOrderStatus.REPAIR_DONE))) + .thenReturn(List.of()); + + service.selectRepairDetailReportList(query); + + ArgumentCaptor reportCaptor = ArgumentCaptor.forClass(AmsRepairDetailReport.class); + @SuppressWarnings("unchecked") + ArgumentCaptor> statusCaptor = ArgumentCaptor.forClass(List.class); + verify(amsRepairDetailReportMapper).selectRepairDetailReportList(reportCaptor.capture(), + statusCaptor.capture()); + assertEquals("INTERNAL", reportCaptor.getValue().getRepairerType()); + assertEquals(RepairOrderStatus.REPAIRING, reportCaptor.getValue().getOrderStatus()); + assertEquals(List.of(RepairOrderStatus.WAIT_REPAIR, RepairOrderStatus.REPAIRING, + RepairOrderStatus.REPAIR_DONE), statusCaptor.getValue()); + } + + @Test + void selectRepairDetailReportListShouldHandleNullQuery() + { + when(amsRepairDetailReportMapper.selectRepairDetailReportList(any(AmsRepairDetailReport.class), anyList())) + .thenReturn(List.of()); + + service.selectRepairDetailReportList(null); + + verify(amsRepairDetailReportMapper).selectRepairDetailReportList(any(AmsRepairDetailReport.class), anyList()); + } + + @Test + void selectRepairDetailReportListShouldReturnMapperRows() + { + AmsRepairDetailReport row = new AmsRepairDetailReport(); + row.setRepairNo("BX202606170003"); + row.setAssetCode("TEST-ASSET-003"); + row.setRepairCost(new BigDecimal("234.00")); + row.setOrderStatus(RepairOrderStatus.REPAIR_DONE); + when(amsRepairDetailReportMapper.selectRepairDetailReportList(any(AmsRepairDetailReport.class), anyList())) + .thenReturn(List.of(row)); + + List result = service.selectRepairDetailReportList(new AmsRepairDetailReport()); + + assertEquals(1, result.size()); + assertEquals("BX202606170003", result.get(0).getRepairNo()); + assertEquals("TEST-ASSET-003", result.get(0).getAssetCode()); + assertEquals(new BigDecimal("234.00"), result.get(0).getRepairCost()); + assertEquals(RepairOrderStatus.REPAIR_DONE, result.get(0).getOrderStatus()); + } +}