123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?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.CrmCustomerAssistMapper">
- <resultMap type="CrmCustomerAssist" id="CrmCustomerAssistResult">
- <result property="id" column="id" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="companyUserName" column="company_user_name" />
- <result property="customerId" column="customer_id" />
- <result property="createTime" column="create_time" />
- </resultMap>
- <sql id="selectCrmCustomerAssistVo">
- select id, company_id, company_user_id,company_user_name, customer_id, create_time from crm_customer_assist
- </sql>
- <select id="selectCrmCustomerAssistList" parameterType="CrmCustomerAssist" resultMap="CrmCustomerAssistResult">
- <include refid="selectCrmCustomerAssistVo"/>
- <where>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- <if test="companyUserName != null and companyUserName != ''"> and company_user_name = #{companyUserName}</if>
- <if test="customerId != null "> and customer_id = #{customerId}</if>
- </where>
- </select>
- <select id="selectCrmCustomerAssistById" parameterType="Long" resultMap="CrmCustomerAssistResult">
- <include refid="selectCrmCustomerAssistVo"/>
- where id = #{id}
- </select>
- <select id="selectCompanyUserNameByCustomerId" resultType="java.lang.String">
- select CONCAT(company_user_name, '(', company_user_id, ')') AS assistUser
- from crm_customer_assist
- where customer_id = #{customerId}
- </select>
- <insert id="insertCrmCustomerAssist" parameterType="CrmCustomerAssist" useGeneratedKeys="true" keyProperty="id">
- insert into crm_customer_assist
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="companyId != null">company_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="companyUserName != null">company_user_name,</if>
- <if test="customerId != null">customer_id,</if>
- <if test="createTime != null">create_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="companyId != null">#{companyId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="companyUserName != null">#{companyUserName},</if>
- <if test="customerId != null">#{customerId},</if>
- <if test="createTime != null">#{createTime},</if>
- </trim>
- </insert>
- <update id="updateCrmCustomerAssist" parameterType="CrmCustomerAssist">
- update crm_customer_assist
- <trim prefix="SET" suffixOverrides=",">
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
- <if test="customerId != null">customer_id = #{customerId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCrmCustomerAssistById" parameterType="Long">
- delete from crm_customer_assist where id = #{id}
- </delete>
- <delete id="deleteCrmCustomerAssistByIds" parameterType="String">
- delete from crm_customer_assist where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <delete id="removeByCustomer">
- delete from crm_customer_assist where customer_id in
- <foreach collection="maps.customerIds" item="customerId" open="(" separator="," close=")">
- #{customerId}
- </foreach>
- <if test="maps.companyUserId != null">
- and company_user_id = #{maps.companyUserId}
- </if>
- </delete>
- <delete id="deleteCrmCustomerAssistByCustomerId">
- delete from crm_customer_assist where customer_id = #{customerId}
- </delete>
- </mapper>
|