|
@@ -0,0 +1,239 @@
|
|
|
+<?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.ygj.yuemum.dao.customer.CustomerInfoBasicDao">
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.customer.CustomerInfoBasic" >
|
|
|
+ <result column="id" property="id" />
|
|
|
+ <result column="branche_name" property="branche_name" />
|
|
|
+ <result column="fb_customer_name" property="fb_customer_name" />
|
|
|
+ <result column="fb_customer_phone" property="fb_customer_phone" />
|
|
|
+ <result column="p_code" property="p_code" />
|
|
|
+ <result column="fb_wechat_number" property="fb_wechat_number" />
|
|
|
+ <result column="source_channel" property="source_channel" />
|
|
|
+ <result column="customer_state" property="customer_state" />
|
|
|
+ <result column="edc_date" property="edc_date" />
|
|
|
+ <result column="pregnancy_way" property="pregnancy_way" />
|
|
|
+ <result column="address_basic" property="address_basic" />
|
|
|
+ <result column="address_detail" property="address_detail" />
|
|
|
+ <result column="fb_remarks" property="fb_remarks" />
|
|
|
+ <result column="entry_date" property="entry_date" />
|
|
|
+ <result column="create_person" property="create_person" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id,
|
|
|
+ branche_name,
|
|
|
+ fb_customer_name,
|
|
|
+ fb_customer_phone,
|
|
|
+ p_code,
|
|
|
+ fb_wechat_number,
|
|
|
+ source_channel,
|
|
|
+ customer_state,
|
|
|
+ edc_date,
|
|
|
+ pregnancy_way,
|
|
|
+ address_basic,
|
|
|
+ address_detail,
|
|
|
+ fb_remarks,
|
|
|
+ entry_date,
|
|
|
+ create_person
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.ygj.yuemum.domain.customer.CustomerInfoBasic">
|
|
|
+ INSERT INTO customer_info_basic
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test ='null != branche_name'>
|
|
|
+ branche_name,
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_customer_name'>
|
|
|
+ fb_customer_name,
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_customer_phone'>
|
|
|
+ fb_customer_phone,
|
|
|
+ </if>
|
|
|
+ <if test ='null != p_code'>
|
|
|
+ p_code,
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_wechat_number'>
|
|
|
+ fb_wechat_number,
|
|
|
+ </if>
|
|
|
+ <if test ='null != source_channel'>
|
|
|
+ source_channel,
|
|
|
+ </if>
|
|
|
+ <if test ='null != customer_state'>
|
|
|
+ customer_state,
|
|
|
+ </if>
|
|
|
+ <if test ='null != edc_date'>
|
|
|
+ edc_date,
|
|
|
+ </if>
|
|
|
+ <if test ='null != pregnancy_way'>
|
|
|
+ pregnancy_way,
|
|
|
+ </if>
|
|
|
+ <if test ='null != address_basic'>
|
|
|
+ address_basic,
|
|
|
+ </if>
|
|
|
+ <if test ='null != address_detail'>
|
|
|
+ address_detail,
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_remarks'>
|
|
|
+ fb_remarks,
|
|
|
+ </if>
|
|
|
+ <if test ='null != entry_date'>
|
|
|
+ entry_date,
|
|
|
+ </if>
|
|
|
+ <if test ='null != create_person'>
|
|
|
+ create_person
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test ='null != branche_name'>
|
|
|
+ #{branche_name},
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_customer_name'>
|
|
|
+ #{fb_customer_name},
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_customer_phone'>
|
|
|
+ #{fb_customer_phone},
|
|
|
+ </if>
|
|
|
+ <if test ='null != p_code'>
|
|
|
+ #{p_code},
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_wechat_number'>
|
|
|
+ #{fb_wechat_number},
|
|
|
+ </if>
|
|
|
+ <if test ='null != source_channel'>
|
|
|
+ #{source_channel},
|
|
|
+ </if>
|
|
|
+ <if test ='null != customer_state'>
|
|
|
+ #{customer_state},
|
|
|
+ </if>
|
|
|
+ <if test ='null != edc_date'>
|
|
|
+ #{edc_date},
|
|
|
+ </if>
|
|
|
+ <if test ='null != pregnancy_way'>
|
|
|
+ #{pregnancy_way},
|
|
|
+ </if>
|
|
|
+ <if test ='null != address_basic'>
|
|
|
+ #{address_basic},
|
|
|
+ </if>
|
|
|
+ <if test ='null != address_detail'>
|
|
|
+ #{address_detail},
|
|
|
+ </if>
|
|
|
+ <if test ='null != fb_remarks'>
|
|
|
+ #{fb_remarks},
|
|
|
+ </if>
|
|
|
+ <if test ='null != entry_date'>
|
|
|
+ #{entry_date},
|
|
|
+ </if>
|
|
|
+ <if test ='null != create_person'>
|
|
|
+ #{create_person}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <delete id="delete" >
|
|
|
+ DELETE FROM customer_info_basic
|
|
|
+ WHERE id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.ygj.yuemum.domain.customer.CustomerInfoBasic">
|
|
|
+ UPDATE customer_info_basic
|
|
|
+ <set>
|
|
|
+ <if test ='null != branche_name'>branche_name = #{branche_name},</if>
|
|
|
+ <if test ='null != fb_customer_name'>fb_customer_name = #{fb_customer_name},</if>
|
|
|
+ <if test ='null != fb_customer_phone'>fb_customer_phone = #{fb_customer_phone},</if>
|
|
|
+ <if test ='null != p_code'>p_code = #{p_code},</if>
|
|
|
+ <if test ='null != fb_wechat_number'>fb_wechat_number = #{fb_wechat_number},</if>
|
|
|
+ <if test ='null != source_channel'>source_channel = #{source_channel},</if>
|
|
|
+ <if test ='null != customer_state'>customer_state = #{customer_state},</if>
|
|
|
+ <if test ='null != edc_date'>edc_date = #{edc_date},</if>
|
|
|
+ <if test ='null != pregnancy_way'>pregnancy_way = #{pregnancy_way},</if>
|
|
|
+ <if test ='null != address_basic'>address_basic = #{address_basic},</if>
|
|
|
+ <if test ='null != address_detail'>address_detail = #{address_detail},</if>
|
|
|
+ <if test ='null != fb_remarks'>fb_remarks = #{fb_remarks},</if>
|
|
|
+ <if test ='null != entry_date'>entry_date = #{entry_date},</if>
|
|
|
+ <if test ='null != create_person'>create_person = #{create_person}</if>
|
|
|
+ </set>
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="load" resultMap="BaseResultMap">
|
|
|
+ SELECT <include refid="Base_Column_List" />
|
|
|
+ FROM customer_info_basic
|
|
|
+ WHERE id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="pageList" resultMap="BaseResultMap">
|
|
|
+ SELECT <include refid="Base_Column_List" />
|
|
|
+ FROM customer_info_basic
|
|
|
+ LIMIT #{offset}, #{pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="pageListCount" resultType="java.lang.Integer">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM customer_info_basic
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--获取所有数据-->
|
|
|
+ <select id="selectByPageNumSize" resultType="com.ygj.yuemum.domain.customer.CustomerInfoBasic" parameterType="com.ygj.yuemum.domain.customer.dto.CustomerInfoBasicDto">
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ branche_name,
|
|
|
+ fb_customer_name,
|
|
|
+ fb_customer_phone,
|
|
|
+ (select p.p_name from packages p where p.p_code = c.p_code) as p_code,
|
|
|
+ fb_wechat_number,
|
|
|
+ source_channel,
|
|
|
+ customer_state,
|
|
|
+ edc_date,
|
|
|
+ pregnancy_way,
|
|
|
+ address_basic,
|
|
|
+ address_detail,
|
|
|
+ fb_remarks,
|
|
|
+ entry_date,
|
|
|
+ create_person
|
|
|
+ FROM
|
|
|
+ customer_info_basic c
|
|
|
+ where 1=1
|
|
|
+ <if test="p_code != null and p_code !=''">
|
|
|
+ and id = #{p_code}
|
|
|
+ </if>
|
|
|
+ <if test="id != null and id !=''">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="start_entry_date != null and start_entry_date !=''">
|
|
|
+ and entry_date >= #{start_entry_date}
|
|
|
+ </if>
|
|
|
+ <if test="end_entry_date != null and end_entry_date !=''">
|
|
|
+ and entry_date < #{end_entry_date}
|
|
|
+ </if>
|
|
|
+ <if test="source_channel != null ">
|
|
|
+ and source_channel in
|
|
|
+ <foreach collection="source_channel" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="fb_customer_phone != null and fb_customer_phone !=''">
|
|
|
+ and fb_customer_phone like "%"#{fb_customer_phone,jdbcType=VARCHAR}"%"
|
|
|
+ </if>
|
|
|
+ <if test="branche_name != null ">
|
|
|
+ and branche_name in
|
|
|
+ <foreach collection="branche_name" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="create_person != null ">
|
|
|
+ and create_person in
|
|
|
+ <foreach collection="create_person" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="customer_state != null ">
|
|
|
+ and customer_state in
|
|
|
+ <foreach collection="customer_state" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+</mapper>
|