All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.db.rule.RuleRepositoryMapper.xml Maven / Gradle / Ivy

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>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy