QwExternalContactBlackLogMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.qw.mapper.QwExternalContactBlackLogMapper">
  6. <resultMap type="QwExternalContactBlackLog" id="QwExternalContactBlackLogResult">
  7. <result property="id" column="id" />
  8. <result property="externalUserId" column="external_user_id" />
  9. <result property="companyUserId" column="company_user_id" />
  10. <result property="createTime" column="create_time" />
  11. <result property="status" column="status" />
  12. <result property="blackStatus" column="black_status" />
  13. </resultMap>
  14. <sql id="selectQwExternalContactBlackLogVo">
  15. select id, external_user_id, company_user_id, create_time, status, black_status from qw_external_contact_black_log
  16. </sql>
  17. <select id="selectQwExternalContactBlackLogList" parameterType="QwExternalContactBlackLog" resultMap="QwExternalContactBlackLogResult">
  18. <include refid="selectQwExternalContactBlackLogVo"/>
  19. <where>
  20. <if test="id != null "> and id = #{id}</if>
  21. <if test="externalUserId != null and externalUserId != ''"> and external_user_id = #{externalUserId}</if>
  22. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  23. <if test="createTime != null "> and create_time = #{createTime}</if>
  24. <if test="status != null "> and status = #{status}</if>
  25. <if test="blackStatus != null "> and black_status = #{blackStatus}</if>
  26. </where>
  27. </select>
  28. <select id="selectQwExternalContactBlackLogById" parameterType="Long" resultMap="QwExternalContactBlackLogResult">
  29. <include refid="selectQwExternalContactBlackLogVo"/>
  30. where id = #{id}
  31. </select>
  32. <insert id="insertQwExternalContactBlackLog" parameterType="QwExternalContactBlackLog" useGeneratedKeys="true" keyProperty="id">
  33. insert into qw_external_contact_black_log
  34. <trim prefix="(" suffix=")" suffixOverrides=",">
  35. <if test="externalUserId != null">external_user_id,</if>
  36. <if test="companyUserId != null">company_user_id,</if>
  37. <if test="createTime != null">create_time,</if>
  38. <if test="status != null">status,</if>
  39. <if test="blackStatus != null">black_status,</if>
  40. </trim>
  41. <trim prefix="values (" suffix=")" suffixOverrides=",">
  42. <if test="externalUserId != null">#{externalUserId},</if>
  43. <if test="companyUserId != null">#{companyUserId},</if>
  44. <if test="createTime != null">#{createTime},</if>
  45. <if test="status != null">#{status},</if>
  46. <if test="blackStatus != null">#{blackStatus},</if>
  47. </trim>
  48. </insert>
  49. <update id="updateQwExternalContactBlackLog" parameterType="QwExternalContactBlackLog">
  50. update qw_external_contact_black_log
  51. <trim prefix="SET" suffixOverrides=",">
  52. <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
  53. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  54. <if test="createTime != null">create_time = #{createTime},</if>
  55. <if test="status != null">status = #{status},</if>
  56. <if test="blackStatus != null">black_status = #{blackStatus},</if>
  57. </trim>
  58. where id = #{id}
  59. </update>
  60. <delete id="deleteQwExternalContactBlackLogById" parameterType="Long">
  61. delete from qw_external_contact_black_log where id = #{id}
  62. </delete>
  63. <delete id="deleteQwExternalContactBlackLogByIds" parameterType="String">
  64. delete from qw_external_contact_black_log where id in
  65. <foreach item="id" collection="array" open="(" separator="," close=")">
  66. #{id}
  67. </foreach>
  68. </delete>
  69. <insert id="insertLogBySelectExternalContact" parameterType="QwExternalContactBlackLog" useGeneratedKeys="true" keyProperty="id">
  70. INSERT INTO qw_external_contact_black_log ( external_user_id, company_user_id, create_time, STATUS, black_status )
  71. SELECT
  72. id,company_user_id,
  73. NOW(),
  74. STATUS,
  75. 7
  76. FROM
  77. qw_external_contact
  78. WHERE qw_external_contact.id in
  79. <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
  80. #{id}
  81. </foreach>
  82. </insert>
  83. <select id="selectContactLogByIds" resultType="QwExternalContact">
  84. SELECT
  85. qw_external_contact.id,
  86. qw_external_contact.STATUS
  87. from qw_external_contact_black_log
  88. where external_user_id in
  89. <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
  90. (#{id})
  91. </foreach>
  92. </select>
  93. </mapper>