admin
2021-05-29 40d0d99fb89665e6e7702ea62e45fabe2d01e51a
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
<?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.ks.vip.mapper.VipOrderMapper">
    <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipOrder">
        <id column="o_id" property="id" jdbcType="BIGINT"/>
        <result column="o_type" property="type" typeHandler="com.ks.vip.pojo.mybatishandler.OrderTypeEnumHandler"/>
        <result column="o_combo_id" property="comboId" jdbcType="BIGINT"/>
        <result column="o_uid" property="uid" jdbcType="VARCHAR"/>
        <result column="o_three_order_id" property="threeOrderId" jdbcType="VARCHAR"/>
        <result column="o_pay_money" property="payMoney" jdbcType="DECIMAL"/>
        <result column="o_pay_time" property="payTime" jdbcType="TIMESTAMP"/>
        <result column="o_pay_account" property="payAccount" jdbcType="VARCHAR"/>
        <result column="o_pay_way" property="payWay" jdbcType="VARCHAR"/>
        <result column="o_end_time" property="endTime" jdbcType="TIMESTAMP"/>
        <result column="o_start_time" property="startTime" jdbcType="TIMESTAMP"/>
        <result column="o_state" property="state" jdbcType="INTEGER"/>
        <result column="o_creator_id" property="creatorId" jdbcType="BIGINT"/>
        <result column="o_create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="o_updator_id" property="updatorId" jdbcType="BIGINT"/>
        <result column="o_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">o_id,o_type,o_combo_id,o_uid,o_three_order_id,o_pay_money,o_pay_time,o_pay_account,o_pay_way,o_end_time,o_start_time,o_state,o_creator_id,o_create_time,o_updator_id,o_update_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>from vip_order where o_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey"
            parameterType="java.lang.Long">delete from vip_order where o_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipOrder" useGeneratedKeys="true"
            keyProperty="id">insert into vip_order (o_id,o_type,o_combo_id,o_uid,o_three_order_id,o_pay_money,o_pay_time,o_pay_account,o_pay_way,o_end_time,o_start_time,o_state,o_creator_id,o_create_time,o_updator_id,o_update_time) values (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{comboId,jdbcType=BIGINT},#{uid,jdbcType=VARCHAR},#{threeOrderId,jdbcType=VARCHAR},#{payMoney,jdbcType=DECIMAL},#{payTime,jdbcType=TIMESTAMP},#{payAccount,jdbcType=VARCHAR},#{payWay,jdbcType=VARCHAR},#{endTime,jdbcType=TIMESTAMP},#{startTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert>
    <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipOrder" useGeneratedKeys="true" keyProperty="id">
        insert into vip_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">o_id,</if>
            <if test="type != null">o_type,</if>
            <if test="comboId != null">o_combo_id,</if>
            <if test="uid != null">o_uid,</if>
            <if test="threeOrderId != null">o_three_order_id,</if>
            <if test="payMoney != null">o_pay_money,</if>
            <if test="payTime != null">o_pay_time,</if>
            <if test="payAccount != null">o_pay_account,</if>
            <if test="payWay != null">o_pay_way,</if>
            <if test="endTime != null">o_end_time,</if>
            <if test="startTime != null">o_start_time,</if>
            <if test="state != null">o_state,</if>
            <if test="creatorId != null">o_creator_id,</if>
            <if test="createTime != null">o_create_time,</if>
            <if test="updatorId != null">o_updator_id,</if>
            <if test="updateTime != null">o_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="comboId != null">#{comboId,jdbcType=BIGINT},</if>
            <if test="uid != null">#{uid,jdbcType=VARCHAR},</if>
            <if test="threeOrderId != null">#{threeOrderId,jdbcType=VARCHAR},</if>
            <if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if>
            <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if>
            <if test="payAccount != null">#{payAccount,jdbcType=VARCHAR},</if>
            <if test="payWay != null">#{payWay,jdbcType=VARCHAR},</if>
            <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
            <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
            parameterType="com.ks.vip.pojo.DO.VipOrder">update vip_order set o_type = #{type,jdbcType=VARCHAR},o_combo_id = #{comboId,jdbcType=BIGINT},o_uid = #{uid,jdbcType=VARCHAR},o_three_order_id = #{threeOrderId,jdbcType=VARCHAR},o_pay_money = #{payMoney,jdbcType=DECIMAL},o_pay_time = #{payTime,jdbcType=TIMESTAMP},o_pay_account = #{payAccount,jdbcType=VARCHAR},o_pay_way = #{payWay,jdbcType=VARCHAR},o_end_time = #{endTime,jdbcType=TIMESTAMP},o_start_time = #{startTime,jdbcType=TIMESTAMP},o_state = #{state,jdbcType=INTEGER},o_creator_id = #{creatorId,jdbcType=BIGINT},o_create_time = #{createTime,jdbcType=TIMESTAMP},o_updator_id = #{updatorId,jdbcType=BIGINT},o_update_time = #{updateTime,jdbcType=TIMESTAMP} where o_id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipOrder">update vip_order
        <set>
            <if test="type != null">o_type=#{type,jdbcType=VARCHAR},</if>
            <if test="comboId != null">o_combo_id=#{comboId,jdbcType=BIGINT},</if>
            <if test="uid != null">o_uid=#{uid,jdbcType=VARCHAR},</if>
            <if test="threeOrderId != null">o_three_order_id=#{threeOrderId,jdbcType=VARCHAR},</if>
            <if test="payMoney != null">o_pay_money=#{payMoney,jdbcType=DECIMAL},</if>
            <if test="payTime != null">o_pay_time=#{payTime,jdbcType=TIMESTAMP},</if>
            <if test="payAccount != null">o_pay_account=#{payAccount,jdbcType=VARCHAR},</if>
            <if test="payWay != null">o_pay_way=#{payWay,jdbcType=VARCHAR},</if>
            <if test="endTime != null">o_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
            <if test="startTime != null">o_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
            <if test="state != null">o_state=#{state,jdbcType=INTEGER},</if>
            <if test="creatorId != null">o_creator_id=#{creatorId,jdbcType=BIGINT},</if>
            <if test="createTime != null">o_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updatorId != null">o_updator_id=#{updatorId,jdbcType=BIGINT},</if>
            <if test="updateTime != null">o_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where o_id = #{id,jdbcType=BIGINT}
    </update>
 
 
    <!-- 非模板 -->
    <sql id="listWhere">
        <if test="query.id!=null">and o_id=#{query.id}</if>
        <if test="query.type!=null">and o_type=#{query.type}</if>
        <if test="query.comboId!=null">and comboId=#{query.comboId}</if>
        <if test="query.uid!=null">and o_uid=#{query.uid}</if>
        <if test="query.threeOrderId!=null">and o_three_order_id=#{query.threeOrderId}</if>
        <if test="query.state!=null">and o_state=#{query.state}</if>
        <if test="query.minCreateTime!=null">and o_create_time>=#{query.minCreateTime}</if>
        <if test="query.maxCreateTime!=null">and #{query.maxCreateTime} >o_create_time</if>
    </sql>
 
 
    <select id="listByPage" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from vip_order
        where 1=1
        <include refid="listWhere"/>
        limit #{query.start},#{query.count}
    </select>
 
 
    <select id="listByPrimaryKeys" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from vip_order
        where
        <foreach collection="ids" item="item" open="(" separator=" or " close=")" >
            o_id=#{item}
        </foreach>
 
    </select>
 
 
    <select id="count" resultType="java.lang.Long">
        select count(*) from vip_order
        where 1=1
        <include refid="listWhere"/>
    </select>
 
 
    <select id="getByThreeOrderId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from vip_order
        where o_three_order_id=#{query.threeOrderId}
    </select>
 
 
    <select id="countByTypeAndUid" resultType="Long">
    select IFNULL(count(o_id),0)  from vip_order
    where o_uid = #{uid} and o_type=#{type}
  </select>
 
 
</mapper>