Files
loan-pricing/doc/2026-03-28-workflow-update-time-list-backend-plan.md

121 lines
4.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 流程列表更新时间展示后端实施计划
> **For agentic workers:** REQUIRED: Use superpowers:executing-plans to implement this plan in this repository. Do not use subagents. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 让流程列表接口返回 `updateTime`,并保持按更新时间倒序排序。
**Architecture:** 后端只调整列表专用 VO 和联表 SQL让列表展示字段与现有 `ORDER BY lpw.update_time DESC` 对齐。不修改详情页、不改数据库结构、不变更列表其他字段。
**Tech Stack:** Spring Boot、MyBatis Plus、Lombok、Maven、XML Mapper
---
### Task 1: 为列表专用 VO 补充更新时间字段
**Files:**
- Modify: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/domain/vo/LoanPricingWorkflowListVO.java`
- Test: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/domain/vo/LoanPricingWorkflowListVOTest.java`
- [ ] **Step 1: 写失败测试约束 `updateTime` 字段存在**
`LoanPricingWorkflowListVOTest` 中新增一个最小测试,例如:
```java
@Test
void shouldExposeUpdateTimeField() {
LoanPricingWorkflowListVO vo = new LoanPricingWorkflowListVO();
Date now = new Date();
vo.setUpdateTime(now);
assertEquals(now, vo.getUpdateTime());
}
```
- [ ] **Step 2: 运行测试确认在字段未添加前失败**
Run: `mvn -pl ruoyi-loan-pricing -am -Dsurefire.failIfNoSpecifiedTests=false -Dtest=LoanPricingWorkflowListVOTest test`
Expected: FAIL提示 `updateTime` 相关 getter/setter 不存在。
- [ ] **Step 3: 在 VO 中新增 `updateTime`**
`LoanPricingWorkflowListVO` 中新增:
```java
private Date updateTime;
```
- [ ] **Step 4: 重新运行测试确认通过**
Run: `mvn -pl ruoyi-loan-pricing -am -Dsurefire.failIfNoSpecifiedTests=false -Dtest=LoanPricingWorkflowListVOTest test`
Expected: PASS
### Task 2: 让联表 SQL 返回更新时间
**Files:**
- Modify: `ruoyi-loan-pricing/src/main/resources/mapper/loanpricing/LoanPricingWorkflowMapper.xml`
- Test: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImplTest.java`
- [ ] **Step 1: 写失败测试约束列表分页结果透传 `updateTime`**
`LoanPricingWorkflowServiceImplTest` 中新增测试,例如:
```java
@Test
void shouldReturnPagedWorkflowListWithUpdateTime() {
LoanPricingWorkflowListVO row = new LoanPricingWorkflowListVO();
Date now = new Date();
row.setUpdateTime(now);
Page<LoanPricingWorkflowListVO> pageResult = new Page<>(1, 10);
pageResult.setRecords(List.of(row));
when(loanPricingWorkflowMapper.selectWorkflowPageWithRates(any(), any())).thenReturn(pageResult);
IPage<LoanPricingWorkflowListVO> result = loanPricingWorkflowService.selectLoanPricingPage(new Page<>(1, 10), new LoanPricingWorkflow());
assertEquals(now, result.getRecords().get(0).getUpdateTime());
}
```
- [ ] **Step 2: 运行测试确认在 SQL/VO 未对齐前失败**
Run: `mvn -pl ruoyi-loan-pricing -am -Dsurefire.failIfNoSpecifiedTests=false -Dtest=LoanPricingWorkflowServiceImplTest test`
Expected: 若 `updateTime` 尚未补齐,则失败。
- [ ] **Step 3: 在联表 SQL 中新增更新时间返回字段**
`LoanPricingWorkflowMapper.xml``SELECT` 中新增:
```xml
lpw.update_time AS updateTime
```
并保留:
```xml
ORDER BY lpw.update_time DESC
```
- [ ] **Step 4: 运行服务层测试确认通过**
Run: `mvn -pl ruoyi-loan-pricing -am -Dsurefire.failIfNoSpecifiedTests=false -Dtest=LoanPricingWorkflowServiceImplTest test`
Expected: PASS
- [ ] **Step 5: 运行模块测试确认无回归**
Run: `mvn -pl ruoyi-loan-pricing -am -Dsurefire.failIfNoSpecifiedTests=false test`
Expected: 模块测试通过。
- [ ] **Step 6: 补充后端实施记录**
Create: `doc/implementation-report-2026-03-28-workflow-update-time-list-backend.md`
至少写明:
```markdown
- 列表专用 VO 已新增 `updateTime`
- 联表 SQL 已返回 `lpw.update_time AS updateTime`
- 列表继续按 `lpw.update_time DESC` 排序
- 已完成后端模块测试验证
```