|
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
|
|
|
<include refid="selectPayOrderVo"/>
|
|
|
<where>
|
|
|
- <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
|
|
|
<if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
<if test="status != null and status != ''"> and p.status = #{status}</if>
|
|
|
<if test="consumerId != null "> and consumer_id = #{consumerId}</if>
|
|
@@ -281,24 +281,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
<!--日报数据-->
|
|
|
<select id="selectDayReport" parameterType="Long" resultMap="PayOrderResult">
|
|
|
- SELECT date_format( b.created_date, '%Y-%m-%d' ) as created_date,sum(b.amt) as amt,sum(b.qyamt) as qy_amt, sum(b.cyamt) as cy_amt,sum(b.order_liters) as order_liters ,count(b.order_no) order_no ,sum(b.member_amt) as menber_amt,sum(receivable_amt) as receivable_amt,sum(received_amt) as received_amt
|
|
|
- from (SELECT a.*,(SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=1) as qyamt , (SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=2) as cyamt
|
|
|
- from pay_order a
|
|
|
- <where>
|
|
|
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
|
|
|
- <if test="status != null "> and a.status = #{status}</if>
|
|
|
- <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
|
|
|
- <if test="stationIdList != null ">
|
|
|
- and a.station_id in
|
|
|
- <foreach item="item" index="index" collection="stationIdList"
|
|
|
- open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) b
|
|
|
- GROUP BY date_format( created_date, '%Y-%m-%d' )
|
|
|
- ORDER BY date_format( created_date, '%Y-%m-%d' ) DESC
|
|
|
+ SELECT
|
|
|
+ b.created_date,
|
|
|
+ sum( b.amt ) amt,
|
|
|
+ sum( b.order_liters ) order_liters,
|
|
|
+ sum( b.member_amt ) member_amt,
|
|
|
+ sum( b.receivable_amt ) receivable_amt,
|
|
|
+ sum( b.received_amt ) received_amt,
|
|
|
+ MAX(CASE b.oil_type WHEN '1' THEN amt ELSE 0 END) AS qy_amt,
|
|
|
+ MAX(CASE b.oil_type WHEN '2' THEN amt ELSE 0 END) AS cy_amt,
|
|
|
+ sum(b.order_no) order_no
|
|
|
+ from (
|
|
|
+ SELECT
|
|
|
+ date_format( a.created_date, '%Y-%m-%d' ) as created_date,
|
|
|
+ sum( a.amt ) amt,
|
|
|
+ sum( a.order_liters ) order_liters,
|
|
|
+ sum( a.member_amt ) member_amt,
|
|
|
+ sum( a.receivable_amt ) receivable_amt,
|
|
|
+ sum( a.received_amt ) received_amt,
|
|
|
+ a.oil_type,
|
|
|
+ count( 1 ) order_no
|
|
|
+ FROM
|
|
|
+ pay_order a
|
|
|
+ <where>
|
|
|
+ <if test="stationId != null "> and a.station_id = #{stationId}</if>
|
|
|
+ <if test="status != null "> and a.status = #{status}</if>
|
|
|
+ <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
|
|
|
+ <if test="stationIdList != null ">
|
|
|
+ and a.station_id in
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
+ open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ date_format( a.created_date, '%Y-%m-%d' ),a.oil_type
|
|
|
+ ) b
|
|
|
+ GROUP BY b.created_date
|
|
|
+ ORDER BY b.created_date desc
|
|
|
</select>
|
|
|
<!-- 日报折线图油品数据-->
|
|
|
<select id="listQydata" parameterType="Long" resultMap="PayOrderResult">
|