<?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.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceUserMapper">
|
<resultMap id="BaseResultMap"
|
type="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser">
|
<id column="tdsu_id" property="id" jdbcType="BIGINT" />
|
<result column="tdsu_target_uid" property="targetUid" jdbcType="BIGINT" />
|
<result column="tdsu_source_uid" property="sourceUid" jdbcType="BIGINT" />
|
<result column="tdsu_day" property="day" jdbcType="VARCHAR" />
|
<result column="tdsu_money" property="money" jdbcType="DECIMAL" />
|
<result column="tdsu_create_time" property="createTime"
|
jdbcType="TIMESTAMP" />
|
<result column="tdsu_update_time" property="updateTime"
|
jdbcType="TIMESTAMP" />
|
</resultMap>
|
<sql id="Base_Column_List">tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_team_dividents_source_user where tdsu_id =
|
#{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_team_dividents_source_user where tdsu_id =
|
#{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser"
|
useGeneratedKeys="true" keyProperty="id">insert into
|
yeshi_ec_team_dividents_source_user
|
(tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time)
|
values
|
(#{id,jdbcType=BIGINT},#{targetUid,jdbcType=BIGINT},#{sourceUid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
|
</insert>
|
<insert id="insertSelective"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_team_dividents_source_user
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">tdsu_id,</if>
|
<if test="targetUid != null">tdsu_target_uid,</if>
|
<if test="sourceUid != null">tdsu_source_uid,</if>
|
<if test="day != null">tdsu_day,</if>
|
<if test="money != null">tdsu_money,</if>
|
<if test="createTime != null">tdsu_create_time,</if>
|
<if test="updateTime != null">tdsu_update_time,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="targetUid != null">#{targetUid,jdbcType=BIGINT},</if>
|
<if test="sourceUid != null">#{sourceUid,jdbcType=BIGINT},</if>
|
<if test="day != null">#{day,jdbcType=VARCHAR},</if>
|
<if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser">update yeshi_ec_team_dividents_source_user set
|
tdsu_target_uid = #{targetUid,jdbcType=BIGINT},tdsu_source_uid =
|
#{sourceUid,jdbcType=BIGINT},tdsu_day =
|
#{day,jdbcType=VARCHAR},tdsu_money =
|
#{money,jdbcType=DECIMAL},tdsu_create_time =
|
#{createTime,jdbcType=TIMESTAMP},tdsu_update_time =
|
#{updateTime,jdbcType=TIMESTAMP} where tdsu_id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser">
|
update yeshi_ec_team_dividents_source_user
|
<set>
|
<if test="targetUid != null">tdsu_target_uid=#{targetUid,jdbcType=BIGINT},</if>
|
<if test="sourceUid != null">tdsu_source_uid=#{sourceUid,jdbcType=BIGINT},</if>
|
<if test="day != null">tdsu_day=#{day,jdbcType=VARCHAR},</if>
|
<if test="money != null">tdsu_money=#{money,jdbcType=DECIMAL},</if>
|
<if test="createTime != null">tdsu_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">tdsu_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where tdsu_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
|
|
<select id="sumMoneyByTargetUidAndDay" resultType="java.math.BigDecimal">
|
select
|
sum(tdsu_money)
|
from yeshi_ec_team_dividents_source_user where
|
tdsu_target_uid =#{uid} and tdsu_day=#{day}
|
</select>
|
|
|
|
<select id="listTargetUidByDay" resultType="java.lang.Long">
|
SELECT
|
DISTINCT(u.`tdsu_target_uid`) FROM
|
yeshi_ec_team_dividents_source_user
|
u WHERE u.`tdsu_day`=#{day} limit
|
#{start},#{count}
|
</select>
|
|
|
<select id="countTargetUidByDay" resultType="java.lang.Long"
|
parameterType="java.lang.String">
|
SELECT count(DISTINCT(u.`tdsu_target_uid`)) FROM
|
yeshi_ec_team_dividents_source_user u WHERE u.`tdsu_day`=#{day}
|
</select>
|
|
|
<select id="listBySourceUidAndDay" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
FROM
|
yeshi_ec_team_dividents_source_user WHERE
|
`tdsu_source_uid`=#{sourceUid} and tdsu_day=#{day}
|
</select>
|
|
|
|
</mapper>
|