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.

ProjectAlmSettingMapper.xml 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.alm.setting.ProjectAlmSettingMapper">
  4. <sql id="sqlColumns">
  5. p.uuid as uuid,
  6. p.project_uuid as projectUuid,
  7. p.alm_setting_uuid as almSettingUuid,
  8. p.alm_repo as almRepo,
  9. p.alm_slug as almSlug,
  10. p.summary_comment_enabled as summaryCommentEnabled,
  11. p.created_at as createdAt,
  12. p.updated_at as updatedAt
  13. </sql>
  14. <select id="selectByProjectUuid" parameterType="string" resultType="org.sonar.db.alm.setting.ProjectAlmSettingDto">
  15. select <include refid="sqlColumns"/>
  16. from
  17. project_alm_settings p
  18. where
  19. p.project_uuid = #{projectUuid, jdbcType=VARCHAR}
  20. </select>
  21. <select id="selectByAlmSettingAndSlugs" parameterType="string" resultType="org.sonar.db.alm.setting.ProjectAlmSettingDto">
  22. select <include refid="sqlColumns"/>
  23. from
  24. project_alm_settings p
  25. where
  26. alm_setting_uuid=#{almSettingUuid, jdbcType=VARCHAR}
  27. and alm_slug in
  28. <foreach collection="slugs" open="(" close=")" item="slug" separator=",">
  29. #{slug, jdbcType=VARCHAR}
  30. </foreach>
  31. </select>
  32. <insert id="insert" parameterType="Map" useGeneratedKeys="false">
  33. INSERT INTO project_alm_settings
  34. (
  35. uuid,
  36. project_uuid,
  37. alm_setting_uuid,
  38. alm_repo,
  39. alm_slug,
  40. summary_comment_enabled,
  41. created_at,
  42. updated_at
  43. )
  44. VALUES (
  45. #{uuid, jdbcType=VARCHAR},
  46. #{dto.projectUuid, jdbcType=VARCHAR},
  47. #{dto.almSettingUuid, jdbcType=VARCHAR},
  48. #{dto.almRepo, jdbcType=VARCHAR},
  49. #{dto.almSlug, jdbcType=VARCHAR},
  50. #{dto.summaryCommentEnabled, jdbcType=BOOLEAN},
  51. #{now, jdbcType=BIGINT},
  52. #{now, jdbcType=BIGINT}
  53. )
  54. </insert>
  55. <!-- Oracle -->
  56. <insert id="insert" parameterType="Map" useGeneratedKeys="false" databaseId="oracle">
  57. INSERT INTO project_alm_settings
  58. (
  59. uuid,
  60. project_uuid,
  61. alm_setting_uuid,
  62. alm_repo,
  63. alm_slug,
  64. summary_comment_enabled,
  65. created_at,
  66. updated_at
  67. )
  68. VALUES (
  69. #{uuid, jdbcType=VARCHAR},
  70. #{dto.projectUuid, jdbcType=VARCHAR},
  71. #{dto.almSettingUuid, jdbcType=VARCHAR},
  72. #{dto.almRepo, jdbcType=VARCHAR},
  73. #{dto.almSlug, jdbcType=VARCHAR},
  74. #{dto.summaryCommentEnabled, jdbcType=NUMERIC},
  75. #{now, jdbcType=BIGINT},
  76. #{now, jdbcType=BIGINT}
  77. )
  78. </insert>
  79. <update id="update" parameterType="map">
  80. UPDATE project_alm_settings
  81. SET
  82. alm_setting_uuid = #{dto.almSettingUuid, jdbcType=VARCHAR},
  83. alm_repo = #{dto.almRepo, jdbcType=VARCHAR},
  84. alm_slug = #{dto.almSlug, jdbcType=VARCHAR},
  85. summary_comment_enabled = #{dto.summaryCommentEnabled, jdbcType=BOOLEAN},
  86. updated_at = #{now, jdbcType=BIGINT}
  87. WHERE
  88. project_uuid = #{dto.projectUuid, jdbcType=VARCHAR}
  89. </update>
  90. <!-- Oracle -->
  91. <update id="update" parameterType="map" databaseId="oracle">
  92. UPDATE project_alm_settings
  93. SET
  94. alm_setting_uuid = #{dto.almSettingUuid, jdbcType=VARCHAR},
  95. alm_repo = #{dto.almRepo, jdbcType=VARCHAR},
  96. alm_slug = #{dto.almSlug, jdbcType=VARCHAR},
  97. summary_comment_enabled = #{dto.summaryCommentEnabled, jdbcType=NUMERIC},
  98. updated_at = #{now, jdbcType=BIGINT}
  99. WHERE
  100. project_uuid = #{dto.projectUuid, jdbcType=VARCHAR}
  101. </update>
  102. <select id="countByAlmSettingUuid" parameterType="map" resultType="int">
  103. SELECT
  104. count(1)
  105. FROM
  106. project_alm_settings p
  107. WHERE
  108. alm_setting_uuid = #{almSettingUuid, jdbcType=VARCHAR}
  109. </select>
  110. <delete id="deleteByAlmSettingUuid" parameterType="String">
  111. DELETE FROM project_alm_settings WHERE alm_setting_uuid = #{almSettingUuid, jdbcType=VARCHAR}
  112. </delete>
  113. <delete id="deleteByProjectUuid" parameterType="String">
  114. DELETE FROM project_alm_settings WHERE project_uuid = #{projectUuid, jdbcType=VARCHAR}
  115. </delete>
  116. </mapper>