org.sonar.db.duplication.DuplicationMapper.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.duplication.DuplicationMapper"> <select id="selectCandidates" parameterType="map" resultType="DuplicationUnit"> SELECT DISTINCT duplication_block.id as id, duplication_block.analysis_uuid as analysisUuid, duplication_block.component_uuid as componentUuid, duplication_block.hash as hash, duplication_block.index_in_file as indexInFile, duplication_block.start_line as startLine, duplication_block.end_line as endLine, file_component.kee as componentKey FROM duplications_index duplication_block INNER JOIN snapshots snapshot ON duplication_block.analysis_uuid=snapshot.uuid AND snapshot.islast=${_true} INNER JOIN projects file_component ON file_component.uuid=duplication_block.component_uuid AND file_component.language=#{language} AND file_component.enabled=${_true} <where> AND duplication_block.hash in <foreach collection="hashes" open="(" close=")" item="hash" separator=",">#{hash,jdbcType=VARCHAR}</foreach> <if test="analysisUuid != null"> AND duplication_block.analysis_uuid <> #{analysisUuid,jdbcType=VARCHAR} </if> </where> </select> <select id="selectComponent" parameterType="map" resultType="DuplicationUnit"> SELECT DISTINCT dup.id as id, dup.analysis_uuid as analysisUuid, dup.component_uuid as componentUuid, dup.hash as hash, dup.index_in_file as indexInFile, dup.start_line as startLine, dup.end_line as endLine FROM duplications_index dup WHERE dup.component_uuid = #{componentUuid,jdbcType=VARCHAR} AND dup.analysis_uuid = #{analysisUuid,jdbcType=VARCHAR} </select> <insert id="batchInsert" parameterType="DuplicationUnit" useGeneratedKeys="false"> INSERT INTO duplications_index ( analysis_uuid, component_uuid, hash, index_in_file, start_line, end_line ) VALUES ( #{analysisUuid,jdbcType=VARCHAR}, #{componentUuid,jdbcType=VARCHAR}, #{hash,jdbcType=VARCHAR}, #{indexInFile,jdbcType=INTEGER}, #{startLine,jdbcType=INTEGER}, #{endLine,jdbcType=INTEGER} ) </insert> </mapper>