KKSU
2024-07-08 f0922bc416fad3aa6121ffdbdd217bffb94f518f
src/main/resources/mapper/dapp/DappStorageMapper.xml
@@ -46,7 +46,87 @@
        where
                date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        order by amount desc
            limit {offset},{count}
            limit #{offset},#{count}
    </select>
    <select id="selectOneByCreateTimeDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            *
        FROM
            dapp_storage
        ORDER BY
            create_time DESC
            limit #{offset},#{count}
    </select>
    <select id="selectByAmountDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            *
        FROM
            dapp_storage
        where
                date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        ORDER BY
            amount DESC
            limit #{offset},#{count}
    </select>
    <select id="selectSumByAmountDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            member_id memberId,
               sum(amount) amount
        FROM
            dapp_storage
        where
                date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        GROUP BY
            member_id
        ORDER BY
            amount DESC
            limit #{offset},#{count}
    </select>
    <select id="selectAmountByAmountDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
            *
        from
            dapp_storage
        where
                member_id = #{memberId}
        order by amount desc
            limit #{offset},#{count}
    </select>
    <select id="selectListInPage" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
        a.*,
        b.address address
        from
        dapp_storage a
        left join dapp_member b on a.member_id = b.id
        <where>
            <if test="record.address != '' and record.address != null">
                and b.address = #{record.address}
            </if>
            <if test="record.state != null">
                and a.state = #{record.state}
            </if>
        </where>
        order by a.create_time desc
    </select>
    <select id="selectListGroupByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            member_id
        FROM
            dapp_storage
        GROUP BY
            member_id
    </select>