|
@@ -0,0 +1,106 @@
|
|
|
|
|
+<?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.crm.mapper.CrmCustomerPropertyMapper">
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap type="CrmCustomerProperty" id="CrmCustomerPropertyResult">
|
|
|
|
|
+ <result property="id" column="id" />
|
|
|
|
|
+ <result property="customerId" column="customer_id" />
|
|
|
|
|
+ <result property="propertyId" column="property_id" />
|
|
|
|
|
+ <result property="propertyName" column="property_name" />
|
|
|
|
|
+ <result property="propertyValue" column="property_value" />
|
|
|
|
|
+ <result property="propertyValueType" column="property_value_type" />
|
|
|
|
|
+ <result property="tradeType" column="trade_type" />
|
|
|
|
|
+ <result property="aiAnalysis" column="ai_analysis" />
|
|
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
|
|
+ <result property="remark" column="remark" />
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="selectCrmCustomerPropertyVo">
|
|
|
|
|
+ select id, customer_id, property_id, property_name, property_value, property_value_type, trade_type, ai_analysis, create_time, create_by, update_time, update_by, remark from crm_customer_property
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectCrmCustomerPropertyList" parameterType="CrmCustomerProperty" resultMap="CrmCustomerPropertyResult">
|
|
|
|
|
+ <include refid="selectCrmCustomerPropertyVo"/>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="customerId != null"> and customer_id = #{customerId}</if>
|
|
|
|
|
+ <if test="propertyId != null"> and property_id = #{propertyId}</if>
|
|
|
|
|
+ <if test="propertyName != null and propertyName != ''"> and property_name like concat('%', #{propertyName}, '%')</if>
|
|
|
|
|
+ <if test="propertyValue != null and propertyValue != ''"> and property_value like concat('%', #{propertyValue}, '%')</if>
|
|
|
|
|
+ <if test="propertyValueType != null and propertyValueType != ''"> and property_value_type = #{propertyValueType}</if>
|
|
|
|
|
+ <if test="tradeType != null and tradeType != ''"> and trade_type = #{tradeType}</if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ order by id desc
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectCrmCustomerPropertyById" parameterType="Long" resultMap="CrmCustomerPropertyResult">
|
|
|
|
|
+ <include refid="selectCrmCustomerPropertyVo"/>
|
|
|
|
|
+ where id = #{id}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <insert id="insertCrmCustomerProperty" parameterType="CrmCustomerProperty" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
+ insert into crm_customer_property
|
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
+ <if test="customerId != null">customer_id,</if>
|
|
|
|
|
+ <if test="propertyId != null">property_id,</if>
|
|
|
|
|
+ <if test="propertyName != null">property_name,</if>
|
|
|
|
|
+ <if test="propertyValue != null">property_value,</if>
|
|
|
|
|
+ <if test="propertyValueType != null">property_value_type,</if>
|
|
|
|
|
+ <if test="tradeType != null">trade_type,</if>
|
|
|
|
|
+ <if test="aiAnalysis != null">ai_analysis,</if>
|
|
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
+ <if test="customerId != null">#{customerId},</if>
|
|
|
|
|
+ <if test="propertyId != null">#{propertyId},</if>
|
|
|
|
|
+ <if test="propertyName != null">#{propertyName},</if>
|
|
|
|
|
+ <if test="propertyValue != null">#{propertyValue},</if>
|
|
|
|
|
+ <if test="propertyValueType != null">#{propertyValueType},</if>
|
|
|
|
|
+ <if test="tradeType != null">#{tradeType},</if>
|
|
|
|
|
+ <if test="aiAnalysis != null">#{aiAnalysis},</if>
|
|
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ </insert>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateCrmCustomerProperty" parameterType="CrmCustomerProperty">
|
|
|
|
|
+ update crm_customer_property
|
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
+ <if test="customerId != null">customer_id = #{customerId},</if>
|
|
|
|
|
+ <if test="propertyId != null">property_id = #{propertyId},</if>
|
|
|
|
|
+ <if test="propertyName != null">property_name = #{propertyName},</if>
|
|
|
|
|
+ <if test="propertyValue != null">property_value = #{propertyValue},</if>
|
|
|
|
|
+ <if test="propertyValueType != null">property_value_type = #{propertyValueType},</if>
|
|
|
|
|
+ <if test="tradeType != null">trade_type = #{tradeType},</if>
|
|
|
|
|
+ <if test="aiAnalysis != null">ai_analysis = #{aiAnalysis},</if>
|
|
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ where id = #{id}
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteCrmCustomerPropertyById" parameterType="Long">
|
|
|
|
|
+ delete from crm_customer_property where id = #{id}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteCrmCustomerPropertyByIds" parameterType="String">
|
|
|
|
|
+ delete from crm_customer_property where id in
|
|
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
+ #{id}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </delete>
|
|
|
|
|
+</mapper>
|