feat:增加账单搜索接口

This commit is contained in:
2025-11-10 19:51:28 +08:00
parent 4cbf49d2a3
commit ea8d6cfa12
6 changed files with 85 additions and 10 deletions

View File

@@ -56,16 +56,16 @@
<select id="queryBillSummary" resultMap="billSummaryResultMap">
SELECT
a.id AS id,
c.name AS bookName,
a.type AS type,
d.name AS category,
a.location AS location,
b.name AS payAccount,
a.amount AS amount,
a.content AS content,
a.remark AS remark,
a.date AS date
a.id AS id,
c.name AS bookName,
a.type AS type,
d.name AS category,
a.location AS location,
b.name AS payAccount,
a.amount AS amount,
a.content AS content,
a.remark AS remark,
a.date AS date
FROM bill_record a
LEFT JOIN bill_pay b ON a.pay_id = b.id
LEFT JOIN bill_book c ON a.book_id = c.id
@@ -83,6 +83,36 @@
ORDER BY a.date DESC
</select>
<select id="searchBillSummary" resultMap="billSummaryResultMap">
SELECT
a.id AS id,
c.name AS bookName,
a.type AS type,
d.name AS category,
a.location AS location,
b.name AS payAccount,
a.amount AS amount,
a.content AS content,
a.remark AS remark,
a.date AS date
FROM bill_record a
LEFT JOIN bill_pay b ON a.pay_id = b.id
LEFT JOIN bill_book c ON a.book_id = c.id
LEFT JOIN bill_category d ON a.category_id = d.id
<where>
<if test="query.content != null and query.content != ''">
a.content LIKE CONCAT('%', #{query.content}, '%')
</if>
<if test="query.category != null and query.category != ''">
AND d.name LIKE CONCAT('%', #{query.category}, '%')
</if>
<if test="query.location != null and query.location != ''">
AND a.location LIKE CONCAT('%', #{query.location}, '%')
</if>
</where>
ORDER BY a.date DESC
</select>
<insert id="insertBillImage">
INSERT INTO bill_image (bill_id, image_url) VALUES
<foreach collection="list" item="item" separator=",">
@@ -131,6 +161,7 @@
</if>
<if test="type eq 'category'">
GROUP BY c.name
ORDER BY value DESC
</if>
</select>