|
@@ -0,0 +1,338 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.platform.yijia.dao.CustomerManageMapper">
|
|
|
+ <!--客户信息返回结果-->
|
|
|
+ <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.CustomerManage">
|
|
|
+ <id column="id" jdbcType="INTEGER" property="id" />
|
|
|
+ <result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
|
|
+ <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
|
|
|
+ <result column="commend_man" jdbcType="VARCHAR" property="commendMan" />
|
|
|
+ <result column="member_grade" jdbcType="VARCHAR" property="memberGrade" />
|
|
|
+ <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber" />
|
|
|
+ <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
|
|
|
+ <result column="balance" jdbcType="DECIMAL" property="balance" />
|
|
|
+ <result column="integral" jdbcType="INTEGER" property="integral" />
|
|
|
+ <result column="special_car_type" jdbcType="VARCHAR" property="specialCarType" />
|
|
|
+ <result column="regtime" jdbcType="TIMESTAMP" property="regtime" />
|
|
|
+ <result column="station_id" jdbcType="INTEGER" property="stationId" />
|
|
|
+ <result column="station_name" jdbcType="VARCHAR" property="stationName"/>
|
|
|
+ <result column="cy_grade" jdbcType="VARCHAR" property="cyGrade" />
|
|
|
+ <result column="qy_grade" jdbcType="VARCHAR" property="qyGrade" />
|
|
|
+ <result column="cy_liters" jdbcType="DECIMAL" property="cyLiters"/>
|
|
|
+ <result column="qy_liters" jdbcType="DECIMAL" property="qyLiters" />
|
|
|
+ <result column="cy_amt" jdbcType="DECIMAL" property="cyAmt" />
|
|
|
+ <result column="qy_amt" jdbcType="DECIMAL" property="qyAmt" />
|
|
|
+ <result column="blog_openid" jdbcType="VARCHAR" property="blogOpenid" />
|
|
|
+ <result column="mina_openid" jdbcType="VARCHAR" property="minaOpenid" />
|
|
|
+ <result column="blog_user_id" jdbcType="INTEGER" property="blogUserId" />
|
|
|
+ <result column="mina_user_id" jdbcType="INTEGER" property="minaUserId"/>
|
|
|
+ <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
|
|
|
+ <result column="grade" jdbcType="VARCHAR" property="grade" />
|
|
|
+ <result column="liters" jdbcType="DECIMAL" property="liters" />
|
|
|
+ <result column="amt" jdbcType="DECIMAL" property="amt" />
|
|
|
+ <result column="union_id" jdbcType="VARCHAR" property="unionId" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!--查询列-->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, member_id, customer_name, commend_man, member_grade, phone_number, car_number, balance,
|
|
|
+ integral, special_car_type, regtime, station_id, station_name, cy_grade, qy_grade, cy_liters,
|
|
|
+ qy_liters, cy_amt, qy_amt, blog_openid, mina_openid, blog_user_id, mina_user_id, oil_name, grade,
|
|
|
+ liters, amt, union_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--查询油站客户信息-->
|
|
|
+ <select id="getCustomerManageInfo" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerManage">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ FROM
|
|
|
+ customer_manage
|
|
|
+ <where>
|
|
|
+ <if test="stationId !=null and stationId !=''">
|
|
|
+ station_id = #{stationId}
|
|
|
+ </if>
|
|
|
+ <if test="oilName !=null and oilName !=''">
|
|
|
+ AND oil_name = #{oilName}
|
|
|
+ </if>
|
|
|
+ <if test="minaOpenid !=null and minaOpenid !=''">
|
|
|
+ AND mina_openid = #{minaOpenid}
|
|
|
+ </if>
|
|
|
+ <if test="unionId !=null and unionId !=''">
|
|
|
+ AND union_id = #{unionId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 判断客户表是否已存在-->
|
|
|
+ <select id="isExistCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage" resultType="com.platform.yijia.pojo.CustomerManage">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ FROM
|
|
|
+ customer_manage
|
|
|
+ <where>
|
|
|
+ <if test="phoneNumber !=null and phoneNumber !='' ">
|
|
|
+ phone_number = #{phoneNumber}
|
|
|
+ </if>
|
|
|
+ <if test="stationId !=null and stationId !='' ">
|
|
|
+ AND station_id = #{stationId}
|
|
|
+ </if>
|
|
|
+ <if test="oilName !=null and oilName !='' ">
|
|
|
+ AND oil_name = #{oilName}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 更新客户表 -->
|
|
|
+ <update id="updateCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage">
|
|
|
+ UPDATE
|
|
|
+ customer_manage
|
|
|
+ <set>
|
|
|
+ <if test="memberGrade !=null ">
|
|
|
+ member_grade = #{memberGrade},
|
|
|
+ </if>
|
|
|
+ <if test="customerName !=null ">
|
|
|
+ customer_name = #{customerName},
|
|
|
+ </if>
|
|
|
+ <if test="phoneNumber !=null ">
|
|
|
+ phone_number = #{phoneNumber},
|
|
|
+ </if>
|
|
|
+ <if test="regtime !=null ">
|
|
|
+ regtime = #{regtime},
|
|
|
+ </if>
|
|
|
+ <if test="stationName !=null ">
|
|
|
+ station_name = #{stationName},
|
|
|
+ </if>
|
|
|
+ <if test="oilName !=null ">
|
|
|
+ oil_name = #{oilName},
|
|
|
+ </if>
|
|
|
+ <if test="liters !=null ">
|
|
|
+ liters = #{liters},
|
|
|
+ </if>
|
|
|
+ <if test="amt !=null ">
|
|
|
+ amt = #{amt},
|
|
|
+ </if>
|
|
|
+ <if test="grade !=null ">
|
|
|
+ grade = #{grade},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ <where>
|
|
|
+ <if test="stationId != null and stationId !='' ">
|
|
|
+ station_id = #{stationId}
|
|
|
+ </if>
|
|
|
+ <if test="phoneNumber !=null and phoneNumber !='' ">
|
|
|
+ AND phone_number = #{phoneNumber}
|
|
|
+ </if>
|
|
|
+ <if test="oilName !=null and oilName !='' ">
|
|
|
+ AND oil_name = #{oilName}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 插入客户表 -->
|
|
|
+ <insert id="insertCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage">
|
|
|
+ INSERT INTO customer_manage
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="memberId !=null ">
|
|
|
+ member_id,
|
|
|
+ </if>
|
|
|
+ <if test="customerName !=null ">
|
|
|
+ customer_name,
|
|
|
+ </if>
|
|
|
+ <if test="commendMan !=null ">
|
|
|
+ commend_man,
|
|
|
+ </if>
|
|
|
+ <if test="memberGrade !=null ">
|
|
|
+ member_grade,
|
|
|
+ </if>
|
|
|
+ <if test="phoneNumber !=null ">
|
|
|
+ phone_number,
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="carNumber !=null ">
|
|
|
+ car_number,
|
|
|
+ </if>
|
|
|
+ <if test="balance !=null ">
|
|
|
+ balance,
|
|
|
+ </if>
|
|
|
+ <if test="integral !=null ">
|
|
|
+ integral,
|
|
|
+ </if>
|
|
|
+ <if test="specialCarType !=null ">
|
|
|
+ specialCarType,
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="regtime !=null ">
|
|
|
+ regtime,
|
|
|
+ </if>
|
|
|
+ <if test="stationId !=null ">
|
|
|
+ station_id,
|
|
|
+ </if>
|
|
|
+ <if test="stationName !=null ">
|
|
|
+ station_name,
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="oilName !=null ">
|
|
|
+ oil_name,
|
|
|
+ </if>
|
|
|
+ <if test="liters !=null ">
|
|
|
+ liters,
|
|
|
+ </if>
|
|
|
+ <if test="amt !=null ">
|
|
|
+ amt,
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="cyGrade !=null ">
|
|
|
+ cy_grade,
|
|
|
+ </if>
|
|
|
+ <if test="qyGrade !=null ">
|
|
|
+ qy_grade,
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="blogOpenid !=null ">
|
|
|
+ blog_openid,
|
|
|
+ </if>
|
|
|
+ <if test="minaOpenid !=null ">
|
|
|
+ mina_openid,
|
|
|
+ </if>
|
|
|
+ <if test="blogUserId !=null ">
|
|
|
+ blog_user_id,
|
|
|
+ </if>
|
|
|
+ <if test="minaUserId !=null ">
|
|
|
+ mina_user_id,
|
|
|
+ </if>
|
|
|
+ <if test="grade !=null ">
|
|
|
+ grade,
|
|
|
+ </if>
|
|
|
+ <if test="unionId !=null and unionId !=''">
|
|
|
+ union_id
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+
|
|
|
+ <if test="memberId !=null ">
|
|
|
+ #{memberId},
|
|
|
+ </if>
|
|
|
+ <if test="customerName !=null ">
|
|
|
+ #{customerName},
|
|
|
+ </if>
|
|
|
+ <if test="commendMan !=null ">
|
|
|
+ #{commendMan},
|
|
|
+ </if>
|
|
|
+ <if test="memberGrade !=null ">
|
|
|
+ #{memberGrade},
|
|
|
+ </if>
|
|
|
+ <if test="phoneNumber !=null ">
|
|
|
+ #{phoneNumber},
|
|
|
+ </if>
|
|
|
+ <if test="carNumber !=null ">
|
|
|
+ #{carNumber},
|
|
|
+ </if>
|
|
|
+ <if test="balance !=null ">
|
|
|
+ #{balance},
|
|
|
+ </if>
|
|
|
+ <if test="integral !=null ">
|
|
|
+ #{integral},
|
|
|
+ </if>
|
|
|
+ <if test="specialCarType !=null ">
|
|
|
+ #{specialCarType},
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="regtime !=null ">
|
|
|
+ #{regtime},
|
|
|
+ </if>
|
|
|
+ <if test="stationId !=null ">
|
|
|
+ #{stationId, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="stationName !=null ">
|
|
|
+ #{stationName, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="oilName !=null ">
|
|
|
+ #{oilName},
|
|
|
+ </if>
|
|
|
+ <if test="liters !=null ">
|
|
|
+ #{liters},
|
|
|
+ </if>
|
|
|
+ <if test="amt !=null ">
|
|
|
+ #{amt},
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="cyGrade !=null ">
|
|
|
+ #{cyGrade},
|
|
|
+ </if>
|
|
|
+ <if test="qyGrade !=null ">
|
|
|
+ #{qyGrade},
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="blogOpenid !=null ">
|
|
|
+ #{blogOpenid},
|
|
|
+ </if>
|
|
|
+ <if test="minaOpenid !=null ">
|
|
|
+ #{minaOpenid, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="blogUserId !=null ">
|
|
|
+ #{blogUserId, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="minaUserId !=null ">
|
|
|
+ #{minaUserId, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="grade !=null ">
|
|
|
+ #{grade, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="unionId !=null and unionId !=''">
|
|
|
+ #{unionId, jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据手机号更新客户表 -->
|
|
|
+ <update id="updateCustomerInfoByPhoneNumber" parameterType="com.platform.yijia.pojo.CustomerManage">
|
|
|
+ UPDATE
|
|
|
+ customer_manage
|
|
|
+ <set>
|
|
|
+ <if test="customerName !=null ">
|
|
|
+ customer_name = #{customerName},
|
|
|
+ </if>
|
|
|
+ <if test="phoneNumber !=null ">
|
|
|
+ phone_number = #{phoneNumber},
|
|
|
+ </if>
|
|
|
+ <if test="regtime !=null ">
|
|
|
+ regtime = #{regtime},
|
|
|
+ </if>
|
|
|
+ <if test="stationName !=null ">
|
|
|
+ station_name = #{stationName},
|
|
|
+ </if>
|
|
|
+ <if test="stationId !=null ">
|
|
|
+ station_id = #{stationId},
|
|
|
+ </if>
|
|
|
+ <if test="blogUserId !=null ">
|
|
|
+ blog_user_id = #{blogUserId},
|
|
|
+ </if>
|
|
|
+ <if test="minaUserId !=null ">
|
|
|
+ mina_user_id = #{minaUserId},
|
|
|
+ </if>
|
|
|
+ <if test="oilName !=null ">
|
|
|
+ oil_name = #{oilName},
|
|
|
+ </if>
|
|
|
+ <if test="liters !=null ">
|
|
|
+ liters = #{liters},
|
|
|
+ </if>
|
|
|
+ <if test="amt !=null ">
|
|
|
+ amt = #{amt},
|
|
|
+ </if>
|
|
|
+ <if test="unionId !=null and unionId !=null">
|
|
|
+ union_id = #{unionId},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ <where>
|
|
|
+ <if test="phoneNumber !=null and phoneNumber !='' ">
|
|
|
+ phone_number = #{phoneNumber}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|