|
|
@@ -0,0 +1,162 @@
|
|
|
+<?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.fs.scrm.mapper.ScrmCustomerInfoMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.fs.scrm.domain.ScrmCustomerInfo" id="ScrmCustomerInfoResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="externalContactId" column="external_contact_id" />
|
|
|
+ <result property="source" column="source" />
|
|
|
+ <result property="customerType" column="customer_type" />
|
|
|
+ <result property="visitStatus" column="visit_status" />
|
|
|
+ <result property="tags" column="tags" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="lastTime" column="last_time" />
|
|
|
+ <result property="followContent" column="follow_content" />
|
|
|
+ <result property="visitRecords" column="visit_records" />
|
|
|
+ <result property="recordings" column="recordings" />
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="com.fs.scrm.vo.ScrmCustomerInfoVO" id="ScrmCustomerInfoVOResult">
|
|
|
+ <!-- scrm_customer_info -->
|
|
|
+ <result property="scrmInfoId" column="scrm_info_id" />
|
|
|
+ <result property="externalContactId" column="external_contact_id" />
|
|
|
+ <result property="source" column="source" />
|
|
|
+ <result property="customerType" column="customer_type" />
|
|
|
+ <result property="visitStatus" column="visit_status" />
|
|
|
+ <result property="tags" column="tags" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="lastTime" column="last_time" />
|
|
|
+ <result property="followContent" column="follow_content" />
|
|
|
+ <result property="visitRecords" column="visit_records" />
|
|
|
+ <result property="recordings" column="recordings" />
|
|
|
+ <!-- qw_external_contact -->
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="externalUserId" column="external_user_id" />
|
|
|
+ <result property="remarkMobiles" column="remark_mobiles" />
|
|
|
+ <result property="gender" column="gender" />
|
|
|
+ <result property="type" column="type" />
|
|
|
+ <result property="addWay" column="add_way" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="tagIds" column="tag_ids" />
|
|
|
+ <result property="fsUserId" column="fs_user_id" />
|
|
|
+ <result property="qwUserId" column="qw_user_id" />
|
|
|
+ <result property="companyUserId" column="company_user_id" />
|
|
|
+ <result property="corpId" column="corp_id" />
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="roboticCallOutCount" column="robotic_call_out_count" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectScrmCustomerInfoList" parameterType="com.fs.scrm.param.ScrmCustomerInfoQueryParam" resultMap="ScrmCustomerInfoVOResult">
|
|
|
+ select
|
|
|
+ sci.id as scrm_info_id,
|
|
|
+ sci.external_contact_id,
|
|
|
+ sci.source,
|
|
|
+ sci.customer_type,
|
|
|
+ sci.visit_status,
|
|
|
+ sci.tags,
|
|
|
+ sci.remark,
|
|
|
+ sci.last_time,
|
|
|
+ sci.follow_content,
|
|
|
+ sci.visit_records,
|
|
|
+ sci.recordings,
|
|
|
+ qec.id as external_contact_id,
|
|
|
+ qec.name,
|
|
|
+ qec.user_id,
|
|
|
+ qec.external_user_id,
|
|
|
+ qec.remark_mobiles,
|
|
|
+ qec.gender,
|
|
|
+ qec.type,
|
|
|
+ qec.add_way,
|
|
|
+ qec.status,
|
|
|
+ qec.tag_ids,
|
|
|
+ qec.fs_user_id,
|
|
|
+ qec.qw_user_id,
|
|
|
+ qec.company_user_id,
|
|
|
+ qec.corp_id,
|
|
|
+ qec.company_id,
|
|
|
+ qec.create_time,
|
|
|
+ 0 as robotic_call_out_count
|
|
|
+ from qw_external_contact qec
|
|
|
+ left join scrm_customer_info sci on sci.external_contact_id = qec.id
|
|
|
+ <where>
|
|
|
+ <if test="externalContactId != null"> and qec.id = #{externalContactId}</if>
|
|
|
+ <if test="fsUserId != null"> and qec.fs_user_id = #{fsUserId}</if>
|
|
|
+ <if test="companyId != null"> and qec.company_id = #{companyId}</if>
|
|
|
+ <if test="companyUserId != null"> and qec.company_user_id = #{companyUserId}</if>
|
|
|
+ <if test="createTimeStart != null and createTimeStart != '' and createTimeEnd != null and createTimeEnd != ''">
|
|
|
+ and qec.create_time between #{createTimeStart} and #{createTimeEnd}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by qec.create_time desc, qec.id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectScrmCustomerInfoByExternalContactId" parameterType="Long" resultMap="ScrmCustomerInfoResult">
|
|
|
+ select * from scrm_customer_info where external_contact_id = #{externalContactId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertScrmCustomerInfo" parameterType="com.fs.scrm.domain.ScrmCustomerInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into scrm_customer_info
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="externalContactId != null">external_contact_id,</if>
|
|
|
+ <if test="source != null">source,</if>
|
|
|
+ <if test="customerType != null">customer_type,</if>
|
|
|
+ <if test="visitStatus != null">visit_status,</if>
|
|
|
+ <if test="tags != null">tags,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="lastTime != null">last_time,</if>
|
|
|
+ <if test="followContent != null">follow_content,</if>
|
|
|
+ <if test="visitRecords != null">visit_records,</if>
|
|
|
+ <if test="recordings != null">recordings,</if>
|
|
|
+ <if test="companyId != null">company_id,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="externalContactId != null">#{externalContactId},</if>
|
|
|
+ <if test="source != null">#{source},</if>
|
|
|
+ <if test="customerType != null">#{customerType},</if>
|
|
|
+ <if test="visitStatus != null">#{visitStatus},</if>
|
|
|
+ <if test="tags != null">#{tags},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="lastTime != null">#{lastTime},</if>
|
|
|
+ <if test="followContent != null">#{followContent},</if>
|
|
|
+ <if test="visitRecords != null">#{visitRecords},</if>
|
|
|
+ <if test="recordings != null">#{recordings},</if>
|
|
|
+ <if test="companyId != null">#{companyId},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateScrmCustomerInfo" parameterType="com.fs.scrm.domain.ScrmCustomerInfo">
|
|
|
+ update scrm_customer_info
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="source != null">source = #{source},</if>
|
|
|
+ <if test="customerType != null">customer_type = #{customerType},</if>
|
|
|
+ <if test="visitStatus != null">visit_status = #{visitStatus},</if>
|
|
|
+ <if test="tags != null">tags = #{tags},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="lastTime != null">last_time = #{lastTime},</if>
|
|
|
+ <if test="followContent != null">follow_content = #{followContent},</if>
|
|
|
+ <if test="visitRecords != null">visit_records = #{visitRecords},</if>
|
|
|
+ <if test="recordings != null">recordings = #{recordings},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where external_contact_id = #{externalContactId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|