]> source.dussan.org Git - sonarqube.git/blob
ae90a6cd456c80d6fd8e1eb1a981c52feeb580da
[sonarqube.git] /
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/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
13   <select id="selectByTemplateIds" parameterType="long" resultType="TemplatePermission">
14     select
15     <include refid="columns" />
16     from perm_tpl_characteristics ptc
17     where
18     ptc.template_id in
19     <foreach collection="templateIds" open="(" close=")" item="templateId" separator=",">
20       #{templateId}
21     </foreach>
22     order by id
23   </select>
24
25   <select id="selectByPermissionAndTemplateId" parameterType="map" resultType="TemplatePermission">
26     select
27     <include refid="columns" />
28     from perm_tpl_characteristics ptc
29     where ptc.template_id=#{templateId}
30     and ptc.permission_key=#{permission}
31     order by id
32   </select>
33
34   <select id="selectById" parameterType="long" resultType="TemplatePermission">
35     select
36     <include refid="columns" />
37     from perm_tpl_characteristics ptc
38     where ptc.id=#{id}
39   </select>
40
41   <insert id="insert" parameterType="TemplatePermission" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
42     insert into perm_tpl_characteristics(template_id, permission_key, with_project_creator, created_at, updated_at)
43     values(#{templateId, jdbcType=BIGINT}, #{permission, jdbcType=VARCHAR}, #{withProjectCreator, jdbcType=BOOLEAN}, #{createdAt, jdbcType=BIGINT}, #{updatedAt, jdbcType=BIGINT})
44   </insert>
45
46   <update id="update" parameterType="TemplatePermission" useGeneratedKeys="false">
47     update perm_tpl_characteristics set
48     with_project_creator=#{withProjectCreator, jdbcType=BOOLEAN},
49     updated_at=#{updatedAt, jdbcType=BIGINT}
50     where id=#{id}
51   </update>
52 </mapper>