<?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="VARCHAR"/>
|
<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"/>
|
<result column="po_fail_reason" property="failReason" jdbcType="VARCHAR"/>
|
</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,po_fail_reason</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>
|
|
|
<select id="listByOrderSn" resultMap="BaseResultMap">select
|
<include refid="Base_Column_List"/>
|
from yeshi_ec_pdd_order where
|
<foreach collection="orderSnList" item="orderSn" separator=" or " open="(" close=")">
|
po_order_sn=#{orderSn}
|
</foreach>
|
</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,po_fail_reason) values (#{id,jdbcType=BIGINT},#{orderSn,jdbcType=VARCHAR},#{goodsId,jdbcType=VARCHAR},#{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},#{failReason,jdbcType=VARCHAR})</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>
|
<if test="failReason != null">po_fail_reason,</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=VARCHAR},</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>
|
<if test="failReason != null">#{failReason,jdbcType=VARCHAR}</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=VARCHAR},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} ,po_fail_reason =#{failReason,jdbcType=VARCHAR} 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=VARCHAR},</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>
|
<if test="failReason !=null">po_fail_reason =#{failReason,jdbcType=VARCHAR},</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>
|