puzhibing
2023-04-07 eaa20cb58afc80e3612fd6e93d6f27e181a027e7
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml
@@ -5,13 +5,35 @@
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.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>