feat:封闭车辆的申请与分页
parent
95f9fba705
commit
74c1eda8be
|
|
@ -4,6 +4,7 @@ target/
|
|||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
|
|
@ -11,7 +12,7 @@ target/
|
|||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
.sisyphus
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"active_plan": "E:\\proj\\zcloudGbsProj\\zcloud-gbs-primeport\\.sisyphus\\plans\\refactor-car-apply-listpage.md",
|
||||
"started_at": "2026-03-20T02:50:18.824Z",
|
||||
"session_ids": [
|
||||
"ses_2f70a72c8ffea8FCW0BWHlECqF"
|
||||
],
|
||||
"plan_name": "refactor-car-apply-listpage",
|
||||
"agent": "atlas"
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
# Add currentUserCanAudit Field Logic
|
||||
|
||||
## TL;DR
|
||||
|
||||
在 `ClosedAreaPersonApplyQueryExe.execute()` 方法中添加逻辑,为每条查询结果设置 `currentUserCanAudit` 字段,标识当前登录用户是否能审核该申请。
|
||||
|
||||
**Deliverables**:
|
||||
- 修改 `ClosedAreaPersonApplyQueryExe.java`
|
||||
|
||||
**Estimated Effort**: Quick (1 file, <20 lines)
|
||||
|
||||
---
|
||||
|
||||
## Context
|
||||
|
||||
### Target File
|
||||
`web-app/src/main/java/com/zcloud/primeport/command/query/ClosedAreaPersonApplyQueryExe.java`
|
||||
|
||||
### Business Logic
|
||||
- `currentUserCanAudit = 1`:当前用户能审核(审核中状态且当前用户是审批人)
|
||||
- `currentUserCanAudit = 2`:当前用户不能审核
|
||||
|
||||
### Implementation Requirements
|
||||
1. 获取当前登录用户ID:`AuthContext.getUserId()`
|
||||
2. 遍历查询结果,对每个 `ClosedAreaPersonApplyCO` 设置字段:
|
||||
- 如果 `auditFlag == 1`(审核中)且 `auditPersonUserId == currentUserId` → `currentUserCanAudit = 1`
|
||||
- 否则 → `currentUserCanAudit = 2`
|
||||
|
||||
---
|
||||
|
||||
## TODOs
|
||||
|
||||
- [x] Add currentUserCanAudit logic in ClosedAreaPersonApplyQueryExe.execute()
|
||||
|
||||
**What to do**:
|
||||
1. 在 `execute` 方法中获取当前登录用户ID
|
||||
2. 在转换DO到CO后,遍历CO列表设置 `currentUserCanAudit` 字段
|
||||
3. 判断逻辑:审核中(1)且当前用户是审批人 → 能审核(1),否则不能审核(2)
|
||||
|
||||
**References**:
|
||||
- `web-app/src/main/java/com/zcloud/primeport/command/query/ClosedAreaPersonApplyQueryExe.java:48-53` - execute method to modify
|
||||
- `web-client/src/main/java/com/zcloud/primeport/dto/clientobject/ClosedAreaPersonApplyCO.java:124-125` - currentUserCanAudit field already exists
|
||||
- `web-app/src/main/java/com/zcloud/primeport/command/ClosedAreaPersonApplyAddExe.java` - AuthContext.getUserId() usage example
|
||||
|
||||
**Acceptance Criteria**:
|
||||
- [ ] `execute` 方法中获取 `AuthContext.getUserId()`
|
||||
- [ ] 对每条记录正确设置 `currentUserCanAudit` 字段
|
||||
- [ ] 代码编译通过
|
||||
- [ ] 使用 `import com.jjb.saas.framework.auth.utils.AuthContext;`
|
||||
|
||||
---
|
||||
|
||||
## Commit Strategy
|
||||
|
||||
- **1**: `feat(closedArea): add currentUserCanAudit logic in query` — ClosedAreaPersonApplyQueryExe.java
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
### Verification Commands
|
||||
```bash
|
||||
mvn compile -pl web-app
|
||||
```
|
||||
|
||||
### Final Checklist
|
||||
- [ ] `currentUserCanAudit` 逻辑正确实现
|
||||
- [ ] 代码编译通过
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
# Refactor ClosedAreaCarApplyRepositoryImpl listPage Method
|
||||
|
||||
## TL;DR
|
||||
|
||||
按照 `ClosedAreaPersonApplyRepositoryImpl.listPage()` 的实现方式重写 `ClosedAreaCarApplyRepositoryImpl.listPage()` 方法,添加 `menuPerms` 参数处理逻辑。
|
||||
|
||||
**Deliverables**:
|
||||
- 修改 `ClosedAreaCarApplyMapper.java` - 添加 listPage 方法
|
||||
- 修改 `ClosedAreaCarApplyMapper.xml` - 添加 SQL 查询
|
||||
- 修改 `ClosedAreaCarApplyRepositoryImpl.java` - 重写 listPage 方法
|
||||
|
||||
**Estimated Effort**: Quick (3 files)
|
||||
|
||||
---
|
||||
|
||||
## Context
|
||||
|
||||
### Reference Implementation
|
||||
`ClosedAreaPersonApplyRepositoryImpl.listPage()` 的实现模式:
|
||||
1. 使用 `Page<Map<String, Object>>` 创建分页对象
|
||||
2. 获取 `menuPerms` 参数:通过 `MenuEnum.getMenuKeyByPath()` 转换
|
||||
3. 调用 Mapper 的自定义 `listPage` 方法
|
||||
4. 返回 `PageHelper.pageToResponse()` 结果
|
||||
|
||||
### Business Logic
|
||||
```java
|
||||
String menuPerms = "";
|
||||
if (!org.springframework.util.ObjectUtils.isEmpty(params.get("menuPath"))) {
|
||||
menuPerms = MenuEnum.getMenuKeyByPath(params.get("menuPath").toString());
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## TODOs
|
||||
|
||||
- [ ] 1. Add listPage method to ClosedAreaCarApplyMapper.java
|
||||
|
||||
**What to do**:
|
||||
添加 `listPage` 方法签名,参考 ClosedAreaPersonApplyMapper
|
||||
|
||||
**File**: `web-infrastructure/src/main/java/com/zcloud/primeport/persistence/mapper/ClosedAreaCarApplyMapper.java`
|
||||
|
||||
**Code**:
|
||||
```java
|
||||
IPage<ClosedAreaCarApplyDO> listPage(Page<Map<String, Object>> page, Map<String, Object> params, String menuPerms);
|
||||
```
|
||||
|
||||
**Imports to add**:
|
||||
```java
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.Map;
|
||||
```
|
||||
|
||||
- [ ] 2. Add listPage SQL to ClosedAreaCarApplyMapper.xml
|
||||
|
||||
**What to do**:
|
||||
添加分页查询 SQL,参考 ClosedAreaPersonApplyMapper.xml
|
||||
|
||||
**File**: `web-infrastructure/src/main/resources/mapper/ClosedAreaCarApplyMapper.xml`
|
||||
|
||||
**Code**:
|
||||
```xml
|
||||
<select id="listPage" resultType="com.zcloud.primeport.persistence.dataobject.ClosedAreaCarApplyDO">
|
||||
select * from closed_area_car_apply c
|
||||
where c.delete_enum = 'FALSE'
|
||||
<if test="params.processOrRecord != null">
|
||||
<if test="params.processOrRecord == 1">
|
||||
AND c.audit_flag = 1
|
||||
</if>
|
||||
<if test="params.processOrRecord == 2">
|
||||
AND c.audit_flag != 1
|
||||
</if>
|
||||
</if>
|
||||
<if test="params.applyPersonUserName != null and params.applyPersonUserName != ''">
|
||||
AND c.apply_person_user_name like CONCAT('%', #{params.applyPersonUserName}, '%')
|
||||
</if>
|
||||
<if test="params.licenceNo != null and params.licenceNo != ''">
|
||||
AND c.licence_no like CONCAT('%', #{params.licenceNo}, '%')
|
||||
</if>
|
||||
</select>
|
||||
```
|
||||
|
||||
- [ ] 3. Rewrite listPage in ClosedAreaCarApplyRepositoryImpl.java
|
||||
|
||||
**What to do**:
|
||||
按照 ClosedAreaPersonApplyRepositoryImpl 的模式重写 listPage 方法
|
||||
|
||||
**File**: `web-infrastructure/src/main/java/com/zcloud/primeport/persistence/repository/impl/ClosedAreaCarApplyRepositoryImpl.java`
|
||||
|
||||
**Code**:
|
||||
```java
|
||||
@Override
|
||||
public PageResponse<ClosedAreaCarApplyDO> listPage(Map<String, Object> params) {
|
||||
Page<Map<String, Object>> page = new Page<>(Integer.parseInt(params.get("pageIndex").toString()),
|
||||
Integer.parseInt(params.get("pageSize").toString()));
|
||||
String menuPerms = "";
|
||||
if (!org.springframework.util.ObjectUtils.isEmpty(params.get("menuPath"))) {
|
||||
menuPerms = MenuEnum.getMenuKeyByPath(params.get("menuPath").toString());
|
||||
}
|
||||
IPage<ClosedAreaCarApplyDO> result = closedAreaCarApplyMapper.listPage(page, params, menuPerms);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
```
|
||||
|
||||
**Imports to add**:
|
||||
```java
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zcloud.primeport.domain.enums.MenuEnum;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Commit Strategy
|
||||
|
||||
- **1**: `feat(closedArea): refactor ClosedAreaCarApplyRepositoryImpl listPage with menuPerms` — 3 files
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
### Verification Commands
|
||||
```bash
|
||||
mvn compile -pl web-infrastructure
|
||||
```
|
||||
|
||||
### Final Checklist
|
||||
- [ ] Mapper 接口添加 listPage 方法
|
||||
- [ ] XML 添加对应 SQL
|
||||
- [ ] Repository 实现重写完成
|
||||
- [ ] 编译通过
|
||||
Loading…
Reference in New Issue