From 1c518e10a50050d383e714b581c94dea58ec4d67 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 22 五月 2026 18:01:34 +0800
Subject: [PATCH] fix(approve): 修复审批实例查询条件及流程控制问题

---
 src/main/resources/mapper/account/AccountStatementMapper.xml |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/account/AccountStatementMapper.xml b/src/main/resources/mapper/account/AccountStatementMapper.xml
new file mode 100644
index 0000000..331c61b
--- /dev/null
+++ b/src/main/resources/mapper/account/AccountStatementMapper.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.AccountStatementMapper">
+
+    <select id="listPageAccountStatement" resultType="com.ruoyi.account.bean.vo.StatementAccountVo">
+    SELECT lj.*,
+        <choose>
+        <when test="req.accountType == 1">
+            c.customer_name as customerName
+        </when>
+        <when test="req.accountType == 2">
+            s.supplier_name as customerName
+        </when>
+        <otherwise>
+            '' as customerName
+        </otherwise>
+    </choose>
+    FROM account_statement AS lj
+            <!-- 鍔ㄦ�� LEFT JOIN -->
+            <choose>
+        <when test="req.accountType == 1">
+            LEFT JOIN customer AS c
+                ON lj.customer_id = c.id
+        </when>
+        <when test="req.accountType == 2">
+            LEFT JOIN supplier_manage AS s
+                ON lj.customer_id = s.id
+        </when>
+    </choose>
+    WHERE 1=1
+            <if test="req.accountType != null">
+                 AND lj.account_type = #{req.accountType}
+            </if>
+            <if test="req.customerId != null">
+                 AND lj.customer_id = #{req.customerId}
+            </if>
+            <if test="req.startDate != null and req.endDate != null">
+                  AND DATE_FORMAT(CONCAT(lj.statement_month, '-01'), '%Y-%m-%d')
+                    BETWEEN #{req.startDate} AND #{req.endDate}
+            </if>
+    ORDER BY lj.statement_month DESC
+    </select>
+</mapper>

--
Gitblit v1.9.3