123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485 |
- <?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.yijia.station.mapper.PayOrderMapper">
- <resultMap type="PayOrder" id="PayOrderResult">
- <result property="orderId" column="order_id" />
- <result property="orderNo" column="order_no" />
- <result property="stationId" column="station_id" />
- <result property="stationName" column="station_name" />
- <result property="status" column="status" />
- <result property="consumerId" column="consumer_id" />
- <result property="consumer" column="consumer" />
- <result property="oilGun" column="oil_gun" />
- <result property="oilName" column="oil_name" />
- <result property="oilPirce" column="oil_pirce" />
- <result property="oilType" column="oil_type" />
- <result property="orderLiters" column="order_liters" />
- <result property="amt" column="amt" />
- <result property="receivableAmt" column="receivable_amt" />
- <result property="receivedAmt" column="received_amt" />
- <result property="discountAmt" column="discount_amt" />
- <result property="discountCouponAmt" column="discount_coupon_amt" />
- <result property="discountCoupon" column="discount_coupon" />
- <result property="wxAmt" column="wx_amt" />
- <result property="zfbAmt" column="zfb_amt" />
- <result property="posAmt" column="pos_amt" />
- <result property="xjAmt" column="xj_amt" />
- <result property="didiAppAmt" column="didi_app_amt" />
- <result property="tyAppAmt" column="ty_app_amt" />
- <result property="otherAmt" column="other_amt" />
- <result property="dzkAmt" column="dzk_amt" />
- <result property="score" column="score" />
- <result property="memberNo" column="member_no" />
- <result property="memberAmt" column="member_amt" />
- <result property="printCount" column="print_count" />
- <result property="payType" column="pay_type" />
- <result property="payWay" column="pay_way" />
- <result property="oilPersonnel" column="oil_personnel" />
- <result property="oilPersonnelId" column="oil_personnel_id" />
- <result property="payDate" column="pay_date" />
- <result property="createdDate" column="created_date" />
- <result property="orderType" column="order_type" />
- <result property="carNo" column="car_no" />
- <result property="customerPhone" column="customer_phone" />
- <result property="customerGrade" column="customer_grade" />
- <result property="wxNum" column="wx_num" />
- <result property="zfbNum" column="zfb_num" />
- <result property="xjNum" column="xj_num" />
- <result property="qyAmt" column="qy_amt" />
- <result property="cyAmt" column="cy_amt" />
- <result property="sellAmt" column="sell_amt" />
- <result property="sellDiscountAmt" column="sell_discount_amt" />
- <result property="mobilePhone" column="mobile_phone" />
- <result property="sellOilPrice" column="sell_oil_price" />
- <result property="driverOilPrice" column="driver_oil_price" />
- <result property="countNum" column="count_num" />
- <result property="driverDiscountAmt" column="driver_discount_amt" />
- <result property="refundUser" column="refund_user" />
- <result property="refundDate" column="refund_date" />
- <result property="examinUser" column="examin_user" />
- <result property="examinDate" column="examin_date" />
- <result property="examinStatus" column="examin_status" />
- <result property="refundSuccessDate" column="refund_success_date" />
- <result property="dzkNum" column="dzk_num" />
- <result property="num" column="num" />
- <result property="printNum" column="print_num" />
- <result property="userName" column="user_name" />
- <result property="thirdPayment" column="third_payment" />
- </resultMap>
- <sql id="selectPayOrderVo">
- select order_id, order_no, station_id,d.dept_name as station_name, p.status,consumer_id, consumer, oil_gun,
- oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt,sell_oil_price,driver_oil_price,oil_personnel_id,
- 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,sell_amt,sell_discount_amt,driver_discount_amt,
- examin_user,examin_date,refund_user,refund_date,examin_status,refund_success_date,p.third_payment
- from pay_order p join sys_dept d on p.station_id =d.dept_id
- </sql>
- <select id="selectPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
- <include refid="selectPayOrderVo"/>
- <where>
- <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="status == null or status == ''"> and p.status != 0 and p.status != 5 </if>
- <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
- <if test="consumer != null and consumer != ''"> and consumer like concat('%', #{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="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</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>
- <if test="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
- <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
- <if test="thirdPayment != null and thirdPayment != ''"> and p.third_payment = #{thirdPayment}</if>
- <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
- <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
- <if test="examinStatus != null and examinStatus != ''">
- <if test="examinStatus == '-1'">
- and examin_status !=0 and examin_status is not NULL
- </if>
- <if test="examinStatus != '-1'">
- and examin_status = #{examinStatus}
- </if>
- </if>
- <if test="likeConsumer != null and likeConsumer != ''"> and consumer 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>
- <if test="refundSuccessStatus == '1'.toString() ">
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(refund_success_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(refund_success_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </if>
- <if test="refundSuccessStatus != '1'.toString() ">
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by order_id desc
- </select>
- <select id="selectAllPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT
- p.order_id,
- p.order_no,
- p.station_id,
- d.dept_name AS station_name,
- p.STATUS,
- p.consumer_id,
- p.consumer,
- p.oil_gun,
- p.oil_name,
- p.oil_pirce,
- p.oil_type,
- p.order_liters,
- p.amt,
- p.receivable_amt,
- p.received_amt,
- p.discount_amt,
- p.sell_oil_price,
- p.driver_oil_price,
- p.oil_personnel_id,
- p.discount_coupon_amt,
- p.discount_coupon,
- p.wx_amt,
- p.zfb_amt,
- p.pos_amt,
- p.xj_amt,
- p.didi_app_amt,
- p.ty_app_amt,
- p.other_amt,
- p.dzk_amt,
- p.score,
- p.member_no,
- p.member_amt,
- p.print_count,
- p.pay_type,
- p.pay_way,
- p.oil_personnel,
- p.pay_date,
- p.created_date,
- p.order_type,
- p.car_no,
- p.customer_phone,
- p.customer_grade,
- p.sell_amt,
- p.sell_discount_amt,
- p.driver_discount_amt,
- p.examin_user,
- p.examin_date,
- p.refund_user,
- p.refund_date,
- p.examin_status,
- p.refund_success_date,
- p.third_payment,
- a.mobile_phone
- FROM
- pay_order p
- JOIN sys_dept d ON p.station_id = d.dept_id
- left join app_user_info a on p.consumer_id=a.user_id
- <where>
- <if test="orderNo != null and orderNo != ''"> and p.order_no like concat('%', #{orderNo}, '%')</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and p.status = #{status}</if>
- <if test="status == null or status == ''"> and p.status != 5 </if>
- <if test="consumerId != null "> and p.consumer_id = #{consumerId}</if>
- <if test="consumer != null and consumer != ''"> and p.consumer like concat('%', #{consumer}, '%')</if>
- <if test="oilGun != null and oilGun != ''"> and p.oil_gun = #{oilGun}</if>
- <if test="oilName != null and oilName != ''"> and p.oil_name like concat('%', #{oilName}, '%')</if>
- <if test="oilPirce != null "> and p.oil_pirce = #{oilPirce}</if>
- <if test="mobilePhone != null "> and a.mobile_phone like concat('%', #{mobilePhone}, '%')</if>
- <if test="oilType != null and oilType != ''"> and p.oil_type = #{oilType}</if>
- <if test="orderLiters != null "> and p.order_liters = #{orderLiters}</if>
- <if test="amt != null "> and p.amt = #{amt}</if>
- <if test="receivableAmt != null "> and p.receivable_amt = #{receivableAmt}</if>
- <if test="receivedAmt != null "> and p.received_amt = #{receivedAmt}</if>
- <if test="discountAmt != null "> and p.discount_amt = #{discountAmt}</if>
- <if test="discountCouponAmt != null "> and p.discount_coupon_amt = #{discountCouponAmt}</if>
- <if test="discountCoupon != null and discountCoupon != ''"> and p.discount_coupon = #{discountCoupon}</if>
- <if test="wxAmt != null "> and p.wx_amt = #{wxAmt}</if>
- <if test="zfbAmt != null "> and p.zfb_amt = #{zfbAmt}</if>
- <if test="posAmt != null "> and p.pos_amt = #{posAmt}</if>
- <if test="xjAmt != null "> and p.xj_amt = #{xjAmt}</if>
- <if test="didiAppAmt != null "> and p.didi_app_amt = #{didiAppAmt}</if>
- <if test="tyAppAmt != null "> and p.ty_app_amt = #{tyAppAmt}</if>
- <if test="otherAmt != null "> and p.other_amt = #{otherAmt}</if>
- <if test="dzkAmt != null "> and p.dzk_amt = #{dzkAmt}</if>
- <if test="score != null "> and p.score = #{score}</if>
- <if test="memberNo != null and memberNo != ''"> and p.member_no = #{memberNo}</if>
- <if test="memberAmt != null "> and p.member_amt = #{memberAmt}</if>
- <if test="printCount != null "> and p.print_count = #{printCount}</if>
- <if test="payType != null and payType != ''"> and p.pay_type = #{payType}</if>
- <if test="payWay != null and payWay != ''"> and p.pay_way = #{payWay}</if>
- <if test="oilPersonnel != null and oilPersonnel != ''"> and p.oil_personnel = #{oilPersonnel}</if>
- <if test="oilPersonnelId != null and oilPersonnelId != ''"> and p.oil_personnel_id = #{oilPersonnelId}</if>
- <if test="payDate != null "> and p.pay_date = #{payDate}</if>
- <if test="createdDate != null "> and p.created_date = #{createdDate}</if>
- <if test="orderType != null and orderType != ''"> and p.order_type = #{orderType}</if>
- <if test="carNo != null and carNo != ''"> and p.car_no = #{carNo}</if>
- <if test="customerPhone != null and customerPhone != ''"> and p.customer_phone = #{customerPhone}</if>
- <if test="customerGrade != null and customerGrade != ''"> and p.customer_grade = #{customerGrade}</if>
- <if test="refundUser != null and refundUser != ''"> and p.refund_user = #{refundUser}</if>
- <if test="refundDate != null and refundDate != ''"> and p.refund_date = #{refundDate}</if>
- <if test="thirdPayment != null and thirdPayment != ''"> and p.third_payment = #{thirdPayment}</if>
- <if test="examinUser != null and examinUser != ''"> and p.examin_user = #{examinUser}</if>
- <if test="examinDate != null and examinDate != ''"> and p.examin_date = #{examinDate}</if>
- <if test="examinStatus != null and examinStatus != ''">
- <if test="examinStatus == '-1'">
- and p.examin_status !=0 and p.examin_status is not NULL
- </if>
- <if test="examinStatus != '-1'">
- and p.examin_status = #{examinStatus}
- </if>
- </if>
- <if test="likeConsumer != null and likeConsumer != ''"> and p.consumer like concat('%',#{likeConsumer}, '%')</if>
- <if test="likeCarNo != null and likeCarNo != ''"> and p.car_no like concat('%',#{likeCarNo}, '%') </if>
- <if test="likeCustomerPhone != null and likeCustomerPhone != ''"> and p.customer_phone like concat('%',#{likeCustomerPhone}, '%') </if>
- <if test="refundSuccessStatus == '1'.toString() ">
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(p.refund_success_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(p.refund_success_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </if>
- <if test="refundSuccessStatus != '1'.toString() ">
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(p.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(p.created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by p.created_date 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,sell_oil_price,driver_oil_price,status
- 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="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5</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="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
- <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
- <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
- <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
- <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
- <if test="customerPhone != null and customerPhone != ''"> and customer_phone like concat('%',#{customerPhone}, '%') </if>
- <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </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>
- order by order_id desc
- </select>
- <!--用戶信息关联订单查询-->
- <select id="selectUserPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,amt,sell_amt,sell_discount_amt,amt,discount_amt,pay_date,mobile_phone as customer_phone,sell_oil_price,driver_oil_price,driver_discount_amt
- from pay_order p
- left join sys_dept d on d.dept_id =p.station_id
- join app_user_info a on a.user_id=p.consumer_id
- <where>
- <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and p.status = #{status}</if>
- <if test="status == null or status == ''"> and p.status != 0 and p.status != 5 </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="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</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="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
- <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
- <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
- <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
- <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
- <if test="customerPhone != null and customerPhone != ''"> and mobile_phone like concat('%',#{customerPhone}, '%') </if>
- <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(p.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(p.created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- order by order_id desc
- </select>
- <!--查询LNG导出数据-->
- <select id="selectLNGPayOrderExport" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,amt,sell_amt,sell_discount_amt,discount_amt,pay_date,mobile_phone,sell_oil_price,driver_oil_price,driver_discount_amt,p.status
- from pay_order p
- left join sys_dept d on d.dept_id =p.station_id
- left join app_user_info a on a.user_id=p.consumer_id
- <where>
- <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and p.status = #{status} </if>
- <if test="status == null or status == ''"> and p.status != 0 and p.status != 5 </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="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</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="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
- <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
- <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
- <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
- <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
- <if test="customerPhone != null and customerPhone != ''"> and mobile_phone like concat('%',#{customerPhone}, '%') </if>
- <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(p.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(p.created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- order by order_id desc
- </select>
- <select id="LNGDeptList" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT dept_name as station_name,order_id,order_no,oil_name,p.oil_pirce,sell_oil_price,order_liters,receivable_amt,sell_amt,sell_discount_amt,pay_date,driver_discount_amt,
- concat(LEFT (mobile_phone, 3), '****', RIGHT (mobile_phone, 4)) mobile_phone,p.status
- from pay_order p
- left join sys_dept d on d.dept_id =p.station_id
- left join app_user_info a on a.user_id=p.consumer_id
- <where>
- <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and p.status = #{status} </if>
- <if test="status == null or status == ''"> and p.status != 0 and p.status != 5 </if>
- <if test="consumerId != null "> and p.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="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
- <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
- <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
- <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
- <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
- <if test="customerPhone != null and customerPhone != ''"> and customer_phone like concat('%',#{customerPhone}, '%') </if>
- <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(p.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(p.created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- order by order_id desc
- </select>
- <select id="LNGDeptListAll" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT dept_name as station_name,order_id,order_no,oil_name,p.oil_pirce,sell_oil_price,order_liters,receivable_amt,sell_amt,sell_discount_amt,pay_date,driver_discount_amt,
- concat(LEFT (mobile_phone, 3), '****', RIGHT (mobile_phone, 4)) mobile_phone,p.status
- from pay_order p
- left join sys_dept d on d.dept_id =p.station_id
- left join app_user_info a on a.user_id=p.consumer_id
- <where>
- <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and p.status = #{status}</if>
- <if test="status == null or status == ''"> and p.status != 0 and p.status != 5 </if>
- <if test="consumerId != null "> and p.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 like concat('%',#{customerPhone}, '%') </if>
- <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(p.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(p.created_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- order by order_id desc
- </select>
- <select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
- select order_id, order_no, p.station_id, p.station_name, p.status,consumer_id, consumer, oil_gun,
- oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt,sell_oil_price,driver_oil_price,
- 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,oil_personnel_id,
- pay_date, created_date, order_type, car_no,customer_grade,sell_amt,sell_discount_amt,
- examin_user,examin_date,refund_user,refund_date,examin_status,refund_success_date,p.third_payment
- from pay_order p
- where order_id = #{orderId}
- </select>
- <select id="selectDaySources" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) as sell_amt,count(1) count_num
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and (status = #{status} or status=2 )</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <select id="selectAllDaySources" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) as sell_amt,count(1) count_num
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and (status = #{status} or status=2)</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <select id="selectOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
- SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) sell_amt, oil_type,count(1) count_num
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5</if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY oil_type
- </select>
- <select id="selectAllOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
- SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) sell_amt, oil_type,count(1) count_num
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and (status = #{status} or status=2)</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY oil_type
- </select>
- <select id="dayOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
- SELECT oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,sum(order_liters) as order_liters,SUM(receivable_amt) as receivable_amt,
- sum(discount_amt) as discount_amt,sum(discount_coupon_amt) as discount_coupon_amt,sum(amt) as amt,
- sum(member_amt) as member_amt,sum(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY oil_name
- </select>
- <select id="dayAllOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
- SELECT oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,sum(order_liters) as order_liters,SUM(receivable_amt) as receivable_amt,
- sum(discount_amt) as discount_amt,sum(discount_coupon_amt) as discount_coupon_amt,sum(amt) as amt,
- sum(member_amt) as member_amt,sum(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and (status = #{status} or status=2)</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY oil_name
- </select>
- <select id="selectOverViewData" parameterType="Long" resultMap="PayOrderResult">
- SELECT SUM(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt, sum(dzk_amt) as dzk_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="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <select id="selectAllOverViewData" parameterType="Long" resultMap="PayOrderResult">
- SELECT SUM(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt, sum(dzk_amt) as dzk_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="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null "> and (status = #{status} or status=2)</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <!--日报数据-->
- <select id="selectDayReport" parameterType="Long" resultMap="PayOrderResult">
- 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="status == null or status == ''"> and a.status != 0 and a.status != 5</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="selectAllDayReport" parameterType="Long" resultMap="PayOrderResult">
- 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} or a.status=2)</if>
- <if test="status == null or status == ''"> and a.status != 0 and a.status != 5 </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">
- SELECT sum(amt) as amt,date_format(created_date,'%Y-%m-%d') as created_date
- from pay_order
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <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>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </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="stationId != null "> and station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</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="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY date_format(created_date,'%Y-%m-%d')
- </select>
- <!--查询数据,根据员工汇总数据-->
- <select id="selectPersonnelPayOrder" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT a.oil_personnel,GROUP_CONCAT(DISTINCT a.oil_gun) as oil_gun,ROUND(SUM(a.amt),2) as amt,ROUND(SUM(order_liters),2) as order_liters,COUNT(order_no) as order_no
- from pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status != 0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY a.oil_personnel
- </select>
- <!--按照人员下统计信息-->
- <select id="listPersonnelPayOrderSum" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT
- SUM( amt ) AS amt,
- SUM( order_liters ) AS order_liters,
- SUM( order_no ) AS order_no
- FROM
- (
- SELECT
- a.oil_personnel,
- GROUP_CONCAT( DISTINCT a.oil_gun ) AS oil_gun,
- ROUND( SUM( a.amt ), 2 ) AS amt,
- ROUND( SUM( order_liters ), 2 ) AS order_liters,
- COUNT( order_no ) AS order_no
- FROM
- pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </where>
- GROUP BY a.oil_personnel ) b
- </select>
- <select id="listPersonnelPayOrder" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT
- a.oil_personnel,
- GROUP_CONCAT( DISTINCT a.oil_gun ) AS oil_gun,
- ROUND( SUM( a.amt ), 2 ) AS amt,
- ROUND( SUM( order_liters ), 2 ) AS order_liters,
- COUNT( order_no ) AS order_no
- FROM
- pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </where>
- GROUP BY a.oil_personnel
- </select>
- <select id="listPayTypeOrder" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT
- a.pay_type,
- GROUP_CONCAT( DISTINCT a.oil_gun ) AS oil_gun,
- ROUND( SUM( a.amt ), 2 ) AS amt,
- ROUND( SUM( order_liters ), 2 ) AS order_liters,
- COUNT( order_no ) AS order_no
- FROM
- pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </where>
- GROUP BY a.pay_type
- </select>
- <!--查询班结的合计数据值-->
- <select id="selectSummyClassPayOrder" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT
- s.station_id,
- d.dept_name as station_name,
- count( order_no ) AS num,
- sum( order_liters ) AS order_liters,
- sum( receivable_amt ) AS receivable_amt,
- sum( amt ) AS amt,
- sum( print_count ) AS print_num,
- sum( wx_amt ) AS wx_amt,
- sum( zfb_amt ) AS zfb_amt,
- sum( dzk_amt ) AS dzk_amt,
- sum( discount_amt ) AS discount_amt,
- SUM( pos_amt ) AS pos_amt,
- sum( xj_amt ) AS xj_amt
- FROM
- pay_order s left join sys_dept d on s.station_id=d.dept_id
- <where>
- <if test="stationId != null and stationId != ''"> and s.station_id = #{stationId}</if>
- <if test="orderType != null and orderType != ''"> and s.order_type = #{orderType}</if>
- <if test="status != null and status != ''"> and s.status = #{status}</if>
- <if test="status == null or status == ''"> and s.status !=0 and s.status != 5 </if>
- <if test="refundSelectFalg != 1 ">
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(s.pay_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(s.pay_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </if>
- <if test="refundSelectFalg == 1 ">
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(s.refund_success_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(s.refund_success_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </if>
- </where>
- GROUP BY station_id,d.dept_name
- </select>
- <!--按照油品信息获取分类当前班结的订单-->
- <select id="listOilPayOrder" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT
- a.station_id,
- a.oil_name,
- GROUP_CONCAT( DISTINCT oil_gun ) AS oil_gun,
- ROUND( SUM( a.amt ), 2 ) AS amt,
- ROUND( SUM( a.receivable_amt ), 2 ) AS receivable_amt,
- ROUND( SUM( a.received_amt ), 2 ) AS received_amt,
- ROUND( SUM( order_liters ), 2 ) AS order_liters,
- ROUND( SUM( a.discount_amt ), 2 ) AS discount_amt,
- COUNT( order_no ) AS order_no,
- sum( a.print_count) print_num
- FROM
- pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(a.pay_date,'%y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(a.pay_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- GROUP BY a.oil_name,a.station_id
- </select>
- <select id="listOilPayOrderSum" parameterType="PayOrder" resultMap="PayOrderResult">
- SELECT SUM(amt) as amt,SUM(amt) as amt,SUM(order_liters) as order_liters,sum(order_no) as order_no
- from
- ( SELECT
- a.station_id,
- a.oil_name,
- GROUP_CONCAT( DISTINCT oil_gun ) AS oil_gun,
- ROUND( SUM( a.amt ), 2 ) AS amt,
- ROUND( SUM( a.receivable_amt ), 2 ) AS receivable_amt,
- ROUND( SUM( a.received_amt ), 2 ) AS received_amt,
- ROUND( SUM( order_liters ), 2 ) AS order_liters,
- ROUND( SUM( a.discount_amt ), 2 ) AS discount_amt,
- COUNT( order_no ) AS order_no,
- sum( a.print_count) print_num
- FROM
- pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(a.pay_date,'%y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(a.pay_date,'%y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- GROUP BY a.oil_name,a.station_id)c
- </select>
- <!--初始化数据班结数据,根据油品汇总 -->
- <select id="selectOilStructure" parameterType="Long" resultMap="PayOrderResult">
- SELECT a.oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,ROUND(SUM(a.amt),2) as amt,ROUND(SUM(order_liters),2) as order_liters,COUNT(order_no) as order_no
- from pay_order a
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(pay_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(pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
- </if>
- </where>
- GROUP BY a.oil_name
- </select>
- <!--初始化数据班结数据,根据员工/支付方式汇总 -->
- <select id="selectPersonnelPayStructure" parameterType="Long" resultMap="PayOrderResult">
- SELECT
- oil_personnel,
- GROUP_CONCAT( DISTINCT oil_gun ) oil_gun,
- count( wx_amt ) wx_num,
- count( zfb_amt ) zfb_num,
- count( xj_amt ) xj_num,
- sum( discount_amt ) discount_amt,
- SUM( discount_coupon_amt ) discount_coupon_amt,
- SUM( wx_amt ) wx_amt,
- SUM( zfb_amt ) zfb_amt,
- SUM( xj_amt ) xj_amt,
- sum( member_amt ) member_amt,
- sum( dzk_amt ) dzk_amt,
- count( dzk_amt ) dzk_num ,
- user_name,
- sum(amt) amt
- FROM
- pay_order a left join sys_user b on a.refund_user=b.user_id
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and a.status = #{status}</if>
- <if test="status == null or status == ''"> and a.status !=0 and a.status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="refundSelectFalg != 1">
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(a.pay_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(a.pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </if>
- <if test="refundSelectFalg == 1">
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(a.refund_success_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(a.refund_success_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </if>
- </where>
- GROUP BY a.oil_personnel,b.user_name
- </select>
- <!--按照支付方式进行求和操作-->
- <select id="selectPersonnelPayStructureSum" parameterType="Long" resultMap="PayOrderResult">
- SELECT GROUP_CONCAT(DISTINCT oil_gun) oil_gun,
- sum(discount_amt) discount_amt,
- SUM(discount_coupon_amt) discount_coupon_amt,SUM(wx_amt) wx_amt,SUM(zfb_amt) zfb_amt,sum(dzk_amt) dzk_amt,
- SUM(xj_amt) xj_amt,sum(dzk_amt) dzk_amt,
- sum(e.xj_num) xj_num,sum(e.zfb_num) zfb_num,sum(e.wx_num) wx_num,sum(e.dzk_num) dzk_num
- from (
- SELECT
- oil_personnel,
- GROUP_CONCAT( DISTINCT oil_gun ) oil_gun,
- count( wx_amt ) wx_num,
- count( zfb_amt ) zfb_num,
- count( xj_amt ) xj_num,
- sum( discount_amt ) discount_amt,
- SUM( discount_coupon_amt ) discount_coupon_amt,
- SUM( wx_amt ) wx_amt,
- SUM( zfb_amt ) zfb_amt,
- SUM( xj_amt ) xj_amt,
- sum( member_amt ) member_amt,
- sum( dzk_amt ) dzk_amt,
- count( dzk_amt ) dzk_num ,
- user_name,
- sum(amt) amt
- FROM
- pay_order a left join sys_user b on a.refund_user=b.user_id
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="status != null and status != ''"> and a.status = #{status}</if>
- <if test="status == null or status == ''"> and a.status !=0 and a.status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- <if test="refundSelectFalg != 1">
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(a.pay_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(a.pay_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </if>
- <if test="refundSelectFalg == 1">
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- AND date_format(a.refund_success_date,'%Y-%m-%d %H:%i:%s') >= date_format(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- AND date_format(a.refund_success_date,'%Y-%m-%d %H:%i:%s') <= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- </if>
- </where>
- GROUP BY a.oil_personnel,b.user_name) e
- </select>
- <!--查询本站第一笔数据-->
- <select id="getPayOrderInfoMin" parameterType="Long" resultMap="PayOrderResult">
- SELECT * from pay_order where order_id = (
- SELECT min(order_id)
- 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="status != null and status != ''"> and status = #{status}</if>
- <if test="status == null or status == ''"> and status !=0 and status != 5 </if>
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
- </where>
- )
- </select>
- <insert id="insertPayOrder" parameterType="PayOrder" useGeneratedKeys="true" keyProperty="orderId">
- insert into pay_order
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">order_no,</if>
- <if test="stationId != null">station_id,</if>
- <if test="status != null">status,</if>
- <if test="consumerId != null">consumer_id,</if>
- <if test="consumer != null">consumer,</if>
- <if test="oilGun != null">oil_gun,</if>
- <if test="oilName != null">oil_name,</if>
- <if test="oilPirce != null">oil_pirce,</if>
- <if test="oilType != null">oil_type,</if>
- <if test="orderLiters != null">order_liters,</if>
- <if test="amt != null">amt,</if>
- <if test="receivableAmt != null">receivable_amt,</if>
- <if test="receivedAmt != null">received_amt,</if>
- <if test="discountAmt != null">discount_amt,</if>
- <if test="discountCouponAmt != null">discount_coupon_amt,</if>
- <if test="discountCoupon != null">discount_coupon,</if>
- <if test="wxAmt != null">wx_amt,</if>
- <if test="zfbAmt != null">zfb_amt,</if>
- <if test="posAmt != null">pos_amt,</if>
- <if test="xjAmt != null">xj_amt,</if>
- <if test="didiAppAmt != null">didi_app_amt,</if>
- <if test="tyAppAmt != null">ty_app_amt,</if>
- <if test="otherAmt != null">other_amt,</if>
- <if test="dzkAmt != null">dzk_amt,</if>
- <if test="score != null">score,</if>
- <if test="memberNo != null">member_no,</if>
- <if test="memberAmt != null">member_amt,</if>
- <if test="printCount != null">print_count,</if>
- <if test="payType != null">pay_type,</if>
- <if test="payWay != null">pay_way,</if>
- <if test="oilPersonnel != null">oil_personnel,</if>
- <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>
- <if test="refundUser != null">refund_user,</if>
- <if test="refundDate != null">refund_date,</if>
- <if test="examinUser != null">examin_user,</if>
- <if test="examinDate != null">examin_date,</if>
- <if test="examinStatus != null">examin_status,</if>
- <if test="refundSuccessDate != null">refund_success_date,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">#{orderNo},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="status != null">#{status},</if>
- <if test="consumerId != null">#{consumerId},</if>
- <if test="consumer != null">#{consumer},</if>
- <if test="oilGun != null">#{oilGun},</if>
- <if test="oilName != null">#{oilName},</if>
- <if test="oilPirce != null">#{oilPirce},</if>
- <if test="oilType != null">#{oilType},</if>
- <if test="orderLiters != null">#{orderLiters},</if>
- <if test="amt != null">#{amt},</if>
- <if test="receivableAmt != null">#{receivableAmt},</if>
- <if test="receivedAmt != null">#{receivedAmt},</if>
- <if test="discountAmt != null">#{discountAmt},</if>
- <if test="discountCouponAmt != null">#{discountCouponAmt},</if>
- <if test="discountCoupon != null">#{discountCoupon},</if>
- <if test="wxAmt != null">#{wxAmt},</if>
- <if test="zfbAmt != null">#{zfbAmt},</if>
- <if test="posAmt != null">#{posAmt},</if>
- <if test="xjAmt != null">#{xjAmt},</if>
- <if test="didiAppAmt != null">#{didiAppAmt},</if>
- <if test="tyAppAmt != null">#{tyAppAmt},</if>
- <if test="otherAmt != null">#{otherAmt},</if>
- <if test="dzkAmt != null">#{dzkAmt},</if>
- <if test="score != null">#{score},</if>
- <if test="memberNo != null">#{memberNo},</if>
- <if test="memberAmt != null">#{memberAmt},</if>
- <if test="printCount != null">#{printCount},</if>
- <if test="payType != null">#{payType},</if>
- <if test="payWay != null">#{payWay},</if>
- <if test="oilPersonnel != null">#{oilPersonnel},</if>
- <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>
- <if test="refundUser != null">#{refundUser},</if>
- <if test="refundDate != null">#{refundDate},</if>
- <if test="examinUser != null">#{examinUser},</if>
- <if test="examinDate != null">#{examinDate},</if>
- <if test="examinStatus != null">#{examinStatus},</if>
- <if test="refundSuccessDate != null">#{refundSuccessDate},</if>
- </trim>
- </insert>
- <update id="updatePayOrder" parameterType="PayOrder">
- update pay_order
- <trim prefix="SET" suffixOverrides=",">
- <if test="orderNo != null">order_no = #{orderNo},</if>
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="status != null">status = #{status},</if>
- <if test="consumerId != null">consumer_id = #{consumerId},</if>
- <if test="consumer != null">consumer = #{consumer},</if>
- <if test="oilGun != null">oil_gun = #{oilGun},</if>
- <if test="oilName != null">oil_name = #{oilName},</if>
- <if test="oilPirce != null">oil_pirce = #{oilPirce},</if>
- <if test="oilType != null">oil_type = #{oilType},</if>
- <if test="orderLiters != null">order_liters = #{orderLiters},</if>
- <if test="amt != null">amt = #{amt},</if>
- <if test="receivableAmt != null">receivable_amt = #{receivableAmt},</if>
- <if test="receivedAmt != null">received_amt = #{receivedAmt},</if>
- <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
- <if test="discountCouponAmt != null">discount_coupon_amt = #{discountCouponAmt},</if>
- <if test="discountCoupon != null">discount_coupon = #{discountCoupon},</if>
- <if test="wxAmt != null">wx_amt = #{wxAmt},</if>
- <if test="zfbAmt != null">zfb_amt = #{zfbAmt},</if>
- <if test="posAmt != null">pos_amt = #{posAmt},</if>
- <if test="xjAmt != null">xj_amt = #{xjAmt},</if>
- <if test="didiAppAmt != null">didi_app_amt = #{didiAppAmt},</if>
- <if test="tyAppAmt != null">ty_app_amt = #{tyAppAmt},</if>
- <if test="otherAmt != null">other_amt = #{otherAmt},</if>
- <if test="dzkAmt != null">dzk_amt = #{dzkAmt},</if>
- <if test="score != null">score = #{score},</if>
- <if test="memberNo != null">member_no = #{memberNo},</if>
- <if test="memberAmt != null">member_amt = #{memberAmt},</if>
- <if test="printCount != null">print_count = #{printCount},</if>
- <if test="payType != null">pay_type = #{payType},</if>
- <if test="payWay != null">pay_way = #{payWay},</if>
- <if test="oilPersonnel != null">oil_personnel = #{oilPersonnel},</if>
- <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>
- <if test="refundUser != null">refund_user = #{refundUser},</if>
- <if test="refundDate != null">refund_date = #{refundDate},</if>
- <if test="examinUser != null">examin_user = #{examinUser},</if>
- <if test="examinDate != null">examin_date = #{examinDate},</if>
- <if test="examinStatus != null">examin_status = #{examinStatus},</if>
- <if test="refundSuccessDate != null">refund_success_date = #{refundSuccessDate},</if>
- </trim>
- where order_id = #{orderId}
- </update>
- <delete id="deletePayOrderById" parameterType="Long">
- delete from pay_order where order_id = #{orderId}
- </delete>
- <delete id="deletePayOrderByIds" parameterType="String">
- delete from pay_order where order_id in
- <foreach item="orderId" collection="array" open="(" separator="," close=")">
- #{orderId}
- </foreach>
- </delete>
- </mapper>
|