admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?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>
 
 
    <select id="selectBySourceUidAndDayAndUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        FROM
        yeshi_ec_team_dividents_source_user WHERE
        `tdsu_source_uid`=#{sourceUid} and tdsu_day=#{day} and
        tdsu_target_uid=#{targetUid}
    </select>
 
 
</mapper>