<?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="cc.mrbird.febs.dapp.mapper.DappStorageMapper">
|
|
|
<select id="selectOneByDateDesc" 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 create_time desc
|
limit 1
|
</select>
|
|
|
<select id="selectListByDateDesc" 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 create_time desc
|
limit 1,99
|
</select>
|
|
|
<select id="selectListByDate" 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 create_time desc
|
</select>
|
|
|
<select id="selectListByDateFiveToFiver" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
|
select
|
*
|
from
|
dapp_storage
|
where
|
create_time >= #{startTime}
|
order by create_time asc
|
</select>
|
|
|
|
<select id="selectAmountByDesc" 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="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>
|
|
|
<select id="selectSumByAmountDescFiveToFive" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
|
SELECT
|
member_id memberId,
|
sum(amount) amount
|
FROM
|
dapp_storage
|
where
|
create_time >= #{startTime}
|
GROUP BY
|
member_id
|
ORDER BY
|
amount DESC
|
limit #{offset},#{count}
|
</select>
|
|
|
</mapper>
|