admin
2020-04-13 dd5b15229cb15459fa7c31ccea77dac28cbfafbd
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
<?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.TeamDividentsSourceOrderMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder">
        <id column="tdo_id" property="id" jdbcType="BIGINT" />
        <result column="tdo_uid" property="uid" jdbcType="BIGINT" />
        <result column="tdo_order_no" property="orderNo" jdbcType="VARCHAR" />
        <result column="tdo_source_type" property="sourceType"
            jdbcType="INTEGER" />
        <result column="tdo_state" property="state" jdbcType="INTEGER" />
        <result column="tdo_money" property="money" jdbcType="DECIMAL" />
        <result column="tdo_pre_send_time" property="preSendTime"
            jdbcType="TIMESTAMP" />
        <result column="tdo_send_time" property="sendTime" jdbcType="TIMESTAMP" />
        <result column="tdo_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="tdo_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="tdo_beizhu" property="beiZhu" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">tdo_id,tdo_uid,tdo_order_no,tdo_source_type,tdo_state,tdo_money,tdo_pre_send_time,tdo_send_time,tdo_create_time,tdo_update_time,tdo_beizhu
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_dividents_source_order where tdo_id =
        #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_team_dividents_source_order where tdo_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_team_dividents_source_order
        (tdo_id,tdo_uid,tdo_order_no,tdo_source_type,tdo_state,tdo_money,tdo_pre_send_time,tdo_send_time,tdo_create_time,tdo_update_time,tdo_beizhu)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{money,jdbcType=DECIMAL},#{preSendTime,jdbcType=TIMESTAMP},#{sendTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_team_dividents_source_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">tdo_id,</if>
            <if test="uid != null">tdo_uid,</if>
            <if test="orderNo != null">tdo_order_no,</if>
            <if test="sourceType != null">tdo_source_type,</if>
            <if test="state != null">tdo_state,</if>
            <if test="money != null">tdo_money,</if>
            <if test="preSendTime != null">tdo_pre_send_time,</if>
            <if test="sendTime != null">tdo_send_time,</if>
            <if test="createTime != null">tdo_create_time,</if>
            <if test="updateTime != null">tdo_update_time,</if>
            <if test="beiZhu != null">tdo_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="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
            <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="preSendTime != null">#{preSendTime,jdbcType=TIMESTAMP},</if>
            <if test="sendTime != null">#{sendTime,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.order.dividents.TeamDividentsSourceOrder">update yeshi_ec_team_dividents_source_order set tdo_uid
        = #{uid,jdbcType=BIGINT},tdo_order_no =
        #{orderNo,jdbcType=VARCHAR},tdo_source_type =
        #{sourceType,jdbcType=INTEGER},tdo_state =
        #{state,jdbcType=INTEGER},tdo_money =
        #{money,jdbcType=DECIMAL},tdo_pre_send_time =
        #{preSendTime,jdbcType=TIMESTAMP},tdo_send_time =
        #{sendTime,jdbcType=TIMESTAMP},tdo_create_time =
        #{createTime,jdbcType=TIMESTAMP},tdo_update_time =
        #{updateTime,jdbcType=TIMESTAMP} ,tdo_beizhu
        =#{beiZhu,jdbcType=VARCHAR} where tdo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder">
        update yeshi_ec_team_dividents_source_order
        <set>
            <if test="uid != null">tdo_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="orderNo != null">tdo_order_no=#{orderNo,jdbcType=VARCHAR},</if>
            <if test="sourceType != null">tdo_source_type=#{sourceType,jdbcType=INTEGER},</if>
            <if test="state != null">tdo_state=#{state,jdbcType=INTEGER},</if>
            <if test="money != null">tdo_money=#{money,jdbcType=DECIMAL},</if>
            <if test="preSendTime != null">tdo_pre_send_time=#{preSendTime,jdbcType=TIMESTAMP},</if>
            <if test="sendTime != null">tdo_send_time=#{sendTime,jdbcType=TIMESTAMP},</if>
            <if test="createTime != null">tdo_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">tdo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu !=null">tdo_beizhu =#{beiZhu,jdbcType=VARCHAR},</if>
        </set>
        where tdo_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_dividents_source_order where tdo_id = #{0} for
        update
    </select>
    <select id="lisByUidAndPreSendTimeAndState" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_dividents_source_order where tdo_uid=#{uid} and
        tdo_pre_send_time=#{preSendTime} and tdo_state=#{state} limit
        #{start},#{count}
    </select>
    <select id="countByUidAndPreSendTimeAndState" resultType="java.lang.Long">select
        count(*) from yeshi_ec_team_dividents_source_order where
        tdo_uid=#{uid} and tdo_pre_send_time=#{preSendTime} and
        tdo_state=#{state}
    </select>
    
    <select id="listUidByPreSendTimeAndState" resultType="java.lang.Long">select
        distinct(tdo_uid) from yeshi_ec_team_dividents_source_order where
        tdo_pre_send_time=#{preSendTime} and
        tdo_state=#{state} limit
        #{start},#{count}
    </select>
    
    <select id="countUidByPreSendTimeAndState" resultType="java.lang.Long">select
        count(distinct(tdo_uid)) from yeshi_ec_team_dividents_source_order
        where tdo_pre_send_time=#{preSendTime} and
        tdo_state=#{state}
    </select>
    
    <update id="setStateByUidAndState">
        update yeshi_ec_team_dividents_source_order
        <set>tdo_state=#{targetState}, tdo_update_time=now(),
            tdo_beizhu=#{beiZhu},
        </set>
        where tdo_uid = #{uid} and tdo_state=#{state}
    </update>
    <select id="selectByOrderNoAndSourceType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_team_dividents_source_order where
        tdo_order_no=#{orderNo} and tdo_source_type=#{sourceType}
    </select>
</mapper>