<?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.stylefeng.guns.modular.system.dao.InviteMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Invite">
|
<id column="id" property="id" />
|
|
<result column="userId" property="userId" />
|
|
<result column="insertTime" property="insertTime" />
|
|
<result column="amount" property="amount" />
|
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, code, orderNumber, userId, payTime, insetTime, payType, amount, couponId, realMoney, packageId
|
</sql>
|
<select id="findTeam" resultType="com.stylefeng.guns.modular.system.vo.TeamVO">
|
SELECT t1.userId as id, SUM(t1.amount) AS amount,t2.name as name,t2.phone as phone
|
FROM t_invite t1
|
left join t_user t2 on t1.userId = t2.id
|
where t1.giftUserId = #{req.id} and t1.type= 2
|
<if test="req.startTime!=null and req.endTime != null">
|
and (t1.insertTime BETWEEN #{req.startTime} and #{req.endTime} )
|
</if>
|
GROUP BY t1.userId
|
order by amount desc
|
|
</select>
|
<select id="list" resultType="com.stylefeng.guns.modular.system.vo.CSVO">
|
select SUM(t1.amount) AS amount,t2.name as userName
|
from t_invite t1
|
left join t_user t2 on t1.giftUserId = t2.id
|
<where>
|
<if test="startTime!=null and endTime != null">
|
and (t1.insertTime BETWEEN #{startTime} and #{endTime} )
|
</if>
|
</where>
|
group by t1.giftUserId
|
ORDER BY amount desc
|
</select>
|
|
</mapper>
|