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">
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
13 <select id="selectByTemplateIds" parameterType="long" resultType="TemplatePermission">
15 <include refid="columns" />
16 from perm_tpl_characteristics ptc
19 <foreach collection="templateIds" open="(" close=")" item="templateId" separator=",">
25 <select id="selectByPermissionAndTemplateId" parameterType="map" resultType="TemplatePermission">
27 <include refid="columns" />
28 from perm_tpl_characteristics ptc
29 where ptc.template_id=#{templateId}
30 and ptc.permission_key=#{permission}
34 <select id="selectById" parameterType="long" resultType="TemplatePermission">
36 <include refid="columns" />
37 from perm_tpl_characteristics ptc
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})
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}