504504 and status=4
505505 </if >
506506 <if test =" status==null" >
507- and status !=0 and status!=9 and status!=10 and status!=11
507+ and status !=0 and status!=9 and status!=10 and
508+ status!=11
508509 </if >
509510 </where >
510511 group by together_id
580581 together_order
581582 WHERE
582583 campus_id = #{campusId,jdbcType=INTEGER}
583- AND tag = #{tag,jdbcType=SMALLINT}
584+ AND tag =
585+ #{tag,jdbcType=SMALLINT}
584586 AND status IN (2,3)
585587 <if test =" isSelected == 0" >
586588 AND admin_phone IS NULL
661663 together_id=#{togetherId,jdbcType=VARCHAR}
662664 </select >
663665
664- <!-- web端获取订单(除待发货订单) -->
666+ <!-- web端获取订单(除待发货订单) 弃用 -->
665667 <select id =" getPCOrders" resultMap =" PCSimpleOrderMap" >
666668 SELECT
667669 together_id,
702704 order by together_date DESC,orders.phone ASC
703705 limit ${offset},${limit}
704706 </select >
707+
708+ <!-- pc端获取订单 -->
709+ <select id =" getPCSimpleOrders" resultMap =" PCSimpleOrderMap" >
710+ SELECT
711+ together_id,
712+ orders.phone,
713+ food. NAME AS NAME,
714+ order_count,
715+ address,
716+ orders.admin_phone,
717+ together_date,
718+ receiver.phone AS receiver_phone,
719+ food.price AS food_price,
720+ orders.price,
721+ is_discount,
722+ discount_price,
723+ users.nickname AS admin_name
724+ FROM
725+ orders
726+ LEFT JOIN food on orders.food_id = food.food_id and
727+ orders.campus_id=food.campus_id
728+ left join receiver on orders.rank = receiver.rank and orders.phone =
729+ receiver.phone_id
730+ left join users on orders.admin_phone=users.phone
731+ WHERE orders. STATUS =#{status,jdbcType=SMALLINT}
732+ AND orders.tag = 1
733+ and orders.campus_id=#{campusId,jdbcType=INTEGER}
734+ <if test =" search!=null" >
735+ and orders.phone like "%${search}%"
736+ </if >
737+ order by together_date DESC,orders.phone ASC
738+ limit ${offset},${limit}
739+ </select >
705740
741+ <select id =" getPCSimpleOrdersCount" resultType =" Long" >
742+ select count(*)
743+ from orders
744+ WHERE orders. STATUS =#{status,jdbcType=SMALLINT}
745+ AND orders.tag = 1
746+ and orders.campus_id=#{campusId,jdbcType=INTEGER}
747+ <if test =" search!=null" >
748+ and phone like "%${search}%"
749+ </if >
750+ </select >
706751 <!-- web端获取代发货订单 -->
707752 <select id =" getPCOrdersWithOutAdmin" resultMap =" PCSimpleOrderMap" >
708753 SELECT
838883 <update id =" deleteOrder" >
839884 update orders
840885 set tag = 0
841- where together_id=#{togetherId,jdbcType=VARCHAR}
886+ where
887+ together_id=#{togetherId,jdbcType=VARCHAR}
842888 and status=4
843889 </update >
844890
872918 <select id =" getAdminPhone" resultType =" String" >
873919 select
874920 admin_phone
875- from orders
921+ from
922+ orders
876923 where
877924 together_id=#{togetherId,jdbcType=VARCHAR}
878925 limit 1
881928 <update id =" updateOrderPrice" >
882929 update orders
883930 set total_price=#{totalPrice}
884- where order_id=#{orderId}
931+ where
932+ order_id=#{orderId}
885933 </update >
886934
887935 <!-- 根据togetherId获取该笔大订单总价 -->
888936 <select id =" selectTotalPriceByTogetherId" resultType =" FLOAT" >
889937 select
890- total_price from orders where together_id=#{togetherId,jdbcType=VARCHAR} limit 1
938+ total_price from orders where
939+ together_id=#{togetherId,jdbcType=VARCHAR} limit 1
891940 </select >
892941
893942 <!-- 支付完成后更新价格和状态 -->
896945 orders
897946 set total_price=#{amount,jdbcType=REAL},
898947 status=2 ,charge_id=#{chargeId,jdbcType=VARCHAR}
899- where together_id=#{togetherId,jdbcType=VARCHAR}
948+ where
949+ together_id=#{togetherId,jdbcType=VARCHAR}
900950 </update >
901951
902952 <!-- 根据订单号获取校区号 -->
918968 orders,food
919969 where
920970 orders.food_id=food.food_id and orders.tag =1
921- and order_id=#{orderId,jdbcType=BIGINT} and phone =
971+ and
972+ order_id=#{orderId,jdbcType=BIGINT} and phone =
922973 #{phoneId,jdbcType=VARCHAR}
923974 </select >
924975
935986 <!-- 获取客户端订单 -->
936987 <select id =" getPCOrdersNew" resultMap =" SuperAdminOrderMap" >
937988 select
938- together_id,custome_phone as phone,together_date,total_price as price,address,charge_id
989+ together_id,custome_phone as phone,together_date,total_price as
990+ price,address,charge_id
939991 from together_order
940- where tag=1 and status=#{status}
992+ where tag=1 and
993+ status=#{status}
941994 <if test =" campusId != null" >
942995 and campus_id=#{campusId,jdbcType=INTEGER}
943996 </if >
9681021 update
9691022 orders
9701023 set status=10
971- where together_id=#{togetherId,jdbcType=VARCHAR}
1024+ where
1025+ together_id=#{togetherId,jdbcType=VARCHAR}
9721026 </update >
9731027
9741028 <!-- 更新退款订单状态,推给管理员 -->
9751029 <update id =" updateorderStatusRefundSuccess" >
9761030 update
9771031 orders
9781032 set status=11
979- where together_id=#{togetherId,jdbcType=VARCHAR}
1033+ where
1034+ together_id=#{togetherId,jdbcType=VARCHAR}
9801035 </update >
9811036
9821037 <!-- 获取各个状态的订单数量 -->
983- <!-- <select id="getMiniOrderByPhone" resultType="String">
984- SELECT COUNT(DISTINCT together_id) from orders WHERE together_id in
985- (select DISTINCT together_id from orders <where> phone=#{phoneId,jdbcType=VARCHAR}
986- <if test="isRemarked!=null"> and is_remarked=#{isRemarked,jdbcType=SMALLINT}
987- </if> and status=#{status,jdbcType=SMALLINT} and tag=1 </where> GROUP BY
988- together_id)
989- select
990- together_id
991- from orders
992- <where>
993- phone = #{phoneId,jdbcType=VARCHAR} and together_id is not null and
994- orders.tag=1
995- <if test="status!=null and status!=4 and status!=5">
996- and status = #{status,jdbcType=SMALLINT}
997- </if>
998- <if test="status==4">
999- and status=4
1000- </if>
1001- <if test="status==5">
1002- and status=4
1003- </if>
1004- <if test="status==null">
1005- and status !=0
1006- </if>
1007- </where>
1008- group by together_id
1009- <if test="status==4">
1010- having count(order_id)!=sum(is_remarked)
1011- </if>
1012- <if test="status==5">
1013- having count(order_id)=sum(is_remarked)
1014- </if>
1015-
1016-
1017- </select> -->
1018-
1038+ <!-- <select id="getMiniOrderByPhone" resultType="String"> SELECT COUNT(DISTINCT
1039+ together_id) from orders WHERE together_id in (select DISTINCT together_id
1040+ from orders <where> phone=#{phoneId,jdbcType=VARCHAR} <if test="isRemarked!=null">
1041+ and is_remarked=#{isRemarked,jdbcType=SMALLINT} </if> and status=#{status,jdbcType=SMALLINT}
1042+ and tag=1 </where> GROUP BY together_id) select together_id from orders <where>
1043+ phone = #{phoneId,jdbcType=VARCHAR} and together_id is not null and orders.tag=1
1044+ <if test="status!=null and status!=4 and status!=5"> and status = #{status,jdbcType=SMALLINT}
1045+ </if> <if test="status==4"> and status=4 </if> <if test="status==5"> and
1046+ status=4 </if> <if test="status==null"> and status !=0 </if> </where> group
1047+ by together_id <if test="status==4"> having count(order_id)!=sum(is_remarked)
1048+ </if> <if test="status==5"> having count(order_id)=sum(is_remarked) </if>
1049+ </select> -->
1050+
10191051 <!-- 获取指定时间段和指定校区的订单总数 -->
10201052 <select id =" getSalesInfoByCampusId" resultType =" Integer" >
1021- select COUNT(DISTINCT together_id) from orders
1022- where campus_id=#{campusId}
1023- and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1024- and #{dateEnd,jdbcType=TIMESTAMP}
1025- and tag=1
1053+ select COUNT(DISTINCT together_id) from orders
1054+ where campus_id=#{campusId}
1055+ and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1056+ and #{dateEnd,jdbcType=TIMESTAMP}
1057+ and tag=1
10261058 </select >
1027-
1059+
10281060 <!-- 获取指定时间段和指定校区的订单交易额 -->
10291061 <select id =" getTradeVolumeByCampusId" resultType =" Float" >
1030- SELECT sum(total_price)
1031- from together_order
1032- <where >
1033- campus_id=#{campusId,jdbcType=INTEGER}
1034- <if test =" dateStart!=null and dateEnd!=null" >
1035- and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1036- AND #{dateEnd,jdbcType=TIMESTAMP}
1037- </if >
1038- <if test =" dateToday!=null" >
1039- and together_date>=#{dateToday,jdbcType=TIMESTAMP}
1040- </if >
1041- <if test =" payWay!=null" >
1042- AND pay_way=#{payWay,jdbcType=SMALLINT}
1043- </if >
1044- </where >
1062+ SELECT sum(total_price)
1063+ from together_order
1064+ <where >
1065+ campus_id=#{campusId,jdbcType=INTEGER}
1066+ <if test =" dateStart!=null and dateEnd!=null" >
1067+ and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1068+ AND #{dateEnd,jdbcType=TIMESTAMP}
1069+ </if >
1070+ <if test =" dateToday!=null" >
1071+ and together_date>=#{dateToday,jdbcType=TIMESTAMP}
1072+ </if >
1073+ <if test =" payWay!=null" >
1074+ AND pay_way=#{payWay,jdbcType=SMALLINT}
1075+ </if >
1076+ </where >
10451077 </select >
10461078</mapper >
0 commit comments