123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?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.game.business.mapper.AppUserAgentMapper">
-
- <resultMap type="com.game.business.domain.AppUserAgent" id="AppUserAgentResult">
- <result property="id" column="id" />
- <result property="userId" column="user_id" />
- <result property="pid" column="pid" />
- <result property="topId" column="top_id" />
- <result property="liveRate" column="live_rate" />
- <result property="dividendGuaranteeRate" column="dividend_guarantee_rate" />
- <result property="auditStatus" column="audit_status" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="selectAppUserAgentVo">
- select id, user_id, pid, top_id, live_rate, dividend_guarantee_rate, audit_status, create_time, update_time from app_user_agent
- </sql>
- <select id="selectAppUserAgentList" parameterType="com.game.business.domain.AppUserAgent" resultMap="AppUserAgentResult">
- <include refid="selectAppUserAgentVo"/>
- <where>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="pid != null "> and pid = #{pid}</if>
- <if test="topId != null "> and top_id = #{topId}</if>
- <if test="liveRate != null "> and live_rate = #{liveRate}</if>
- <if test="dividendGuaranteeRate != null "> and dividend_guarantee_rate = #{dividendGuaranteeRate}</if>
- <if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
- </where>
- </select>
-
- <select id="selectAppUserAgentById" parameterType="Long" resultMap="AppUserAgentResult">
- <include refid="selectAppUserAgentVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertAppUserAgent" parameterType="com.game.business.domain.AppUserAgent" useGeneratedKeys="true" keyProperty="id">
- insert into app_user_agent
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="userId != null">user_id,</if>
- <if test="pid != null">pid,</if>
- <if test="topId != null">top_id,</if>
- <if test="liveRate != null">live_rate,</if>
- <if test="dividendGuaranteeRate != null">dividend_guarantee_rate,</if>
- <if test="auditStatus != null">audit_status,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="userId != null">#{userId},</if>
- <if test="pid != null">#{pid},</if>
- <if test="topId != null">#{topId},</if>
- <if test="liveRate != null">#{liveRate},</if>
- <if test="dividendGuaranteeRate != null">#{dividendGuaranteeRate},</if>
- <if test="auditStatus != null">#{auditStatus},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateAppUserAgent" parameterType="com.game.business.domain.AppUserAgent">
- update app_user_agent
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="pid != null">pid = #{pid},</if>
- <if test="topId != null">top_id = #{topId},</if>
- <if test="liveRate != null">live_rate = #{liveRate},</if>
- <if test="dividendGuaranteeRate != null">dividend_guarantee_rate = #{dividendGuaranteeRate},</if>
- <if test="auditStatus != null">audit_status = #{auditStatus},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteAppUserAgentById" parameterType="Long">
- delete from app_user_agent where id = #{id}
- </delete>
- <delete id="deleteAppUserAgentByIds" parameterType="String">
- delete from app_user_agent where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="sumBetting" resultType="java.lang.Double">
- select IFNULL(sum(betting_amount),0) as amount
- from app_user_agent as a left join app_game_betting as b on a.user_id = b.user_id
- where b.create_time between #{beginTime} and #{endTime}
- and a.pid = #{pid}
- </select>
- <select id="teamList" resultType="com.game.business.vo.AppAgentTeamVo">
- select
- a.user_id as userId,
- c.username as nickName,
- a.pid as pid,
- (select IFNULL(sum(betting_amount),0) from app_game_betting as b where b.user_id = a.user_id) as bettingAmount,
- (select IFNULL(sum(d.live_commission + d.game_commission),0) from app_user_count as d where d.user_id = a.user_id) as commission,
- (select IFNULL(sum(e.game_win_amount - e.game_lose_amount),0) from app_user_count as e where e.user_id = a.user_id) as gameAmount,
- a.live_rate as liveRate,
- a.dividend_guarantee_rate as dividendGuaranteeRate
- from app_user_agent as a left join mugozbg_live.app_user as c on a.user_id = c.userid where (a.pid = #{teamDto.pid} or a.user_id = #{teamDto.pid})
- <if test="teamDto.userId != null ">
- and a.user_id = #{teamDto.userId}
- </if>
- <if test="teamDto.nickName != null and teamDto.nickName != ''">
- and c.username = #{teamDto.nickName}
- </if>
- </select>
- </mapper>
|