<?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.taobao.TaoBaoWeiQuanOrderMapper">
|
<resultMap id="BaseResultMap"
|
type="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">
|
<id column="tmo_id" property="id" jdbcType="BIGINT" />
|
<result column="tmo_order_id" property="orderId" jdbcType="VARCHAR" />
|
<result column="tmo_order_item_id" property="orderItemId"
|
jdbcType="VARCHAR" />
|
<result column="tmo_goods_name" property="goodsName" jdbcType="VARCHAR" />
|
<result column="tmo_money" property="money" jdbcType="DECIMAL" />
|
<result column="tmo_fan_money" property="fanMoney" jdbcType="DECIMAL" />
|
<result column="tmo_state" property="state" jdbcType="VARCHAR" />
|
<result column="tmo_jiesuan_time" property="jieSuanTime"
|
jdbcType="TIMESTAMP" />
|
<result column="tmo_weiquan_time" property="weiQuanTime"
|
jdbcType="TIMESTAMP" />
|
<result column="tmo_weiquan_finish_time" property="weiQuanFinishTime"
|
jdbcType="TIMESTAMP" />
|
<result column="tmo_createtime" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="tmo_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
|
<result column="tmo_settlement" property="settlement" jdbcType="DECIMAL" />
|
</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">tmo_id,tmo_order_id,tmo_order_item_id,tmo_goods_name,tmo_money,tmo_fan_money,tmo_state,tmo_jiesuan_time,tmo_weiquan_time,tmo_weiquan_finish_time,tmo_createtime,tmo_updatetime,tmo_settlement
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order where tmo_id =
|
#{id,jdbcType=BIGINT}
|
</select>
|
<select id="selectByOrderIdAndOrderItemId" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and
|
tmo_order_item_id=#{orderItemId}
|
</select>
|
<select id="selectListByOrderIdAndState" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and
|
tmo_state like '${state}%'
|
</select>
|
<select id="selectByOrderItemId" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order where tmo_order_item_id =#{0}
|
</select>
|
|
|
<select id="listByOrderId" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order
|
where tmo_order_id=#{0}
|
</select>
|
|
|
<select id="listByState" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order
|
<if test="state!=null">where tmo_state like '${state}%'</if>
|
order by tmo_createtime desc limit #{start},#{count}
|
</select>
|
|
<select id="countByState" resultType="java.lang.Long"
|
parameterType="java.lang.String">
|
select
|
count(*)
|
from yeshi_ec_taobao_weiqaun_order
|
<if test="state!=null">where tmo_state like '${state}%'</if>
|
</select>
|
|
|
<select id="selectByOrderItem" resultMap="BaseResultMap" parameterType="java.lang.String">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_weiqaun_order
|
where tmo_order_item_id=#{0}
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_taobao_weiqaun_order where tmo_id = #{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder"
|
useGeneratedKeys="true" keyProperty="id">insert into
|
yeshi_ec_taobao_weiqaun_order
|
(tmo_id,tmo_order_id,tmo_order_item_id,tmo_goods_name,tmo_money,tmo_fan_money,tmo_state,tmo_jiesuan_time,tmo_weiquan_time,tmo_weiquan_finish_time,tmo_createtime,tmo_updatetime,tmo_settlement)
|
values
|
(#{id,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{orderItemId,jdbcType=VARCHAR},#{goodsName,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{fanMoney,jdbcType=DECIMAL},#{state,jdbcType=VARCHAR},#{jieSuanTime,jdbcType=TIMESTAMP},#{weiQuanTime,jdbcType=TIMESTAMP},#{weiQuanFinishTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{settlement,jdbcType=DECIMAL})
|
</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_taobao_weiqaun_order
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">tmo_id,</if>
|
<if test="orderId != null">tmo_order_id,</if>
|
<if test="orderItemId != null">tmo_order_item_id,</if>
|
<if test="goodsName != null">tmo_goods_name,</if>
|
<if test="money != null">tmo_money,</if>
|
<if test="fanMoney != null">tmo_fan_money,</if>
|
<if test="state != null">tmo_state,</if>
|
<if test="jieSuanTime != null">tmo_jiesuan_time,</if>
|
<if test="weiQuanTime != null">tmo_weiquan_time,</if>
|
<if test="weiQuanFinishTime != null">tmo_weiquan_finish_time,</if>
|
<if test="createTime != null">tmo_createtime,</if>
|
<if test="updateTime != null">tmo_updatetime,</if>
|
<if test="settlement != null">tmo_settlement,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
|
<if test="orderItemId != null">#{orderItemId,jdbcType=VARCHAR},</if>
|
<if test="goodsName != null">#{goodsName,jdbcType=VARCHAR},</if>
|
<if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
<if test="fanMoney != null">#{fanMoney,jdbcType=DECIMAL},</if>
|
<if test="state != null">#{state,jdbcType=VARCHAR},</if>
|
<if test="jieSuanTime != null">#{jieSuanTime,jdbcType=TIMESTAMP},</if>
|
<if test="weiQuanTime != null">#{weiQuanTime,jdbcType=TIMESTAMP},</if>
|
<if test="weiQuanFinishTime != null">#{weiQuanFinishTime,jdbcType=TIMESTAMP},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="settlement != null">#{settlement,jdbcType=DECIMAL}</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">update
|
yeshi_ec_taobao_weiqaun_order set tmo_order_id =
|
#{orderId,jdbcType=VARCHAR},tmo_order_item_id =
|
#{orderItemId,jdbcType=VARCHAR},tmo_goods_name =
|
#{goodsName,jdbcType=VARCHAR},tmo_money =
|
#{money,jdbcType=DECIMAL},tmo_fan_money =
|
#{fanMoney,jdbcType=DECIMAL},tmo_state =
|
#{state,jdbcType=VARCHAR},tmo_jiesuan_time =
|
#{jieSuanTime,jdbcType=TIMESTAMP},tmo_weiquan_time =
|
#{weiQuanTime,jdbcType=TIMESTAMP},tmo_weiquan_finish_time =
|
#{weiQuanFinishTime,jdbcType=TIMESTAMP},tmo_createtime =
|
#{createTime,jdbcType=TIMESTAMP},tmo_updatetime =
|
#{updateTime,jdbcType=TIMESTAMP} ,tmo_settlement
|
=#{settlement,jdbcType=DECIMAL} where tmo_id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">
|
update yeshi_ec_taobao_weiqaun_order
|
<set>
|
<if test="orderId != null">tmo_order_id=#{orderId,jdbcType=VARCHAR},</if>
|
<if test="orderItemId != null">tmo_order_item_id=#{orderItemId,jdbcType=VARCHAR},</if>
|
<if test="goodsName != null">tmo_goods_name=#{goodsName,jdbcType=VARCHAR},</if>
|
<if test="money != null">tmo_money=#{money,jdbcType=DECIMAL},</if>
|
<if test="fanMoney != null">tmo_fan_money=#{fanMoney,jdbcType=DECIMAL},</if>
|
<if test="state != null">tmo_state=#{state,jdbcType=VARCHAR},</if>
|
<if test="jieSuanTime != null">tmo_jiesuan_time=#{jieSuanTime,jdbcType=TIMESTAMP},</if>
|
<if test="weiQuanTime != null">tmo_weiquan_time=#{weiQuanTime,jdbcType=TIMESTAMP},</if>
|
<if test="weiQuanFinishTime != null">tmo_weiquan_finish_time=#{weiQuanFinishTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createTime != null">tmo_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">tmo_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="settlement !=null">tmo_settlement =#{settlement,jdbcType=DECIMAL},</if>
|
</set>
|
where tmo_id = #{id,jdbcType=BIGINT}
|
</update>
|
<sql id="Column_DateType">
|
<if test="dateType == 1">DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') AS 'showDate'
|
</if>
|
<if test="dateType == 2">DATE_FORMAT(t.`tmo_weiquan_time`,'%m') AS 'showDate'</if>
|
<if test="dateType == 3">DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') AS 'showDate'</if>
|
</sql>
|
<sql id="Count_Select_DateType">
|
<if test="startTime != null and startTime != '' ">
|
AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
</if>
|
<if test="endTime != null and endTime != '' ">
|
AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
|
</if>
|
<if test="year != null and year != '' ">AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') = '${year}'
|
</if>
|
</sql>
|
<sql id="Count_Group_DateType">
|
<if test="dateType == 1">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')</if>
|
<if test="dateType == 2">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m')</if>
|
<if test="dateType == 3">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y')</if>
|
</sql>
|
<select id="countWeiQaunOrderNumber" resultMap="ChartMap">
|
SELECT IFNULL(COUNT(t.`tmo_id`),0) AS showValue,
|
<include refid="Column_DateType" />
|
FROM yeshi_ec_taobao_weiqaun_order t WHERE t.`tmo_createtime`IS NOT
|
NULL
|
<include refid="Count_Select_DateType" />
|
<include refid="Count_Group_DateType" />
|
ORDER BY t.`tmo_weiquan_time`
|
</select>
|
<select id="countWeiQaunOrderMoney" resultMap="ChartMap">
|
SELECT CAST(SUM(t.`tmo_fan_money`)AS DECIMAL(19,2)) AS showValue,
|
<include refid="Column_DateType" />
|
FROM yeshi_ec_taobao_weiqaun_order t WHERE t.`tmo_createtime` IS NOT
|
NULL
|
<include refid="Count_Select_DateType" />
|
<include refid="Count_Group_DateType" />
|
ORDER BY t.`tmo_weiquan_time`
|
</select>
|
</mapper>
|