|
@@ -46,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<result property="customerGrade" column="customer_grade" />
|
|
<result property="customerGrade" column="customer_grade" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
+
|
|
<sql id="selectPayOrderVo">
|
|
<sql id="selectPayOrderVo">
|
|
select order_id, order_no, station_id, station_name, status, consumer_id, consumer, oil_gun, oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt, discount_coupon_amt, discount_coupon, wx_amt, zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt, other_amt, dzk_amt, score, member_no, member_amt, print_count, pay_type, pay_way, oil_personnel, pay_date, created_date, order_type, car_no, customer_phone, customer_grade from pay_order
|
|
select order_id, order_no, station_id, station_name, status, consumer_id, consumer, oil_gun, oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt, discount_coupon_amt, discount_coupon, wx_amt, zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt, other_amt, dzk_amt, score, member_no, member_amt, print_count, pay_type, pay_way, oil_personnel, pay_date, created_date, order_type, car_no, customer_phone, customer_grade from pay_order
|
|
</sql>
|
|
</sql>
|
|
@@ -91,10 +92,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
|
|
<if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
|
|
<if test="customerPhone != null and customerPhone != ''"> and customer_phone = #{customerPhone}</if>
|
|
<if test="customerPhone != null and customerPhone != ''"> and customer_phone = #{customerPhone}</if>
|
|
<if test="customerGrade != null and customerGrade != ''"> and customer_grade = #{customerGrade}</if>
|
|
<if test="customerGrade != null and customerGrade != ''"> and customer_grade = #{customerGrade}</if>
|
|
|
|
+ <if test="likeConsumer != null and likeConsumer != ''"> and customer like concat('%',#{likeConsumer}, '%')</if>
|
|
|
|
+ <if test="likeCarNo != null and likeCarNo != ''"> and car_no like concat('%',#{likeCarNo}, '%') </if>
|
|
|
|
+ <if test="likeCustomerPhone != null and likeCustomerPhone != ''"> and customer_phone like concat('%',#{likeCustomerPhone}, '%') </if>
|
|
|
|
+ </where>
|
|
|
|
+ order by order_id desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!--查询导出数据-->
|
|
|
|
+ <select id="selectPayOrderExport" parameterType="PayOrder" resultMap="PayOrderResult">
|
|
|
|
+ select order_no,oil_name,oil_pirce,order_liters, amt,consumer,oil_personnel,oil_gun,pay_type,pay_way
|
|
|
|
+ from pay_order
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
|
+ <if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
+ <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
|
|
|
|
+ <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
|
|
|
|
+ <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
|
|
|
|
+ <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
|
|
|
|
+ <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
|
|
|
|
+ <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
|
|
|
|
+ <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
|
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
|
+ <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
|
|
|
|
+ <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
|
|
|
|
+ <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
|
|
|
|
+ <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
|
|
|
|
+ <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
|
|
|
|
+ <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
|
|
|
|
+ <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
|
|
|
|
+ <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
|
|
|
|
+ <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
|
|
|
|
+ <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
|
|
|
|
+ <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
|
|
|
|
+ <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
|
|
|
|
+ <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
|
|
|
|
+ <if test="score != null "> and score = #{score}</if>
|
|
|
|
+ <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
|
|
|
|
+ <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
|
|
|
|
+ <if test="printCount != null "> and print_count = #{printCount}</if>
|
|
|
|
+ <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
|
|
|
+ <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
|
|
|
|
+ <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
|
|
|
|
+ <if test="payDate != null "> and pay_date = #{payDate}</if>
|
|
|
|
+ <if test="createdDate != null "> and created_date = #{createdDate}</if>
|
|
|
|
+ <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
|
|
|
|
+ <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
|
|
|
|
+ <if test="customerPhone != null and customerPhone != ''"> and customer_phone = #{customerPhone}</if>
|
|
|
|
+ <if test="customerGrade != null and customerGrade != ''"> and customer_grade = #{customerGrade}</if>
|
|
</where>
|
|
</where>
|
|
order by order_id desc
|
|
order by order_id desc
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
<select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
|
|
<select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
|
|
<include refid="selectPayOrderVo"/>
|
|
<include refid="selectPayOrderVo"/>
|
|
where order_id = #{orderId}
|
|
where order_id = #{orderId}
|
|
@@ -105,10 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<where>
|
|
<where>
|
|
<if test="createdDate != null "> and created_date like concat(#{createdDate}, '%') </if>
|
|
<if test="createdDate != null "> and created_date like concat(#{createdDate}, '%') </if>
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
- AND date_format(created_date,'%y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
|
|
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</if>
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
- AND date_format(created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
|
|
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
@@ -118,10 +168,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<where>
|
|
<where>
|
|
<if test="createdDate != null "> and created_date = #{createdDate}</if>
|
|
<if test="createdDate != null "> and created_date = #{createdDate}</if>
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
- AND date_format(created_date,'%y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
|
|
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</if>
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
- AND date_format(created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
|
|
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
GROUP BY oil_type
|
|
GROUP BY oil_type
|
|
@@ -132,19 +182,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<where>
|
|
<where>
|
|
<if test="createdDate != null "> and created_date = #{createdDate}</if>
|
|
<if test="createdDate != null "> and created_date = #{createdDate}</if>
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
- AND date_format(created_date,'%y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
|
|
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</if>
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
- AND date_format(created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
|
|
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
+ <!--日报数据-->
|
|
<select id="selectDayReport" parameterType="Long" resultMap="PayOrderResult">
|
|
<select id="selectDayReport" parameterType="Long" resultMap="PayOrderResult">
|
|
SELECT date_format( b.pay_date, '%Y-%m-%d' ) as pay_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
|
|
SELECT date_format( b.pay_date, '%Y-%m-%d' ) as pay_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
|
|
from (SELECT a.*,(SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=2) as qyamt , (SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=1) as cyamt
|
|
from (SELECT a.*,(SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=2) as qyamt , (SELECT sum(amt) as qyamt from pay_order where order_no=a.order_no and oil_type=1) as cyamt
|
|
from pay_order a) b
|
|
from pay_order a) b
|
|
GROUP BY date_format( pay_date, '%Y-%m-%d' )
|
|
GROUP BY date_format( pay_date, '%Y-%m-%d' )
|
|
</select>
|
|
</select>
|
|
|
|
+<!-- 日报折线图油品数据-->
|
|
|
|
+ <select id="listQydata" parameterType="Long" resultMap="PayOrderResult">
|
|
|
|
+ SELECT sum(amt) as amt,date_format(created_date,'%Y-%m-%d') as created_date
|
|
|
|
+ from pay_order
|
|
|
|
+ <where>
|
|
|
|
+ <if test="oilName != null "> and oil_name = #{oilName}</if>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY oil_name ,date_format(created_date,'%Y-%m-%d')
|
|
|
|
+ </select>
|
|
|
|
+<!-- 日报折线图X轴数据-->
|
|
|
|
+ <select id="listXdata" parameterType="Long" resultMap="PayOrderResult">
|
|
|
|
+ SELECT date_format(created_date,'%Y-%m-%d') as created_date
|
|
|
|
+ from pay_order
|
|
|
|
+ <where>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(created_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY date_format(created_date,'%Y-%m-%d')
|
|
|
|
+ </select>
|
|
<insert id="insertPayOrder" parameterType="PayOrder" useGeneratedKeys="true" keyProperty="orderId">
|
|
<insert id="insertPayOrder" parameterType="PayOrder" useGeneratedKeys="true" keyProperty="orderId">
|
|
insert into pay_order
|
|
insert into pay_order
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|