CrmCustomerExtMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.crm.mapper.CrmCustomerExtMapper">
  6. <resultMap type="CrmCustomerExt" id="CrmCustomerExtResult">
  7. <result property="extId" column="ext_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="name" column="name" />
  10. <result property="type" column="type" />
  11. <result property="status" column="status" />
  12. <result property="sort" column="sort" />
  13. </resultMap>
  14. <sql id="selectCrmCustomerExtVo">
  15. select ext_id, company_id, name, type, status, sort from crm_customer_ext
  16. </sql>
  17. <select id="selectCrmCustomerExtList" parameterType="CrmCustomerExt" resultMap="CrmCustomerExtResult">
  18. <include refid="selectCrmCustomerExtVo"/>
  19. <where>
  20. <if test="companyId != null "> and company_id = #{companyId}</if>
  21. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  22. <if test="type != null "> and type = #{type}</if>
  23. <if test="status != null "> and status = #{status}</if>
  24. <if test="sort != null "> and sort = #{sort}</if>
  25. </where>
  26. order by sort asc
  27. </select>
  28. <select id="selectCrmCustomerExtById" parameterType="Long" resultMap="CrmCustomerExtResult">
  29. <include refid="selectCrmCustomerExtVo"/>
  30. where ext_id = #{extId}
  31. </select>
  32. <insert id="insertCrmCustomerExt" parameterType="CrmCustomerExt" useGeneratedKeys="true" keyProperty="extId">
  33. insert into crm_customer_ext
  34. <trim prefix="(" suffix=")" suffixOverrides=",">
  35. <if test="companyId != null">company_id,</if>
  36. <if test="name != null">name,</if>
  37. <if test="type != null">type,</if>
  38. <if test="status != null">status,</if>
  39. <if test="sort != null">sort,</if>
  40. </trim>
  41. <trim prefix="values (" suffix=")" suffixOverrides=",">
  42. <if test="companyId != null">#{companyId},</if>
  43. <if test="name != null">#{name},</if>
  44. <if test="type != null">#{type},</if>
  45. <if test="status != null">#{status},</if>
  46. <if test="sort != null">#{sort},</if>
  47. </trim>
  48. </insert>
  49. <update id="updateCrmCustomerExt" parameterType="CrmCustomerExt">
  50. update crm_customer_ext
  51. <trim prefix="SET" suffixOverrides=",">
  52. <if test="companyId != null">company_id = #{companyId},</if>
  53. <if test="name != null">name = #{name},</if>
  54. <if test="type != null">type = #{type},</if>
  55. <if test="status != null">status = #{status},</if>
  56. <if test="sort != null">sort = #{sort},</if>
  57. </trim>
  58. where ext_id = #{extId}
  59. </update>
  60. <delete id="deleteCrmCustomerExtById" parameterType="Long">
  61. delete from crm_customer_ext where ext_id = #{extId}
  62. </delete>
  63. <delete id="deleteCrmCustomerExtByIds" parameterType="String">
  64. delete from crm_customer_ext where ext_id in
  65. <foreach item="extId" collection="array" open="(" separator="," close=")">
  66. #{extId}
  67. </foreach>
  68. </delete>
  69. </mapper>