1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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.AccountMapper">
    <select id="accountListPage" resultType="com.ruoyi.account.pojo.Account">
        select a.*, fa.account_name as accountName
        from account a
        left join finance_account fa on a.account_id = fa.id
        where 1=1
        <if test="c.counterparty !='' and c.counterparty!=null">
            and a.counterparty like concat('%', #{c.counterparty}, '%')
        </if>
        <if test="c.typeText !='' and c.typeText!=null">
            and a.type_text = #{c.typeText}
        </if>
        <if test="c.accountId != null">
            and a.account_id = #{c.accountId}
        </if>
        <if test="c.flowType !='' and c.flowType!=null">
            and a.flow_type = #{c.flowType}
        </if>
        <if test="c.entryDateStart != null and c.entryDateStart != ''">
            and a.account_date &gt;= DATE_FORMAT(#{c.entryDateStart},'%Y-%m-%d')
        </if>
        <if test="c.entryDateEnd != null and c.entryDateEnd != ''">
            and a.account_date &lt;= DATE_FORMAT(#{c.entryDateEnd},'%Y-%m-%d')
        </if>
        order by a.account_date desc, a.id desc
    </select>
</mapper>