|
@@ -3,7 +3,7 @@
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.yijia.customer.mapper.CustomerManageMapper">
|
|
<mapper namespace="com.yijia.customer.mapper.CustomerManageMapper">
|
|
-
|
|
|
|
|
|
+
|
|
<resultMap type="CustomerManage" id="CustomerManageResult">
|
|
<resultMap type="CustomerManage" id="CustomerManageResult">
|
|
<result property="id" column="id" />
|
|
<result property="id" column="id" />
|
|
<result property="memberId" column="member_id" />
|
|
<result property="memberId" column="member_id" />
|
|
@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectCustomerManageList" parameterType="CustomerManage" resultMap="CustomerManageResult">
|
|
<select id="selectCustomerManageList" parameterType="CustomerManage" resultMap="CustomerManageResult">
|
|
<include refid="selectCustomerManageVo"/>
|
|
<include refid="selectCustomerManageVo"/>
|
|
- <where>
|
|
|
|
|
|
+ <where>
|
|
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
|
|
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
|
|
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
<if test="commendMan != null and commendMan != ''"> and commend_man = #{commendMan}</if>
|
|
<if test="commendMan != null and commendMan != ''"> and commend_man = #{commendMan}</if>
|
|
@@ -80,12 +80,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
</where>
|
|
</where>
|
|
order by id desc
|
|
order by id desc
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<select id="selectCustomerManageById" parameterType="Long" resultMap="CustomerManageResult">
|
|
<select id="selectCustomerManageById" parameterType="Long" resultMap="CustomerManageResult">
|
|
<include refid="selectCustomerManageVo"/>
|
|
<include refid="selectCustomerManageVo"/>
|
|
where id = #{id}
|
|
where id = #{id}
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<insert id="insertCustomerManage" parameterType="CustomerManage" useGeneratedKeys="true" keyProperty="id">
|
|
<insert id="insertCustomerManage" parameterType="CustomerManage" useGeneratedKeys="true" keyProperty="id">
|
|
insert into customer_manage
|
|
insert into customer_manage
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
@@ -187,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteCustomerManageByIds" parameterType="String">
|
|
<delete id="deleteCustomerManageByIds" parameterType="String">
|
|
- delete from customer_manage where id in
|
|
|
|
|
|
+ delete from customer_manage where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
@@ -215,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<!-- </select>-->
|
|
<!-- </select>-->
|
|
<select id="selectCustomerManage" parameterType="CustomerManage" resultMap="CustomerManageResult">
|
|
<select id="selectCustomerManage" parameterType="CustomerManage" resultMap="CustomerManageResult">
|
|
SELECT sy.*,px.pay_date from (
|
|
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.mina_user_id,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
|
|
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_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
|
|
left join customer_electronic_card c on c.union_id =m.union_id and c.station_id = m.station_id
|
|
@@ -233,7 +233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</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>
|
|
<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.station_id
|
|
|
|
|
|
+ GROUP BY m.union_id,m.member_id,m.customer_name,m.phone_number, m.car_number,m.mina_user_id,p.points,c.station_id
|
|
) sy
|
|
) sy
|
|
LEFT JOIN (SELECT max(pay_date) pay_date ,po.consumer
|
|
LEFT JOIN (SELECT max(pay_date) pay_date ,po.consumer
|
|
from pay_order po
|
|
from pay_order po
|
|
@@ -249,4 +249,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
GROUP BY po.consumer) px on sy.customer_name = px.consumer
|
|
GROUP BY po.consumer) px on sy.customer_name = px.consumer
|
|
order by px.pay_date desc
|
|
order by px.pay_date desc
|
|
</select>
|
|
</select>
|
|
-</mapper>
|
|
|
|
|
|
+</mapper>
|