123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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.qw.mapper.QwExternalContactCrmMapper">
-
- <resultMap type="QwExternalContactCrm" id="QwExternalContactCrmResult">
- <result property="id" column="id" />
- <result property="externalUserId" column="external_user_id" />
- <result property="openid" column="openid" />
- <result property="externalUserName" column="external_user_name" />
- <result property="customerId" column="customer_id" />
- <result property="companyId" column="company_id" />
- <result property="corpId" column="corp_id" />
- <result property="avatar" column="avatar" />
- <result property="fsUserId" column="fs_user_id" />
- </resultMap>
- <sql id="selectQwExternalContactCrmVo">
- select id, external_user_id,openid, external_user_name, avatar, customer_id, company_id, corp_id, fs_user_id from qw_external_contact_crm
- </sql>
- <select id="selectQwExternalContactCrmList" parameterType="QwExternalContactCrm" resultMap="QwExternalContactCrmResult">
- <include refid="selectQwExternalContactCrmVo"/>
- <where>
- <if test="externalUserId != null and externalUserId != ''"> and external_user_id = #{externalUserId}</if>
- <if test="openid != null and openid != ''"> and openid = #{openid}</if>
- <if test="externalUserName != null and externalUserName != ''"> and external_user_name like concat('%', #{externalUserName}, '%')</if>
- <if test="customerId != null "> and customer_id = #{customerId}</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="corpId != null "> and corp_id = #{corpId}</if>
- <if test="avatar != null "> and avatar = #{avatar}</if>
- <if test="fsUserId != null "> and fs_user_id = #{fsUserId}</if>
- </where>
- </select>
-
- <select id="selectQwExternalContactCrmById" parameterType="Long" resultMap="QwExternalContactCrmResult">
- <include refid="selectQwExternalContactCrmVo"/>
- where id = #{id}
- </select>
- <insert id="insertQwExternalContactCrm" parameterType="QwExternalContactCrm">
- insert into qw_external_contact_crm
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="externalUserId != null">external_user_id,</if>
- <if test="openid != null">openid,</if>
- <if test="externalUserName != null">external_user_name,</if>
- <if test="customerId != null">customer_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="corpId != null">corp_id,</if>
- <if test="avatar != null">avatar,</if>
- <if test="fsUserId != null">fs_user_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="externalUserId != null">#{externalUserId},</if>
- <if test="openid != null">#{openid},</if>
- <if test="externalUserName != null">#{externalUserName},</if>
- <if test="customerId != null">#{customerId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="corpId != null">#{corpId},</if>
- <if test="avatar != null">#{avatar},</if>
- <if test="fsUserId != null">#{fsUserId},</if>
- </trim>
- </insert>
- <insert id="insertOrUpdateQwExternalContactCrm" parameterType="QwExternalContactCrm">
- insert into qw_external_contact_crm
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="externalUserId != null">external_user_id,</if>
- <if test="openid != null">openid,</if>
- <if test="externalUserName != null">external_user_name,</if>
- <if test="customerId != null">customer_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="corpId != null">corp_id,</if>
- <if test="avatar != null">avatar,</if>
- <if test="fsUserId != null">fs_user_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="externalUserId != null">#{externalUserId},</if>
- <if test="openid != null">#{openid},</if>
- <if test="externalUserName != null">#{externalUserName},</if>
- <if test="customerId != null">#{customerId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="corpId != null">#{corpId},</if>
- <if test="avatar != null">#{avatar},</if>
- <if test="fsUserId != null">#{fsUserId},</if>
- </trim>
- on duplicate key update
- <trim suffixOverrides=",">
- <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
- <if test="openid != null">openid = #{openid},</if>
- <if test="externalUserName != null">external_user_name = #{externalUserName},</if>
- <if test="customerId != null">customer_id = #{customerId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="avatar != null">avatar = #{avatar},</if>
- <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
- </trim>
- </insert>
- <update id="updateQwExternalContactCrm" parameterType="QwExternalContactCrm">
- update qw_external_contact_crm
- <trim prefix="SET" suffixOverrides=",">
- <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
- <if test="openid != null">external_user_id = #{openid},</if>
- <if test="externalUserName != null">external_user_name = #{externalUserName},</if>
- <if test="customerId != null">customer_id = #{customerId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="avatar != null">avatar = #{avatar},</if>
- <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteQwExternalContactCrmById" parameterType="Long">
- delete from qw_external_contact_crm where id = #{id}
- </delete>
- <delete id="deleteQwExternalContactCrmByIds" parameterType="String">
- delete from qw_external_contact_crm where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|