QwSopTempContentMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.sop.mapper.QwSopTempContentMapper">
  6. <resultMap type="QwSopTempContent" id="QwSopTempContentResult">
  7. <result property="id" column="id" />
  8. <result property="rulesId" column="rules_id" />
  9. <result property="sendType" column="send_type" />
  10. <result property="content" column="content" />
  11. <result property="isBindUrl" column="is_bind_url" />
  12. <result property="expiresDays" column="expires_days" />
  13. </resultMap>
  14. <sql id="selectQwSopTempContentVo">
  15. select id, rules_id, send_type, content, is_bind_url, expires_days from qw_sop_temp_content
  16. </sql>
  17. <select id="selectQwSopTempContentList" parameterType="QwSopTempContent" resultMap="QwSopTempContentResult">
  18. <include refid="selectQwSopTempContentVo"/>
  19. <where>
  20. <if test="rulesId != null and rulesId != ''"> and rules_id = #{rulesId}</if>
  21. <if test="sendType != null "> and send_type = #{sendType}</if>
  22. <if test="content != null and content != ''"> and content = #{content}</if>
  23. <if test="isBindUrl != null "> and is_bind_url = #{isBindUrl}</if>
  24. <if test="expiresDays != null and expiresDays != ''"> and expires_days = #{expiresDays}</if>
  25. </where>
  26. </select>
  27. <select id="selectQwSopTempContentById" parameterType="String" resultMap="QwSopTempContentResult">
  28. <include refid="selectQwSopTempContentVo"/>
  29. where id = #{id}
  30. </select>
  31. <!-- <select id="listByRulesIds" resultType="com.fs.sop.domain.QwSopTempContent">-->
  32. <!-- select * from qw_sop_temp_content where rules_id in-->
  33. <!-- <foreach collection="ids" open="(" close=")" item="item" separator=",">CAST(#{item} AS UUID)</foreach>-->
  34. <!-- </select>-->
  35. <select id="listByRulesIds" resultType="com.fs.sop.domain.QwSopTempContent">
  36. select * from qw_sop_temp_content where rules_id in
  37. <foreach collection="ids" open="(" close=")" item="item" separator=",">#{item}</foreach>
  38. </select>
  39. <select id="listVoice" resultType="com.fs.sop.domain.QwSopTempContent">
  40. SELECT a.* FROM qw_sop_temp_content a inner join qw_sop_temp_rules b on a.rules_id = b.id WHERE a.temp_id = #{tempId} AND a.content_type = 7
  41. </select>
  42. <select id="listByTempAndDay" resultType="com.fs.sop.domain.QwSopTempContent">
  43. SELECT a.* FROM qw_sop_temp_content a WHERE a.temp_id = #{tempId} and a.day_id = #{dayId} AND a.content_type = 7
  44. </select>
  45. <insert id="insertQwSopTempContent" parameterType="QwSopTempContent">
  46. insert into qw_sop_temp_content
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="id != null">id,</if>
  49. <if test="rulesId != null">rules_id,</if>
  50. <if test="sendType != null">send_type,</if>
  51. <if test="content != null">content,</if>
  52. <if test="isBindUrl != null">is_bind_url,</if>
  53. <if test="expiresDays != null">expires_days,</if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="id != null">#{id},</if>
  57. <if test="rulesId != null">#{rulesId},</if>
  58. <if test="sendType != null">#{sendType},</if>
  59. <if test="content != null">#{content},</if>
  60. <if test="isBindUrl != null">#{isBindUrl},</if>
  61. <if test="expiresDays != null">#{expiresDays},</if>
  62. </trim>
  63. </insert>
  64. <insert id="insertBatch" useGeneratedKeys="false">
  65. insert into qw_sop_temp_content (id, temp_id,rules_id,content_type,content,is_bind_url,expires_days)
  66. values
  67. <foreach collection="list" item="item" separator=",">
  68. ( CAST(#{item.id} AS UUID), CAST(#{item.tempId} AS UUID), CAST(#{item.rulesId} AS UUID), #{item.contentType}, #{item.content}, #{item.isBindUrl}, #{item.expiresDays})
  69. </foreach>
  70. </insert>
  71. <update id="updateQwSopTempContent" parameterType="QwSopTempContent">
  72. update qw_sop_temp_content
  73. <trim prefix="SET" suffixOverrides=",">
  74. <if test="rulesId != null">rules_id = #{rulesId},</if>
  75. <if test="sendType != null">send_type = #{sendType},</if>
  76. <if test="content != null">content = #{content},</if>
  77. <if test="isBindUrl != null">is_bind_url = #{isBindUrl},</if>
  78. <if test="expiresDays != null">expires_days = #{expiresDays},</if>
  79. </trim>
  80. where id = #{id}
  81. </update>
  82. <update id="updateDay">
  83. update qw_sop_temp_content set day_id = #{dayId} where id = #{id}
  84. </update>
  85. <delete id="deleteQwSopTempContentById" parameterType="String">
  86. ALTER TABLE qw_sop_temp_content DELETE where id = CAST(#{id} AS UUID)
  87. </delete>
  88. <delete id="deleteQwSopTempContentByIds" parameterType="String">
  89. delete from qw_sop_temp_content where id in
  90. <foreach item="id" collection="array" open="(" separator="," close=")">
  91. #{id}
  92. </foreach>
  93. </delete>
  94. <!-- <delete id="deleteByTempId">-->
  95. <!-- ALTER TABLE qw_sop_temp_content DELETE where temp_id = CAST(#{id} AS UUID)-->
  96. <!-- </delete>-->
  97. <delete id="deleteByTempId">
  98. DELETE from qw_sop_temp_content where temp_id = #{id}
  99. </delete>
  100. <delete id="deleteByRulesId">
  101. ALTER TABLE qw_sop_temp_content DELETE where rules_id = CAST(#{id} AS UUID)
  102. </delete>
  103. <!-- <delete id="deleteByRulesIdList">-->
  104. <!-- ALTER TABLE qw_sop_temp_content DELETE where rules_id in-->
  105. <!-- <foreach item="id" collection="ids" open="(" separator="," close=")">-->
  106. <!-- CAST(#{id} AS UUID)-->
  107. <!-- </foreach>-->
  108. <!-- </delete>-->
  109. <delete id="deleteByRulesIdList">
  110. DELETE from qw_sop_temp_content where rules_id in
  111. <foreach item="id" collection="ids" open="(" separator="," close=")">
  112. #{id}
  113. </foreach>
  114. </delete>
  115. </mapper>