|
@@ -41,12 +41,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="payDate" column="pay_date" />
|
|
|
<result property="createdDate" column="created_date" />
|
|
|
<result property="orderType" column="order_type" />
|
|
|
- <result property="cyAmt" column="cy_amt" />
|
|
|
- <result property="qyAmt" column="qy_amt" />
|
|
|
+ <result property="carNo" column="car_no" />
|
|
|
+ <result property="customerPhone" column="customer_phone" />
|
|
|
+ <result property="customerGrade" column="customer_grade" />
|
|
|
</resultMap>
|
|
|
|
|
|
<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 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>
|
|
|
|
|
|
<select id="selectPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
|
|
@@ -60,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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 oilPirce != ''"> and oil_pirce = #{oilPirce}</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>
|
|
@@ -83,72 +84,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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="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>
|
|
|
-<!-- <if test="payDate != null "> and pay_date = #{payDate}</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>
|
|
|
- ORDER BY created_date DESC
|
|
|
+ order by order_id desc
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
|
|
|
<include refid="selectPayOrderVo"/>
|
|
|
where order_id = #{orderId}
|
|
|
</select>
|
|
|
- <select id="selectDaySources" parameterType="Long" resultMap="PayOrderResult">
|
|
|
- SELECT SUM(amt) as amt,sum(order_liters) as order_liters
|
|
|
- from pay_order
|
|
|
- <where>
|
|
|
- <if test="createdDate != null "> and created_date like concat(#{createdDate}, '%') </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>
|
|
|
- </select>
|
|
|
- <select id="selectOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
|
|
|
- SELECT SUM(amt) as amt,sum(order_liters) as order_liters, oil_type
|
|
|
- from pay_order
|
|
|
- <where>
|
|
|
- <if test="createdDate != null "> and created_date = #{createdDate}</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_type
|
|
|
- </select>
|
|
|
- <select id="selectOverViewData" parameterType="Long" resultMap="PayOrderResult">
|
|
|
- SELECT SUM(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt, sum(pos_amt) as pos_amt, sum(xj_amt) as xj_amt,sum(didi_app_amt) as didi_app_amt,sum(ty_app_amt) as ty_app_amt,sum(other_amt) as other_amt,sum(member_amt) as member_amt
|
|
|
- from pay_order
|
|
|
- <where>
|
|
|
- <if test="createdDate != null "> and created_date = #{createdDate}</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>
|
|
|
- </select>
|
|
|
- <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
|
|
|
- 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
|
|
|
- GROUP BY date_format( pay_date, '%Y-%m-%d' )
|
|
|
- </select>
|
|
|
+
|
|
|
<insert id="insertPayOrder" parameterType="PayOrder" useGeneratedKeys="true" keyProperty="orderId">
|
|
|
insert into pay_order
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
@@ -187,6 +138,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="payDate != null">pay_date,</if>
|
|
|
<if test="createdDate != null">created_date,</if>
|
|
|
<if test="orderType != null">order_type,</if>
|
|
|
+ <if test="carNo != null">car_no,</if>
|
|
|
+ <if test="customerPhone != null">customer_phone,</if>
|
|
|
+ <if test="customerGrade != null">customer_grade,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="orderNo != null">#{orderNo},</if>
|
|
@@ -224,6 +178,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="payDate != null">#{payDate},</if>
|
|
|
<if test="createdDate != null">#{createdDate},</if>
|
|
|
<if test="orderType != null">#{orderType},</if>
|
|
|
+ <if test="carNo != null">#{carNo},</if>
|
|
|
+ <if test="customerPhone != null">#{customerPhone},</if>
|
|
|
+ <if test="customerGrade != null">#{customerGrade},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
@@ -265,6 +222,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="payDate != null">pay_date = #{payDate},</if>
|
|
|
<if test="createdDate != null">created_date = #{createdDate},</if>
|
|
|
<if test="orderType != null">order_type = #{orderType},</if>
|
|
|
+ <if test="carNo != null">car_no = #{carNo},</if>
|
|
|
+ <if test="customerPhone != null">customer_phone = #{customerPhone},</if>
|
|
|
+ <if test="customerGrade != null">customer_grade = #{customerGrade},</if>
|
|
|
</trim>
|
|
|
where order_id = #{orderId}
|
|
|
</update>
|