org.sonar.db.rule.RuleRepositoryMapper.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-db-dao Show documentation
Show all versions of sonar-db-dao Show documentation
Open source platform for continuous inspection of code quality
The newest version!
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.rule.RuleRepositoryMapper"> <sql id="sqlColumns"> kee, language, name </sql> <select id="selectAll" resultType="org.sonar.db.rule.RuleRepositoryDto"> select <include refid="sqlColumns"/> from rule_repositories order by kee </select> <select id="selectByLanguage" parameterType="String" resultType="org.sonar.db.rule.RuleRepositoryDto"> select <include refid="sqlColumns"/> from rule_repositories where language = #{language} order by kee </select> <insert id="insert" parameterType="map" useGeneratedKeys="false"> insert into rule_repositories (kee, language, name, created_at) values ( #{repository.kee, jdbcType=VARCHAR}, #{repository.language, jdbcType=VARCHAR}, #{repository.name, jdbcType=VARCHAR}, #{now, jdbcType=BIGINT} ) </insert> <update id="update" parameterType="map"> update rule_repositories set name = #{repository.name, jdbcType=VARCHAR}, language = #{repository.language, jdbcType=VARCHAR} where kee = #{repository.kee, jdbcType=VARCHAR} </update> <delete id="deleteIfKeyNotIn" parameterType="String"> delete from rule_repositories <if test="!keys.isEmpty()"> where kee not in <foreach collection="keys" open="(" close=")" item="key" separator=",">#{key,jdbcType=VARCHAR}</foreach> </if> </delete> </mapper>