<?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.MallAchieveRecordMapper">
|
|
<select id="selectAchieveTotal" resultType="java.math.BigDecimal">
|
select IFNULL(sum(IFNULL(amount,0)),0) from mall_achieve_record
|
where 1=1
|
<if test='type == "D"'>
|
and date_format(achieve_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d');
|
</if>
|
<if test='type == "M"'>
|
and date_format(achieve_time, '%Y-%m') = date_format(#{date}, '%Y-%m');
|
</if>
|
</select>
|
|
<select id="selectSumAchieveByMemberIds" resultType="java.math.BigDecimal">
|
select IFNULL(sum(IFNULL(amount,0)),0)
|
from mall_achieve_record
|
where member_id IN
|
<foreach collection = "list" item = "item" separator="," open = "(" close = ")" >
|
#{item}
|
</foreach >
|
and date_format(achieve_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d');
|
</select>
|
|
<select id="selectSumAchieveByMemberIdList" resultType="java.math.BigDecimal">
|
select IFNULL(sum(IFNULL(amount,0)),0)
|
from mall_achieve_record
|
where member_id IN
|
<foreach collection = "list" item = "item" separator="," open = "(" close = ")" >
|
#{item}
|
</foreach >
|
</select>
|
|
<select id="selectListByDate" resultType="cc.mrbird.febs.dapp.entity.MallAchieveRecord">
|
select * from mall_achieve_record
|
where date_format(achieve_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d');
|
</select>
|
|
<select id="selectListByMemberId" resultType="cc.mrbird.febs.dapp.entity.MallAchieveRecord">
|
select * from mall_achieve_record
|
where member_id = #{memberId}
|
and is_normal = 1
|
order by CREATE_TIME asc
|
</select>
|
|
<select id="selectListByMemberIdAndScore" resultType="cc.mrbird.febs.dapp.entity.MallAchieveRecord">
|
select * from mall_achieve_record
|
where member_id = #{memberId}
|
and score > 0
|
order by CREATE_TIME asc
|
</select>
|
|
<select id="selectListCostAmountByMemberId" resultType="cc.mrbird.febs.dapp.entity.MallAchieveRecord">
|
select * from mall_achieve_record
|
where member_id = #{memberId}
|
order by CREATE_TIME asc
|
</select>
|
|
<select id="selectAchieveTotalByMemberIdAndCreateTime" resultType="java.math.BigDecimal">
|
select IFNULL(sum(IFNULL(cost_amount,0)),0) from mall_achieve_record
|
where
|
member_id = #{memberId}
|
and pay_time >= #{date}
|
</select>
|
|
|
<select id="selectAchieveTotalByCreateTime" resultType="java.math.BigDecimal">
|
select IFNULL(sum(IFNULL(amount,0)),0) from mall_achieve_record
|
where pay_time >= #{date}
|
</select>
|
|
<select id="selectAchieveByMemberId" resultType="java.math.BigDecimal">
|
select IFNULL(sum(IFNULL(a.amount, 0)), 0)
|
from mall_achieve_record a
|
inner join dapp_member b on a.member_id = b.ID
|
where is_normal = 1
|
<if test="type == 1">
|
and b.invite_id=#{inviteId}
|
</if>
|
<if test="type == 2">
|
and find_in_set(#{inviteId}, b.referer_ids)
|
</if>
|
</select>
|
|
<select id="selectTeamListByInviteId" resultType="cc.mrbird.febs.dapp.vo.TeamChildListVo">
|
select
|
a.invite_id inviteId,
|
a.address address,
|
a.account_type accountType,
|
a.create_time createTime
|
from dapp_member a
|
where a.referer_id=#{inviteId}
|
</select>
|
|
<select id="selectCountByInvitedId" resultType="cc.mrbird.febs.dapp.entity.MallAchieveRecord">
|
select *
|
from mall_achieve_record a
|
inner join dapp_member b on a.member_id = b.ID
|
where is_normal = 1
|
<if test="type == 1">
|
and b.invite_id=#{inviteId}
|
</if>
|
<if test="type == 2">
|
and (find_in_set(#{inviteId}, b.referer_ids) or b.invite_id=#{inviteId})
|
</if>
|
</select>
|
|
</mapper>
|