puzhibing
2023-08-16 33fb76bd70cf84cebbe26b96e5faedd22961f0b0
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
30
31
32
33
34
35
36
37
38
39
40
41
42
<?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.stylefeng.guns.modular.system.dao.CompanyFundFlowMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.CompanyFundFlow">
        <id column="id" property="id"/>
        <result column="type" property="type"/>
        <result column="objectType" property="objectType"/>
        <result column="objectId" property="objectId"/>
        <result column="balance" property="balance"/>
        <result column="money" property="money"/>
        <result column="createTime" property="createTime"/>
    </resultMap>
 
 
 
    <select id="queryCompanyFundFlow" resultType="map">
        select
        a.id,
        DATE_FORMAT(a.createTime, '%Y-%m-%d %H:%i') as createTime,
        a.type,
        b.`name` as driverName,
        a.money,
        a.money + a.balance as balance
        from t_company_fund_flow a
        left join t_driver b on (a.driverId = b.id)
        where 1 = 1
        <if test="null != role and 1 ==  role">
            and a.objectType = 1
        </if>
        <if test="null != role and 2 ==  role">
            and a.objectType = 2 and a.objectId = #{id}
        </if>
        <if test="null != type">
            and a.type = #{type}
        </if>
        <if test="null != startTime and '' != startTime and null != endTime and '' != endTime">
            and DATE_FORMAT(a.createTime, '%Y-%m-%d %H:%i') between #{startTime} and #{endTime}
        </if>
        order by a.createTime desc
    </select>
</mapper>