puzhibing
2023-06-30 f58cca364b731eac2d60a440ffaa804be3cd43fd
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
<?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.agentdriving.user.modular.system.dao.AccountChangeDetailMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.AccountChangeDetail">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="userType" property="userType"/>
        <result column="userId" property="userId"/>
        <result column="type" property="type"/>
        <result column="changeType" property="changeType"/>
        <result column="oldData" property="oldData"/>
        <result column="newData" property="newData"/>
        <result column="orderId" property="orderId"/>
        <result column="explain" property="explain"/>
        <result column="createTime" property="createTime"/>
    </resultMap>
 
 
 
    <select id="queryBalanceDetails" resultType="com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper">
        select
        a.changeType as type,
        a.`explain`,
        b.startAddress,
        b.endAddress,
        UNIX_TIMESTAMP(a.createTime) * 1000 as createTime,
        (a.newData - a.oldData) as amount,
        a.newData as balance
        from t_account_change_detail a
        left join t_order b on (a.orderId = b.id)
        where a.userType = 1 and a.userId = #{uid}
        <if test="null != time and '' != time">
            and DATE_FORMAT(a.createTime, '%Y年%m月') = #{time}
        </if>
        order by a.createTime desc limit #{pageNum}, #{pageSize}
    </select>
</mapper>