|
@@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<result property="liters" column="liters" />
|
|
<result property="liters" column="liters" />
|
|
<result property="amt" column="amt" />
|
|
<result property="amt" column="amt" />
|
|
<result property="unionId" column="union_id" />
|
|
<result property="unionId" column="union_id" />
|
|
|
|
+ <result property="payDate" column="pay_date" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectCustomerManageVo">
|
|
<sql id="selectCustomerManageVo">
|
|
@@ -191,25 +192,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
</delete>
|
|
</delete>
|
|
|
|
+<!-- <select id="selectCustomerManage" parameterType="CustomerManage" resultMap="CustomerManageResult">-->
|
|
|
|
+<!-- SELECT m.member_id,m.customer_name,m.phone_number,m.car_number,GROUP_CONCAT(DISTINCT(m.oil_name)) oil_name,GROUP_CONCAT(DISTINCT(m.grade)) as grade,m.union_id,p.points as integral,sum(CASE c.card_oils_type WHEN '1' THEN c.amt ELSE 0 END ) qy_amt,sum(CASE c.card_oils_type WHEN '2' THEN c.amt ELSE 0 END ) cy_amt-->
|
|
|
|
+<!-- from customer_manage m-->
|
|
|
|
+<!-- left join customer_points p on m.union_id = p.union_id and m.station_id = p.station_id-->
|
|
|
|
+<!-- left join customer_electronic_card c on c.union_id =m.union_id and c.station_id = m.station_id-->
|
|
|
|
+<!-- <where>-->
|
|
|
|
+<!-- <if test="stationIdList != null ">-->
|
|
|
|
+<!-- and m.station_id in-->
|
|
|
|
+<!-- <foreach item="item" index="index" collection="stationIdList"-->
|
|
|
|
+<!-- open="(" separator="," close=")">-->
|
|
|
|
+<!-- #{item}-->
|
|
|
|
+<!-- </foreach>-->
|
|
|
|
+<!-- </if>-->
|
|
|
|
+<!-- <if test="carNumber != null and carNumber != ''"> and car_number = #{carNumber}</if>-->
|
|
|
|
+<!-- <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>-->
|
|
|
|
+<!-- <if test="memberGrade != null and memberGrade != ''"> and member_grade = #{memberGrade}</if>-->
|
|
|
|
+<!-- <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>-->
|
|
|
|
+<!-- <if test="customerName != null and customerName != ''"> and m.customer_name like concat('%', #{customerName}, '%')</if>-->
|
|
|
|
+<!-- </where>-->
|
|
|
|
+<!-- GROUP BY m.union_id,m.member_id,m.customer_name,m.phone_number, m.car_number,p.points,c.union_id,c.station_id-->
|
|
|
|
+<!-- </select>-->
|
|
<select id="selectCustomerManage" parameterType="CustomerManage" resultMap="CustomerManageResult">
|
|
<select id="selectCustomerManage" parameterType="CustomerManage" resultMap="CustomerManageResult">
|
|
|
|
+ SELECT sy.*,px.pay_date from (
|
|
SELECT m.member_id,m.customer_name,m.phone_number,m.car_number,GROUP_CONCAT(DISTINCT(m.oil_name)) oil_name,GROUP_CONCAT(DISTINCT(m.grade)) as grade,m.union_id,p.points as integral,sum(CASE c.card_oils_type WHEN '1' THEN c.amt ELSE 0 END ) qy_amt,sum(CASE c.card_oils_type WHEN '2' THEN c.amt ELSE 0 END ) cy_amt
|
|
SELECT m.member_id,m.customer_name,m.phone_number,m.car_number,GROUP_CONCAT(DISTINCT(m.oil_name)) oil_name,GROUP_CONCAT(DISTINCT(m.grade)) as grade,m.union_id,p.points as integral,sum(CASE c.card_oils_type WHEN '1' THEN c.amt ELSE 0 END ) qy_amt,sum(CASE c.card_oils_type WHEN '2' THEN c.amt ELSE 0 END ) cy_amt
|
|
- from customer_manage m
|
|
|
|
- left join customer_points p on m.union_id = p.union_id and m.station_id = p.station_id
|
|
|
|
- left join customer_electronic_card c on c.union_id =m.union_id and c.station_id = m.station_id
|
|
|
|
|
|
+ from customer_manage m
|
|
|
|
+ left join customer_points p on m.union_id = p.union_id and m.station_id = p.station_id
|
|
|
|
+ left join customer_electronic_card c on c.union_id =m.union_id and c.station_id = m.station_id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="stationIdList != null ">
|
|
|
|
+ and m.station_id in
|
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="carNumber != null and carNumber != ''"> and car_number = #{carNumber}</if>
|
|
|
|
+ <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
|
|
|
|
+ <if test="memberGrade != null and memberGrade != ''"> and member_grade = #{memberGrade}</if>
|
|
|
|
+ <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and m.customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY m.union_id,m.member_id,m.customer_name,m.phone_number, m.car_number,p.points,c.station_id
|
|
|
|
+ ) sy
|
|
|
|
+ LEFT JOIN (SELECT max(pay_date) pay_date ,po.consumer
|
|
|
|
+ from pay_order po
|
|
<where>
|
|
<where>
|
|
<if test="stationIdList != null ">
|
|
<if test="stationIdList != null ">
|
|
- and m.station_id in
|
|
|
|
|
|
+ and po.station_id in
|
|
<foreach item="item" index="index" collection="stationIdList"
|
|
<foreach item="item" index="index" collection="stationIdList"
|
|
open="(" separator="," close=")">
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
#{item}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
- <if test="carNumber != null and carNumber != ''"> and car_number = #{carNumber}</if>
|
|
|
|
- <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
|
|
|
|
- <if test="memberGrade != null and memberGrade != ''"> and member_grade = #{memberGrade}</if>
|
|
|
|
- <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
|
|
|
|
- <if test="customerName != null and customerName != ''"> and m.customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
</where>
|
|
</where>
|
|
- GROUP BY m.union_id,m.member_id,m.customer_name,m.phone_number, m.car_number,p.points,c.union_id,c.station_id
|
|
|
|
|
|
+ GROUP BY po.consumer) px on sy.customer_name = px.consumer
|
|
|
|
+ order by px.pay_date desc
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|