|
@@ -174,33 +174,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<!-- </where>-->
|
|
|
<!-- GROUP BY oil_personnel-->
|
|
|
<select id="listPersonnelPayStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
|
- SELECT oil_personnel,GROUP_CONCAT(DISTINCT oil_gun) oil_gun,
|
|
|
+ SELECT oil_personnel,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(xj_amt) xj_amt,sum(member_amt) member_amt,
|
|
|
- (SELECT COUNT(b.order_no) from station_class_structure b
|
|
|
- <where>
|
|
|
- and b.pay_type="xj"
|
|
|
- <if test="classStructureNo != null and classStructureNo != ''"> and b.class_structure_no = #{classStructureNo}</if>
|
|
|
- </where>
|
|
|
- ) xj_num,
|
|
|
- (SELECT COUNT(c.order_no) from station_class_structure c
|
|
|
- <where>
|
|
|
- and c.pay_type="zfb"
|
|
|
- <if test="classStructureNo != null and classStructureNo != ''"> and c.class_structure_no = #{classStructureNo}</if>
|
|
|
- </where>
|
|
|
- ) zfb_num,
|
|
|
- (SELECT COUNT(d.order_no) from station_class_structure d
|
|
|
- <where>
|
|
|
- and d.pay_type="wx"
|
|
|
- <if test="classStructureNo != null and classStructureNo != ''"> and d.class_structure_no = #{classStructureNo}</if>
|
|
|
- </where>
|
|
|
- ) wx_num
|
|
|
- from station_class_structure a
|
|
|
+ sum(e.xj_num) xj_num,sum(e.zfb_num) zfb_num,sum(e.wx_num) wx_num
|
|
|
+ from (
|
|
|
+ SELECT station_id,class_structure_no, order_type,oil_personnel,oil_gun,discount_amt,discount_coupon_amt,wx_amt,zfb_amt,xj_amt,member_amt,
|
|
|
+ (SELECT COUNT(b.order_no) from station_class_structure b where 1=1 and a.id = b.id and b.pay_type="xj" ) xj_num,
|
|
|
+ (SELECT COUNT(c.order_no) from station_class_structure c where 1=1 and a.id = c.id and c.pay_type="zfb" ) zfb_num,
|
|
|
+ (SELECT COUNT(d.order_no) from station_class_structure d where 1=1 and a.id = d.id and d.pay_type="wx" ) wx_num
|
|
|
+ from station_class_structure a
|
|
|
<where>
|
|
|
+ <if test="stationId != null and stationId != ''"> and a.station_id = #{stationId}</if>
|
|
|
<if test="classStructureNo != null and classStructureNo != ''"> and a.class_structure_no = #{classStructureNo}</if>
|
|
|
+ <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
|
|
|
</where>
|
|
|
- GROUP BY a.oil_personnel
|
|
|
+ ) e
|
|
|
+ <where>
|
|
|
+ <if test="stationId != null and stationId != ''"> and e.station_id = #{stationId}</if>
|
|
|
+ <if test="classStructureNo != null and classStructureNo != ''"> and e.class_structure_no = #{classStructureNo}</if>
|
|
|
+ <if test="orderType != null and orderType != ''"> and e.order_type = #{orderType}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY e.oil_personnel
|
|
|
</select>
|
|
|
|
|
|
<select id="listClass" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
@@ -232,22 +228,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
from station_class_structure a
|
|
|
<where>
|
|
|
<if test="stationId != null "> and a.station_id = #{stationId}</if>
|
|
|
- <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
|
|
|
+ <if test="classStructureNo != null and classStructureNo != ''"> and a.class_structure_no = #{classStructureNo}</if>
|
|
|
</where>
|
|
|
GROUP BY a.oil_name,a.station_id,a.class_start_date,a.class_structure_date,a.class_structure_man) c
|
|
|
</select>
|
|
|
|
|
|
<!--按员工/支付方式汇总数据-->
|
|
|
<select id="listPersonnelPayStructureSum" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
|
- SELECT sum(wx_num) wx_num,sum(zfb_num) zfb_num,sum(xj_num) 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
|
|
|
- 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
|
|
|
- from station_class_structure
|
|
|
+ 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(xj_amt) xj_amt,sum(member_amt) member_amt,
|
|
|
+ sum(e.xj_num) xj_num,sum(e.zfb_num) zfb_num,sum(e.wx_num) wx_num
|
|
|
+ from (SELECT station_id,class_structure_no, order_type,oil_personnel,oil_gun,discount_amt,discount_coupon_amt,wx_amt,zfb_amt,xj_amt,member_amt,
|
|
|
+ (SELECT COUNT(b.order_no) from station_class_structure b where 1=1 and a.id = b.id and b.pay_type="xj" ) xj_num,
|
|
|
+ (SELECT COUNT(c.order_no) from station_class_structure c where 1=1 and a.id = c.id and c.pay_type="zfb" ) zfb_num,
|
|
|
+ (SELECT COUNT(d.order_no) from station_class_structure d where 1=1 and a.id = d.id and d.pay_type="wx" ) wx_num
|
|
|
+ from station_class_structure a
|
|
|
<where>
|
|
|
- <if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
|
|
|
- <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
|
|
|
- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
|
|
|
+ <if test="stationId != null "> and a.station_id = #{stationId}</if>
|
|
|
+ <if test="classStructureNo != null and classStructureNo != ''"> and a.class_structure_no = #{classStructureNo}</if>
|
|
|
+ <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
|
|
|
</where>
|
|
|
- GROUP BY oil_personnel) a
|
|
|
+ ) e
|
|
|
+ <where>
|
|
|
+ <if test="stationId != null "> and e.station_id = #{stationId}</if>
|
|
|
+ <if test="classStructureNo != null and classStructureNo != ''"> and e.class_structure_no = #{classStructureNo}</if>
|
|
|
+ <if test="orderType != null and orderType != ''"> and e.order_type = #{orderType}</if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="listPersonnelStructureSum" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
@@ -451,10 +459,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteStationClassStructureByIds" parameterType="String">
|
|
|
- delete from station_class_structure where id in
|
|
|
+ delete from station_class_structure where id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
-
|
|
|
+
|
|
|
</mapper>
|