75 lines
3.2 KiB
XML
75 lines
3.2 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.zhwl.statistics.mapper.ZdyFinancialCompareMapper">
|
|
|
|
<resultMap type="ZdyFinancialCompareDataVO" id="ZdyFinancialCompareDataVOResult">
|
|
<result property="salesQuantity" column="sales_quantity"/>
|
|
<result property="salesAmount" column="sales_amount"/>
|
|
<result property="verificationNum" column="verification_num"/>
|
|
<result property="verificationAmount" column="verification_amount"/>
|
|
<result property="refundQuantity" column="refund_quantity"/>
|
|
<result property="refundAmount" column="refund_amount"/>
|
|
</resultMap>
|
|
|
|
<sql id="statisticsCommonQueryParam">
|
|
<if test="startDateTime != null and endDateTime != null ">
|
|
and ${query_create_time_table}.${query_time_field} between #{startDateTime} and #{endDateTime}
|
|
</if>
|
|
${params.dataScope}
|
|
</sql>
|
|
|
|
<select id="getCompareSaleData" parameterType="ZdyFinancialCompareQueryDTO"
|
|
resultMap="ZdyFinancialCompareDataVOResult">
|
|
SELECT
|
|
SUM( ztoi.buy_quantity ) AS sales_quantity,
|
|
SUM( ztoi.total_price ) AS sales_amount
|
|
FROM
|
|
zdy_ticket_order_item ztoi
|
|
LEFT JOIN sys_dept d ON d.dept_id = ztoi.dept_id
|
|
<where>
|
|
ztoi.payment_type = '200'
|
|
<include refid="statisticsCommonQueryParam">
|
|
<property name="query_create_time_table" value="ztoi"/>
|
|
<property name="query_time_field" value="create_time"/>
|
|
</include>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getCompareVerificationData" parameterType="ZdyFinancialCompareQueryDTO"
|
|
resultMap="ZdyFinancialCompareDataVOResult">
|
|
SELECT
|
|
SUM(ztod.buy_quantity) as verification_num,
|
|
SUM(ztod.actua_amount) as verification_amount
|
|
FROM
|
|
zdy_ticket_order_detail ztod
|
|
LEFT JOIN zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
|
|
LEFT JOIN sys_dept d ON d.dept_id = ztoi.dept_id
|
|
<where>
|
|
ztod.verification_type = '200'
|
|
<include refid="statisticsCommonQueryParam">
|
|
<property name="query_create_time_table" value="ztod"/>
|
|
<property name="query_time_field" value="create_time"/>
|
|
</include>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getCompareRefundData" parameterType="ZdyFinancialCompareQueryDTO"
|
|
resultMap="ZdyFinancialCompareDataVOResult">
|
|
SELECT
|
|
COUNT( DISTINCT ztof.order_id ) AS refund_quantity,
|
|
SUM( ztori.actual_price ) AS refund_amount
|
|
FROM
|
|
zdy_ticket_order_refund ztof
|
|
LEFT JOIN zdy_ticket_order_refund_item ztori ON ztori.refund_id = ztof.id
|
|
LEFT JOIN sys_dept d ON d.dept_id = ztori.dept_id
|
|
<where>
|
|
ztof.refund_status IN ( 2, 200 )
|
|
<include refid="statisticsCommonQueryParam">
|
|
<property name="query_create_time_table" value="ztof"/>
|
|
<property name="query_time_field" value="refund_time"/>
|
|
</include>
|
|
</where>
|
|
</select>
|
|
</mapper> |