admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?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.pdd.PDDOrderMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.pdd.PDDOrder">
        <id column="po_id" property="id" jdbcType="BIGINT" />
        <result column="po_order_sn" property="orderSn" jdbcType="VARCHAR" />
        <result column="po_goods_id" property="goodsId" jdbcType="BIGINT" />
        <result column="po_group_id" property="groupId" jdbcType="BIGINT" />
        <result column="po_goods_name" property="goodsName" jdbcType="VARCHAR" />
        <result column="po_goods_thumbnail_url" property="goodsThumbnailUrl"
            jdbcType="VARCHAR" />
        <result column="po_goods_quantity" property="goodsQuantity"
            jdbcType="INTEGER" />
        <result column="po_goods_price" property="goodsPrice" jdbcType="BIGINT" />
        <result column="po_order_amount" property="orderAmount"
            jdbcType="BIGINT" />
        <result column="po_p_id" property="pId" jdbcType="VARCHAR" />
        <result column="po_promotion_rate" property="promotionRate"
            jdbcType="BIGINT" />
        <result column="po_promotion_amount" property="promotionAmount"
            jdbcType="BIGINT" />
        <result column="po_order_status" property="orderStatus"
            jdbcType="INTEGER" />
        <result column="po_order_status_desc" property="orderStatusDesc"
            jdbcType="VARCHAR" />
        <result column="po_order_create_time" property="orderCreateTime"
            jdbcType="BIGINT" />
        <result column="po_order_pay_time" property="orderPayTime"
            jdbcType="BIGINT" />
        <result column="po_order_group_success_time" property="orderGroupSuccessTime"
            jdbcType="BIGINT" />
        <result column="po_order_verify_time" property="orderVerifyTime"
            jdbcType="BIGINT" />
        <result column="po_order_modify_at" property="orderModifyAt"
            jdbcType="BIGINT" />
        <result column="po_order_receive_time" property="orderReceiveTime"
            jdbcType="BIGINT" />
        <result column="po_custom_parameters" property="customParameters"
            jdbcType="VARCHAR" />
        <result column="po_order_settle_time" property="orderSettleTime"
            jdbcType="BIGINT" />
        <result column="po_order_id" property="orderId" jdbcType="VARCHAR" />
        <result column="po_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="po_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    </resultMap>
    
    <resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO">
        <result column="showDate" property="showDate" jdbcType="VARCHAR" />
        <result column="showValue" property="showValue" jdbcType="VARCHAR" />
    </resultMap>
    
    <sql id="Base_Column_List">po_id,po_order_sn,po_goods_id,po_group_id,po_goods_name,po_goods_thumbnail_url,po_goods_quantity,po_goods_price,po_order_amount,po_p_id,po_promotion_rate,po_promotion_amount,po_order_status,po_order_status_desc,po_order_create_time,po_order_pay_time,po_order_group_success_time,po_order_verify_time,po_order_modify_at,po_custom_parameters,po_order_settle_time,po_order_id,po_create_time,po_update_time,po_order_receive_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_pdd_order where po_id = #{id,jdbcType=BIGINT}
    </select>
 
    <select id="selectByOrderSN" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_pdd_order where po_order_sn = #{0}
    </select>
 
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_pdd_order where po_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_pdd_order
        (po_id,po_order_sn,po_goods_id,po_group_id,po_goods_name,po_goods_thumbnail_url,po_goods_quantity,po_goods_price,po_order_amount,po_p_id,po_promotion_rate,po_promotion_amount,po_order_status,po_order_status_desc,po_order_create_time,po_order_pay_time,po_order_group_success_time,po_order_verify_time,po_order_modify_at,po_custom_parameters,po_order_settle_time,po_order_id,po_create_time,po_update_time,po_order_receive_time)
        values
        (#{id,jdbcType=BIGINT},#{orderSn,jdbcType=VARCHAR},#{goodsId,jdbcType=BIGINT},#{groupId,jdbcType=BIGINT},#{goodsName,jdbcType=VARCHAR},#{goodsThumbnailUrl,jdbcType=VARCHAR},#{goodsQuantity,jdbcType=INTEGER},#{goodsPrice,jdbcType=BIGINT},#{orderAmount,jdbcType=BIGINT},#{pId,jdbcType=VARCHAR},#{promotionRate,jdbcType=BIGINT},#{promotionAmount,jdbcType=BIGINT},#{orderStatus,jdbcType=INTEGER},#{orderStatusDesc,jdbcType=VARCHAR},#{orderCreateTime,jdbcType=BIGINT},#{orderPayTime,jdbcType=BIGINT},#{orderGroupSuccessTime,jdbcType=BIGINT},#{orderVerifyTime,jdbcType=BIGINT},#{orderModifyAt,jdbcType=BIGINT},#{customParameters,jdbcType=VARCHAR},#{orderSettleTime,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderReceiveTime,jdbcType=BIGINT})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_pdd_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">po_id,</if>
            <if test="orderSn != null">po_order_sn,</if>
            <if test="goodsId != null">po_goods_id,</if>
            <if test="groupId != null">po_group_id,</if>
            <if test="goodsName != null">po_goods_name,</if>
            <if test="goodsThumbnailUrl != null">po_goods_thumbnail_url,</if>
            <if test="goodsQuantity != null">po_goods_quantity,</if>
            <if test="goodsPrice != null">po_goods_price,</if>
            <if test="orderAmount != null">po_order_amount,</if>
            <if test="pId != null">po_p_id,</if>
            <if test="promotionRate != null">po_promotion_rate,</if>
            <if test="promotionAmount != null">po_promotion_amount,</if>
            <if test="orderStatus != null">po_order_status,</if>
            <if test="orderStatusDesc != null">po_order_status_desc,</if>
            <if test="orderCreateTime != null">po_order_create_time,</if>
            <if test="orderPayTime != null">po_order_pay_time,</if>
            <if test="orderGroupSuccessTime != null">po_order_group_success_time,</if>
            <if test="orderVerifyTime != null">po_order_verify_time,</if>
            <if test="orderModifyAt != null">po_order_modify_at,</if>
            <if test="customParameters != null">po_custom_parameters,</if>
            <if test="orderSettleTime != null">po_order_settle_time,</if>
            <if test="orderId != null">po_order_id,</if>
            <if test="createTime != null">po_create_time,</if>
            <if test="updateTime != null">po_update_time,</if>
            <if test="orderReceiveTime != null">po_order_receive_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="orderSn != null">#{orderSn,jdbcType=VARCHAR},</if>
            <if test="goodsId != null">#{goodsId,jdbcType=BIGINT},</if>
            <if test="groupId != null">#{groupId,jdbcType=BIGINT},</if>
            <if test="goodsName != null">#{goodsName,jdbcType=VARCHAR},</if>
            <if test="goodsThumbnailUrl != null">#{goodsThumbnailUrl,jdbcType=VARCHAR},</if>
            <if test="goodsQuantity != null">#{goodsQuantity,jdbcType=INTEGER},</if>
            <if test="goodsPrice != null">#{goodsPrice,jdbcType=BIGINT},</if>
            <if test="orderAmount != null">#{orderAmount,jdbcType=BIGINT},</if>
            <if test="pId != null">#{pId,jdbcType=VARCHAR},</if>
            <if test="promotionRate != null">#{promotionRate,jdbcType=BIGINT},</if>
            <if test="promotionAmount != null">#{promotionAmount,jdbcType=BIGINT},</if>
            <if test="orderStatus != null">#{orderStatus,jdbcType=INTEGER},</if>
            <if test="orderStatusDesc != null">#{orderStatusDesc,jdbcType=VARCHAR},</if>
            <if test="orderCreateTime != null">#{orderCreateTime,jdbcType=BIGINT},</if>
            <if test="orderPayTime != null">#{orderPayTime,jdbcType=BIGINT},</if>
            <if test="orderGroupSuccessTime != null">#{orderGroupSuccessTime,jdbcType=BIGINT},</if>
            <if test="orderVerifyTime != null">#{orderVerifyTime,jdbcType=BIGINT},</if>
            <if test="orderModifyAt != null">#{orderModifyAt,jdbcType=BIGINT},</if>
            <if test="customParameters != null">#{customParameters,jdbcType=VARCHAR},</if>
            <if test="orderSettleTime != null">#{orderSettleTime,jdbcType=BIGINT},</if>
            <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="orderReceiveTime != null">#{orderReceiveTime,jdbcType=BIGINT},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder">update
        yeshi_ec_pdd_order set po_order_sn =
        #{orderSn,jdbcType=VARCHAR},po_goods_id =
        #{goodsId,jdbcType=BIGINT},po_group_id =
        #{groupId,jdbcType=BIGINT},po_goods_name =
        #{goodsName,jdbcType=VARCHAR},po_goods_thumbnail_url =
        #{goodsThumbnailUrl,jdbcType=VARCHAR},po_goods_quantity =
        #{goodsQuantity,jdbcType=INTEGER},po_goods_price =
        #{goodsPrice,jdbcType=BIGINT},po_order_amount =
        #{orderAmount,jdbcType=BIGINT},po_p_id =
        #{pId,jdbcType=VARCHAR},po_promotion_rate =
        #{promotionRate,jdbcType=BIGINT},po_promotion_amount =
        #{promotionAmount,jdbcType=BIGINT},po_order_status =
        #{orderStatus,jdbcType=INTEGER},po_order_status_desc =
        #{orderStatusDesc,jdbcType=VARCHAR},po_order_create_time =
        #{orderCreateTime,jdbcType=BIGINT},po_order_pay_time =
        #{orderPayTime,jdbcType=BIGINT},po_order_group_success_time =
        #{orderGroupSuccessTime,jdbcType=BIGINT},po_order_verify_time =
        #{orderVerifyTime,jdbcType=BIGINT},po_order_modify_at =
        #{orderModifyAt,jdbcType=BIGINT},po_custom_parameters =
        #{customParameters,jdbcType=VARCHAR},po_order_settle_time =
        #{orderSettleTime,jdbcType=BIGINT},po_order_id =
        #{orderId,jdbcType=VARCHAR},po_create_time =
        #{createTime,jdbcType=TIMESTAMP},po_update_time =
        #{updateTime,jdbcType=TIMESTAMP},po_order_receive_time =
        #{orderReceiveTime,jdbcType=BIGINT} where po_id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder">
        update yeshi_ec_pdd_order
        <set>
            <if test="orderSn != null">po_order_sn=#{orderSn,jdbcType=VARCHAR},</if>
            <if test="goodsId != null">po_goods_id=#{goodsId,jdbcType=BIGINT},</if>
            <if test="groupId != null">po_group_id=#{groupId,jdbcType=BIGINT},</if>
            <if test="goodsName != null">po_goods_name=#{goodsName,jdbcType=VARCHAR},</if>
            <if test="goodsThumbnailUrl != null">po_goods_thumbnail_url=#{goodsThumbnailUrl,jdbcType=VARCHAR},
            </if>
            <if test="goodsQuantity != null">po_goods_quantity=#{goodsQuantity,jdbcType=INTEGER},</if>
            <if test="goodsPrice != null">po_goods_price=#{goodsPrice,jdbcType=BIGINT},</if>
            <if test="orderAmount != null">po_order_amount=#{orderAmount,jdbcType=BIGINT},</if>
            <if test="pId != null">po_p_id=#{pId,jdbcType=VARCHAR},</if>
            <if test="promotionRate != null">po_promotion_rate=#{promotionRate,jdbcType=BIGINT},</if>
            <if test="promotionAmount != null">po_promotion_amount=#{promotionAmount,jdbcType=BIGINT},
            </if>
            <if test="orderStatus != null">po_order_status=#{orderStatus,jdbcType=INTEGER},</if>
            <if test="orderStatusDesc != null">po_order_status_desc=#{orderStatusDesc,jdbcType=VARCHAR},
            </if>
            <if test="orderCreateTime != null">po_order_create_time=#{orderCreateTime,jdbcType=BIGINT},
            </if>
            <if test="orderPayTime != null">po_order_pay_time=#{orderPayTime,jdbcType=BIGINT},</if>
            <if test="orderGroupSuccessTime != null">po_order_group_success_time=#{orderGroupSuccessTime,jdbcType=BIGINT},
            </if>
            <if test="orderVerifyTime != null">po_order_verify_time=#{orderVerifyTime,jdbcType=BIGINT},
            </if>
            <if test="orderModifyAt != null">po_order_modify_at=#{orderModifyAt,jdbcType=BIGINT},</if>
            <if test="customParameters != null">po_custom_parameters=#{customParameters,jdbcType=VARCHAR},
            </if>
            <if test="orderSettleTime != null">po_order_settle_time=#{orderSettleTime,jdbcType=BIGINT},
            </if>
            <if test="orderId != null">po_order_id=#{orderId,jdbcType=VARCHAR},</if>
            <if test="createTime != null">po_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">po_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="orderReceiveTime != null">po_order_receive_time=#{orderReceiveTime,jdbcType=BIGINT},
            </if>
        </set>
        where po_id = #{id,jdbcType=BIGINT}
    </update>
    <!-- 统计 -->
    <sql id="Column_DateType">
        <if test="dateType == 1">FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') AS
            'showDate'
        </if>
        <if test="dateType == 2">FROM_UNIXTIME(po_order_create_time,'%m') AS 'showDate'
        </if>
        <if test="dateType == 3">FROM_UNIXTIME(po_order_create_time,'%Y') AS 'showDate'
        </if>
    </sql>
    <sql id="Count_Select_DateType">
        <if test="startTime != null and startTime != '' ">
            AND FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
        </if>
        <if test="year != null and year != '' ">AND FROM_UNIXTIME(po_order_create_time,'%Y') = '${year}'
        </if>
    </sql>
    <sql id="Count_Group_DateType">
        <if test="dateType == 1">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d')
        </if>
        <if test="dateType == 2">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y-%m')</if>
        <if test="dateType == 3">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y')</if>
    </sql>
 
    <select id="countOrderByDay" resultType="Long">
        SELECT COUNT(`po_id`) FROM `yeshi_ec_pdd_order`
        WHERE FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') = #{preDay}
    </select>
 
    <select id="countOrderNumber" resultMap="ChartMap">
        SELECT IFNULL(COUNT(`po_id`),0) AS showValue,
        <include refid="Column_DateType" />
        FROM `yeshi_ec_pdd_order` t WHERE po_order_create_time IS NOT NULL
        <include refid="Count_Select_DateType" />
        <include refid="Count_Group_DateType" />
        ORDER BY po_order_create_time
    </select>
 
 
    <select id="listByStatus" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
 
        from yeshi_ec_pdd_order
 
        <if test="status!=null">
            where po_order_status=#{status}
        </if>
        limit #{start},#{count}
    </select>
 
 
 
    <select id="countByStatus" resultType="java.lang.Long">
        select
        count(po_id)
 
        from yeshi_ec_pdd_order
 
        <if test="status!=null">
            where po_order_status=#{status}
        </if>
    </select>
 
    <select id="listQuery" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_pdd_order f
        <if test="key != null and key !='' ">
            WHERE f.`po_order_id` LIKE '${key}%'
        </if>
        ORDER BY f.`po_id` DESC
        LIMIT #{start},#{count}
    </select>
    
    <select id="countQuery" resultType="Long">
        SELECT COUNT(f.`po_id`) FROM yeshi_ec_pdd_order f
        <if test="key != null and key !='' ">
            WHERE f.`po_order_id` LIKE '${key}%'
        </if>
    </select>
 
 
</mapper>