yujian
2020-05-23 28cf328a098334b51a3e9d2d56f983fb8c862211
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?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.money.TeamEincomeRecordMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.money.TeamEincomeRecord">
        <id column="ti_id" property="id" jdbcType="BIGINT" />
        <result column="ti_uid" property="uid" jdbcType="BIGINT" />
        <result column="ti_type" property="type" jdbcType="INTEGER" />
        <result column="ti_money" property="money" jdbcType="DECIMAL" />
        <result column="ti_state" property="state" jdbcType="INTEGER" />
        <result column="ti_source_type" property="sourceType" jdbcType="INTEGER" />
        <result column="ti_pre_recieve_time" property="preRecieveTime"
            jdbcType="TIMESTAMP" />
        <result column="ti_recieve_time" property="recieveTime"
            jdbcType="TIMESTAMP" />
        <result column="ti_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="ti_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="ti_beizhu" property="beiZhu" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">ti_id,ti_uid,ti_type,ti_money,ti_state,ti_source_type,ti_pre_recieve_time,ti_recieve_time,ti_create_time,ti_update_time,ti_beizhu
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_income where ti_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_team_income where ti_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.money.TeamEincomeRecord"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_team_income
        (ti_id,ti_uid,ti_type,ti_money,ti_state,ti_source_type,ti_pre_recieve_time,ti_recieve_time,ti_create_time,ti_update_time,ti_beizhu)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{sourceType,jdbcType=INTEGER},#{preRecieveTime,jdbcType=TIMESTAMP},#{recieveTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.TeamEincomeRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_team_income
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ti_id,</if>
            <if test="uid != null">ti_uid,</if>
            <if test="type != null">ti_type,</if>
            <if test="money != null">ti_money,</if>
            <if test="state != null">ti_state,</if>
            <if test="sourceType != null">ti_source_type,</if>
            <if test="preRecieveTime != null">ti_pre_recieve_time,</if>
            <if test="recieveTime != null">ti_recieve_time,</if>
            <if test="createTime != null">ti_create_time,</if>
            <if test="updateTime != null">ti_update_time,</if>
            <if test="beiZhu != null">ti_beizhu,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if>
            <if test="preRecieveTime != null">#{preRecieveTime,jdbcType=TIMESTAMP},</if>
            <if test="recieveTime != null">#{recieveTime,jdbcType=TIMESTAMP},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.money.TeamEincomeRecord">update
        yeshi_ec_team_income set ti_uid = #{uid,jdbcType=BIGINT},ti_type =
        #{type,jdbcType=INTEGER},ti_money = #{money,jdbcType=DECIMAL},ti_state
        = #{state,jdbcType=INTEGER},ti_source_type =
        #{sourceType,jdbcType=INTEGER},ti_pre_recieve_time =
        #{preRecieveTime,jdbcType=TIMESTAMP},ti_recieve_time =
        #{recieveTime,jdbcType=TIMESTAMP},ti_create_time =
        #{createTime,jdbcType=TIMESTAMP},ti_update_time =
        #{updateTime,jdbcType=TIMESTAMP},ti_beizhu =
        #{beiZhu,jdbcType=VARCHAR} where ti_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.TeamEincomeRecord">
        update yeshi_ec_team_income
        <set>
            <if test="uid != null">ti_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="type != null">ti_type=#{type,jdbcType=INTEGER},</if>
            <if test="money != null">ti_money=#{money,jdbcType=DECIMAL},</if>
            <if test="state != null">ti_state=#{state,jdbcType=INTEGER},</if>
            <if test="sourceType != null">ti_source_type=#{sourceType,jdbcType=INTEGER},</if>
            <if test="preRecieveTime != null">ti_pre_recieve_time=#{preRecieveTime,jdbcType=TIMESTAMP},
            </if>
            <if test="recieveTime != null">ti_recieve_time=#{recieveTime,jdbcType=TIMESTAMP},</if>
            <if test="createTime != null">ti_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">ti_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu != null">ti_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
        </set>
        where ti_id = #{id,jdbcType=BIGINT}
    </update>
 
 
 
    <select id="selectByUidAndPreRecieveTimeAndType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_income where ti_uid = #{uid} and ti_type=#{type}
        and ti_pre_recieve_time=#{preRecieveTime}
    </select>
 
 
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_income where ti_id = #{id,jdbcType=BIGINT} for
        update
    </select>
 
    <select id="listByUidAndPreRecieveTimeAndState" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_income where ti_uid = #{uid} and
        ti_pre_recieve_time=#{preRecieveTime} and ti_state=#{state}
 
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                ti_type=#{type}
            </foreach>
        </if>
    </select>
 
 
 
    <select id="listCanRecieveUid" resultType="java.lang.Long">
        select
        distinct(ti_uid)
        from yeshi_ec_team_income where
        ti_pre_recieve_time=#{preRecieveTime}
        and ti_state=1
 
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                ti_type=#{type}
            </foreach>
        </if>
        
        limit #{start},#{count}
    </select>
 
    <select id="countCanRecieveUid" resultType="java.lang.Long">
        select
        count( distinct(ti_uid))
        from yeshi_ec_team_income where
        ti_pre_recieve_time=#{preRecieveTime} and ti_state=1
 
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                ti_type=#{type}
            </foreach>
        </if>
    </select>
 
    <select id="sumRecieveByType" resultType="BigDecimal">
        SELECT SUM(ti_money) FROM yeshi_ec_team_income 
        WHERE ti_uid=#{uid} AND ti_type=#{type} AND ti_state=1
    </select>
 
 
</mapper>