You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WebhookMapper.xml 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
  3. <mapper namespace="org.sonar.db.webhook.WebhookMapper">
  4. <sql id="sqlColumns">
  5. uuid,
  6. name,
  7. url,
  8. project_uuid as projectUuid,
  9. secret,
  10. created_at as createdAt,
  11. updated_at as updatedAt
  12. </sql>
  13. <select id="selectByUuid" parameterType="String" resultType="org.sonar.db.webhook.WebhookDto">
  14. select <include refid="sqlColumns" />
  15. from webhooks
  16. where uuid = #{webhookUuid,jdbcType=VARCHAR}
  17. </select>
  18. <select id="selectAllOrderedByName" parameterType="String" resultType="org.sonar.db.webhook.WebhookDto">
  19. select <include refid="sqlColumns" />
  20. from webhooks
  21. order by name asc
  22. </select>
  23. <select id="selectGlobalWebhooksOrderedByName" parameterType="String" resultType="org.sonar.db.webhook.WebhookDto">
  24. select <include refid="sqlColumns" />
  25. from webhooks
  26. where project_uuid is null
  27. order by name asc
  28. </select>
  29. <select id="selectForProjectUuidOrderedByName" parameterType="String" resultType="org.sonar.db.webhook.WebhookDto">
  30. select <include refid="sqlColumns" />
  31. from webhooks
  32. where project_uuid = #{projectUuid,jdbcType=VARCHAR}
  33. order by name asc
  34. </select>
  35. <insert id="insert" parameterType="org.sonar.db.webhook.WebhookDto" useGeneratedKeys="false">
  36. insert into webhooks (
  37. uuid,
  38. name,
  39. url,
  40. project_uuid,
  41. secret,
  42. created_at,
  43. updated_at
  44. ) values (
  45. #{uuid,jdbcType=VARCHAR},
  46. #{name,jdbcType=VARCHAR},
  47. #{url,jdbcType=VARCHAR},
  48. #{projectUuid,jdbcType=VARCHAR},
  49. #{secret,jdbcType=VARCHAR},
  50. #{createdAt,jdbcType=BIGINT},
  51. #{updatedAt,jdbcType=BIGINT}
  52. )
  53. </insert>
  54. <update id="update" parameterType="org.sonar.db.webhook.WebhookDto">
  55. update webhooks set
  56. name=#{name,jdbcType=VARCHAR},
  57. url=#{url,jdbcType=VARCHAR},
  58. secret=#{secret,jdbcType=VARCHAR},
  59. updated_at=#{updatedAt,jdbcType=BIGINT}
  60. where uuid=#{uuid,jdbcType=VARCHAR}
  61. </update>
  62. <delete id="delete" parameterType="String">
  63. delete from webhooks
  64. where
  65. uuid = #{uuid,jdbcType=VARCHAR}
  66. </delete>
  67. <delete id="deleteForProjectUuid" parameterType="String">
  68. delete from webhooks
  69. where
  70. project_uuid = #{projectUuid,jdbcType=VARCHAR}
  71. </delete>
  72. </mapper>