<?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.fzm.mall.server.admin.finance_center.mapper.UserAssetRecordMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.fzm.mall.server.admin.finance_center.model.UserAssetRecord">
        <id column="id" property="id"/>
        <result column="flow_id" property="flowId"/>
        <result column="uid" property="uid"/>
        <result column="coin" property="coin"/>
        <result column="type" property="type"/>
        <result column="amount" property="amount"/>
        <result column="other_side" property="otherSide"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="hash" property="hash"/>
        <result column="note" property="note"/>
    </resultMap>

    <select id="page" resultType="com.fzm.mall.server.admin.finance_center.entity.vo.UserAssetsRecordVO">
        SELECT
        A.flow_id,A.uid,B.phone AS loginAccount,A.coin AS
        assetsType,A.amount,A.other_side,A.type,A.status,A.create_time
        FROM
        user_asset_record A
        LEFT JOIN
        user B
        ON
        A.uid = B.uid
        <where>
            <if test="flowId!=null and flowId!=''">
                A.flow_id = #{flowId}
            </if>
            <if test="uid!=null and uid!=''">
                AND
                A.uid = #{uid}
            </if>
            <if test="coin!=null and coin!=''">
                AND
                A.coin = #{coin}
            </if>
            <if test="type!=null">
                AND
                A.type = #{type}
            </if>
        </where>
        ORDER BY
        A.create_time
        DESC
    </select>
</mapper>
