82 lines
3.4 KiB
XML
82 lines
3.4 KiB
XML
<?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.suisung.mall.pay.mapper.PayConsumeTradeMapper">
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
consume_trade_id
|
|
, trade_title, order_id, buyer_id, store_id, subsite_id, seller_id, chain_id, trade_is_paid, order_state_id, trade_type_id, payment_channel_id, app_id, server_id, trade_mode_id, recharge_level_id, currency_id, currency_symbol_left, order_payment_amount, order_commission_fee, trade_payment_amount, trade_payment_money, trade_payment_recharge_card, trade_payment_points, trade_payment_sp, trade_payment_credit, trade_payment_redpack, trade_discount, trade_amount, trade_date, trade_year, trade_month, trade_day, trade_desc, trade_remark, trade_create_time, trade_pay_time, trade_finish_time, trade_delete
|
|
</sql>
|
|
<select id="getOrderPaymentAmount" resultType="java.math.BigDecimal">
|
|
SELECT
|
|
SUM( trade_amount )
|
|
FROM
|
|
pay_consume_trade
|
|
<where>
|
|
<if test="queryMap.trade_is_paid != null">
|
|
AND trade_is_paid = #{queryMap.trade_is_paid}
|
|
</if>
|
|
<if test="queryMap.store_id != null">
|
|
AND store_id = #{queryMap.store_id}
|
|
</if>
|
|
<if test="queryMap.subsite_id != null">
|
|
AND subsite_id = #{queryMap.subsite_id}
|
|
</if>
|
|
<if test="queryMap.trade_type_id != null">
|
|
trade_type_id in
|
|
<foreach collection="trade_type_ids" item="trade_type_id" separator="," open="(" close=")" index="">
|
|
#{trade_type_id}
|
|
</foreach>
|
|
</if>
|
|
<if test="queryMap.gt_trade_create_time != null">
|
|
AND trade_create_time > #{queryMap.gt_trade_create_time}
|
|
</if>
|
|
<if test="queryMap.lt_trade_create_time != null">
|
|
AND trade_create_time < #{queryMap.lt_trade_create_time}
|
|
</if>
|
|
<if test="queryMap.ge_trade_create_time != null">
|
|
AND trade_create_time >= #{queryMap.ge_trade_create_time}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getTradeAmount" resultType="com.suisung.mall.common.pojo.vo.TradeAmountVo">
|
|
SELECT
|
|
sum( order_payment_amount ) AS amount
|
|
FROM
|
|
pay_consume_trade
|
|
where
|
|
trade_is_paid IN ( 3012, 3013 )
|
|
<if test="startTime != null and endTime != null">
|
|
AND trade_paid_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
AND trade_type_id IN ( 1201, 1214 )
|
|
<if test="buyerId != null">
|
|
AND buyer_id = #{buyerId}
|
|
</if>
|
|
<if test="subsiteId != null">
|
|
AND subsite_id = #{subsiteId}
|
|
</if>
|
|
<if test="storeId != null">
|
|
AND store_id = #{storeId}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="getPayTimeLine" resultType="com.suisung.mall.common.pojo.output.TimelineOutput">
|
|
SELECT
|
|
FROM_UNIXTIME(trade_paid_time / 1000, '%m-%d') AS time,
|
|
sum( order_payment_amount ) num
|
|
FROM
|
|
pay_consume_trade
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND trade_paid_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
</where>
|
|
GROUP BY time
|
|
ORDER BY trade_paid_time
|
|
</select>
|
|
|
|
</mapper>
|