|
@@ -7,45 +7,77 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<resultMap type="StationClassStructure" id="StationClassStructureResult">
|
|
|
<result property="id" column="id" />
|
|
|
<result property="stationId" column="station_id" />
|
|
|
+ <result property="orderNo" column="order_no" />
|
|
|
+ <result property="oilGun" column="oil_gun" />
|
|
|
+ <result property="oilName" column="oil_name" />
|
|
|
+ <result property="consumerId" column="consumer_id" />
|
|
|
+ <result property="consumer" column="consumer" />
|
|
|
+ <result property="amt" column="amt" />
|
|
|
<result property="stationName" column="station_name" />
|
|
|
- <result property="person" column="person" />
|
|
|
- <result property="gunNo" column="gun_no" />
|
|
|
- <result property="salesVolume" column="sales_volume" />
|
|
|
- <result property="salesAmount" column="sales_amount" />
|
|
|
- <result property="discount" column="discount" />
|
|
|
- <result property="coupon" column="coupon" />
|
|
|
- <result property="netReceipts" column="net_receipts" />
|
|
|
- <result property="salesNum" column="sales_num" />
|
|
|
+ <result property="orderLiters" column="order_liters" />
|
|
|
+ <result property="payType" column="pay_type" />
|
|
|
+ <result property="payWay" column="pay_way" />
|
|
|
+ <result property="payDate" column="pay_date" />
|
|
|
+ <result property="oilPersonnel" column="oil_personnel" />
|
|
|
+ <result property="orderType" column="order_type" />
|
|
|
+ <result property="oilType" column="oil_type" />
|
|
|
<result property="printNum" column="print_num" />
|
|
|
<result property="classStructureNo" column="class_structure_no" />
|
|
|
<result property="classStructureDate" column="class_structure_date" />
|
|
|
<result property="classStructureMan" column="class_structure_man" />
|
|
|
+ <result property="oils" column="oils" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectStationClassStructureVo">
|
|
|
- select id, station_id, station_name, person, gun_no, sales_volume, sales_amount, discount, coupon, net_receipts, sales_num, print_num, class_structure_no, class_structure_date, class_structure_man from station_class_structure
|
|
|
+ select id, station_id, order_no, oil_gun, oil_name, consumer_id, consumer, amt, station_name, order_liters, pay_type, pay_way, pay_date, oil_personnel, order_type, oil_type, print_num, class_structure_no, class_structure_date, class_structure_man, oils from station_class_structure
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectStationClassStructureList" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
|
<include refid="selectStationClassStructureVo"/>
|
|
|
<where>
|
|
|
<if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</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="consumerId != null "> and consumer_id = #{consumerId}</if>
|
|
|
+ <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
|
|
|
+ <if test="amt != null and amt != ''"> and amt = #{amt}</if>
|
|
|
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
- <if test="person != null and person != ''"> and person = #{person}</if>
|
|
|
- <if test="gunNo != null and gunNo != ''"> and gun_no = #{gunNo}</if>
|
|
|
- <if test="salesVolume != null and salesVolume != ''"> and sales_volume = #{salesVolume}</if>
|
|
|
- <if test="salesAmount != null and salesAmount != ''"> and sales_amount = #{salesAmount}</if>
|
|
|
- <if test="discount != null and discount != ''"> and discount = #{discount}</if>
|
|
|
- <if test="coupon != null and coupon != ''"> and coupon = #{coupon}</if>
|
|
|
- <if test="netReceipts != null and netReceipts != ''"> and net_receipts = #{netReceipts}</if>
|
|
|
- <if test="salesNum != null "> and sales_num = #{salesNum}</if>
|
|
|
+ <if test="orderLiters != null and orderLiters != ''"> and order_liters = #{orderLiters}</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="payDate != null "> and pay_date = #{payDate}</if>
|
|
|
+ <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
|
|
|
+ <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
|
|
|
+ <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
|
|
|
<if test="printNum != null "> and print_num = #{printNum}</if>
|
|
|
<if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
|
|
|
<if test="classStructureDate != null "> and class_structure_date = #{classStructureDate}</if>
|
|
|
<if test="classStructureMan != null and classStructureMan != ''"> and class_structure_man = #{classStructureMan}</if>
|
|
|
+ <if test="oils != null and oils != ''"> and oils = #{oils}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
+ <select id="listPersonnelStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
|
+ SELECT a.oil_personnel,b.gun_no 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 station_class_structure a JOIN station_personnel b on a.oil_personnel =b.personnel_name
|
|
|
+ and a.station_id = b.station_id
|
|
|
+ where a.station_id =1
|
|
|
+ GROUP BY a.oil_personnel,b.gun_no
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listOilStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
|
+ 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 station_class_structure a
|
|
|
+ where a.station_id =1
|
|
|
+ GROUP BY a.oil_name
|
|
|
+ </select>
|
|
|
+ <select id="selectStationClassStructureMax" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
|
|
|
+ select id, station_id, order_no, oil_gun, oil_name, consumer_id, consumer, amt, station_name, order_liters, pay_type, pay_way, pay_date, oil_personnel, order_type, oil_type, print_num, class_structure_no, class_structure_date, class_structure_man, oils
|
|
|
+ from station_class_structure
|
|
|
+ where id = (
|
|
|
+ SELECT MAX(id) from station_class_structure where station_id= #{stationId})
|
|
|
+ </select>
|
|
|
<select id="selectStationClassStructureById" parameterType="Long" resultMap="StationClassStructureResult">
|
|
|
<include refid="selectStationClassStructureVo"/>
|
|
|
where id = #{id}
|
|
@@ -55,35 +87,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
insert into station_class_structure
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="stationId != null">station_id,</if>
|
|
|
+ <if test="orderNo != null">order_no,</if>
|
|
|
+ <if test="oilGun != null">oil_gun,</if>
|
|
|
+ <if test="oilName != null">oil_name,</if>
|
|
|
+ <if test="consumerId != null">consumer_id,</if>
|
|
|
+ <if test="consumer != null">consumer,</if>
|
|
|
+ <if test="amt != null">amt,</if>
|
|
|
<if test="stationName != null">station_name,</if>
|
|
|
- <if test="person != null">person,</if>
|
|
|
- <if test="gunNo != null">gun_no,</if>
|
|
|
- <if test="salesVolume != null">sales_volume,</if>
|
|
|
- <if test="salesAmount != null">sales_amount,</if>
|
|
|
- <if test="discount != null">discount,</if>
|
|
|
- <if test="coupon != null">coupon,</if>
|
|
|
- <if test="netReceipts != null">net_receipts,</if>
|
|
|
- <if test="salesNum != null">sales_num,</if>
|
|
|
+ <if test="orderLiters != null">order_liters,</if>
|
|
|
+ <if test="payType != null">pay_type,</if>
|
|
|
+ <if test="payWay != null">pay_way,</if>
|
|
|
+ <if test="payDate != null">pay_date,</if>
|
|
|
+ <if test="oilPersonnel != null">oil_personnel,</if>
|
|
|
+ <if test="orderType != null">order_type,</if>
|
|
|
+ <if test="oilType != null">oil_type,</if>
|
|
|
<if test="printNum != null">print_num,</if>
|
|
|
<if test="classStructureNo != null">class_structure_no,</if>
|
|
|
<if test="classStructureDate != null">class_structure_date,</if>
|
|
|
<if test="classStructureMan != null">class_structure_man,</if>
|
|
|
+ <if test="oils != null">oils,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="stationId != null">#{stationId},</if>
|
|
|
+ <if test="orderNo != null">#{orderNo},</if>
|
|
|
+ <if test="oilGun != null">#{oilGun},</if>
|
|
|
+ <if test="oilName != null">#{oilName},</if>
|
|
|
+ <if test="consumerId != null">#{consumerId},</if>
|
|
|
+ <if test="consumer != null">#{consumer},</if>
|
|
|
+ <if test="amt != null">#{amt},</if>
|
|
|
<if test="stationName != null">#{stationName},</if>
|
|
|
- <if test="person != null">#{person},</if>
|
|
|
- <if test="gunNo != null">#{gunNo},</if>
|
|
|
- <if test="salesVolume != null">#{salesVolume},</if>
|
|
|
- <if test="salesAmount != null">#{salesAmount},</if>
|
|
|
- <if test="discount != null">#{discount},</if>
|
|
|
- <if test="coupon != null">#{coupon},</if>
|
|
|
- <if test="netReceipts != null">#{netReceipts},</if>
|
|
|
- <if test="salesNum != null">#{salesNum},</if>
|
|
|
+ <if test="orderLiters != null">#{orderLiters},</if>
|
|
|
+ <if test="payType != null">#{payType},</if>
|
|
|
+ <if test="payWay != null">#{payWay},</if>
|
|
|
+ <if test="payDate != null">#{payDate},</if>
|
|
|
+ <if test="oilPersonnel != null">#{oilPersonnel},</if>
|
|
|
+ <if test="orderType != null">#{orderType},</if>
|
|
|
+ <if test="oilType != null">#{oilType},</if>
|
|
|
<if test="printNum != null">#{printNum},</if>
|
|
|
<if test="classStructureNo != null">#{classStructureNo},</if>
|
|
|
<if test="classStructureDate != null">#{classStructureDate},</if>
|
|
|
<if test="classStructureMan != null">#{classStructureMan},</if>
|
|
|
+ <if test="oils != null">#{oils},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
@@ -91,19 +135,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
update station_class_structure
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="stationId != null">station_id = #{stationId},</if>
|
|
|
+ <if test="orderNo != null">order_no = #{orderNo},</if>
|
|
|
+ <if test="oilGun != null">oil_gun = #{oilGun},</if>
|
|
|
+ <if test="oilName != null">oil_name = #{oilName},</if>
|
|
|
+ <if test="consumerId != null">consumer_id = #{consumerId},</if>
|
|
|
+ <if test="consumer != null">consumer = #{consumer},</if>
|
|
|
+ <if test="amt != null">amt = #{amt},</if>
|
|
|
<if test="stationName != null">station_name = #{stationName},</if>
|
|
|
- <if test="person != null">person = #{person},</if>
|
|
|
- <if test="gunNo != null">gun_no = #{gunNo},</if>
|
|
|
- <if test="salesVolume != null">sales_volume = #{salesVolume},</if>
|
|
|
- <if test="salesAmount != null">sales_amount = #{salesAmount},</if>
|
|
|
- <if test="discount != null">discount = #{discount},</if>
|
|
|
- <if test="coupon != null">coupon = #{coupon},</if>
|
|
|
- <if test="netReceipts != null">net_receipts = #{netReceipts},</if>
|
|
|
- <if test="salesNum != null">sales_num = #{salesNum},</if>
|
|
|
+ <if test="orderLiters != null">order_liters = #{orderLiters},</if>
|
|
|
+ <if test="payType != null">pay_type = #{payType},</if>
|
|
|
+ <if test="payWay != null">pay_way = #{payWay},</if>
|
|
|
+ <if test="payDate != null">pay_date = #{payDate},</if>
|
|
|
+ <if test="oilPersonnel != null">oil_personnel = #{oilPersonnel},</if>
|
|
|
+ <if test="orderType != null">order_type = #{orderType},</if>
|
|
|
+ <if test="oilType != null">oil_type = #{oilType},</if>
|
|
|
<if test="printNum != null">print_num = #{printNum},</if>
|
|
|
<if test="classStructureNo != null">class_structure_no = #{classStructureNo},</if>
|
|
|
<if test="classStructureDate != null">class_structure_date = #{classStructureDate},</if>
|
|
|
<if test="classStructureMan != null">class_structure_man = #{classStructureMan},</if>
|
|
|
+ <if test="oils != null">oils = #{oils},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|