1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?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.chelvc.cloud.vehicle.server.dao.UserInviteMapper">
- <select id="teamList" resultType="com.chelvc.cloud.vehicle.api.dto.TeamDetailsDTO">
- SELECT
- i.user_id,
- target_id AS inviteUserId,
- SUM( r.reality_amount ) amount,
- r.source_type sourceType
- FROM
- user_invite i
- LEFT JOIN currency_record r ON i.user_id = r.user_id
- AND i.target_id = r.source_user_id
- AND r.type = 0
- AND i.type = r.source_type
- WHERE
- i.user_id = #{userId}
- <if test="type != null">
- and i.type = #{type}
- </if>
- GROUP BY
- i.id
- ORDER BY
- amount DESC
- limit #{pageNum}, #{pageSize}
- </select>
- <select id="teamTotalStatistics" resultType="com.chelvc.cloud.vehicle.api.dto.TeamDTO">
- SELECT
- count(i.id) total,
- sum(r.reality_amount) totalAmount
- FROM
- user_invite i
- LEFT JOIN currency_record r ON i.user_id = r.user_id
- AND i.target_id = r.source_user_id
- AND r.type = 0
- AND i.type = r.source_type
- WHERE
- i.user_id = #{userId}
- <if test="type != null">
- and i.type = #{type}
- </if>
- </select>
- </mapper>
|