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.

PermissionTemplateCharacteristicMapper.xml 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.permission.template.PermissionTemplateCharacteristicMapper">
  4. <sql id="columns">
  5. ptc.id,
  6. ptc.template_id as templateId,
  7. ptc.permission_key as permission,
  8. ptc.with_project_creator as withProjectCreator,
  9. ptc.created_at as createdAt,
  10. ptc.updated_at as updatedAt
  11. </sql>
  12. <select id="selectById" parameterType="long" resultType="PermissionTemplateCharacteristic">
  13. select
  14. <include refid="columns" />
  15. from perm_tpl_characteristics ptc
  16. where ptc.id=#{id,jdbcType=BIGINT}
  17. </select>
  18. <select id="selectByTemplateIds" parameterType="long" resultType="PermissionTemplateCharacteristic">
  19. select
  20. <include refid="columns" />
  21. from perm_tpl_characteristics ptc
  22. where
  23. ptc.template_id in
  24. <foreach collection="templateIds" open="(" close=")" item="templateId" separator=",">
  25. #{templateId}
  26. </foreach>
  27. order by ptc.created_at
  28. </select>
  29. <select id="selectByPermissionAndTemplateId" parameterType="map" resultType="PermissionTemplateCharacteristic">
  30. select
  31. <include refid="columns" />
  32. from perm_tpl_characteristics ptc
  33. where ptc.template_id=#{templateId}
  34. and ptc.permission_key=#{permission}
  35. order by ptc.created_at
  36. </select>
  37. <insert id="insert" parameterType="PermissionTemplateCharacteristic" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
  38. insert into perm_tpl_characteristics(template_id, permission_key, with_project_creator, created_at, updated_at)
  39. values(#{templateId, jdbcType=BIGINT}, #{permission, jdbcType=VARCHAR}, #{withProjectCreator, jdbcType=BOOLEAN}, #{createdAt, jdbcType=BIGINT}, #{updatedAt, jdbcType=BIGINT})
  40. </insert>
  41. <update id="update" parameterType="PermissionTemplateCharacteristic" useGeneratedKeys="false">
  42. update perm_tpl_characteristics set
  43. with_project_creator=#{withProjectCreator, jdbcType=BOOLEAN},
  44. updated_at=#{updatedAt, jdbcType=BIGINT}
  45. where id=#{id}
  46. </update>
  47. <delete id="deleteByTemplateId" parameterType="long">
  48. DELETE FROM perm_tpl_characteristics
  49. WHERE template_id = #{permissionTemplateId}
  50. </delete>
  51. <delete id="deleteByTemplateIds" parameterType="long">
  52. delete from
  53. perm_tpl_characteristics
  54. where
  55. template_id in
  56. <foreach collection="templateIds" open="(" close=")" item="templateId" separator=",">
  57. #{templateId}
  58. </foreach>
  59. </delete>
  60. </mapper>