org.sonar.db.component.BranchMapper.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.component.BranchMapper"> <sql id="columns"> pb.uuid as uuid, pb.project_uuid as projectUuid, pb.kee as kee, pb.key_type as keyType, pb.branch_type as branchType, pb.merge_branch_uuid as mergeBranchUuid, pb.pull_request_binary as pullRequestBinary </sql> <insert id="insert" parameterType="map" useGeneratedKeys="false"> insert into project_branches ( uuid, project_uuid, kee, key_type, branch_type, merge_branch_uuid, pull_request_binary, created_at, updated_at ) values ( #{dto.uuid, jdbcType=VARCHAR}, #{dto.projectUuid, jdbcType=VARCHAR}, #{dto.kee, jdbcType=VARCHAR}, #{dto.keyType, jdbcType=VARCHAR}, #{dto.branchType, jdbcType=VARCHAR}, #{dto.mergeBranchUuid, jdbcType=VARCHAR}, #{dto.pullRequestBinary, jdbcType=BINARY}, #{now, jdbcType=BIGINT}, #{now, jdbcType=BIGINT} ) </insert> <update id="updateMainBranchName" parameterType="map"> update project_branches set kee = #{newBranchName, jdbcType=VARCHAR}, updated_at = #{now, jdbcType=BIGINT} where uuid = #{projectUuid, jdbcType=VARCHAR} </update> <update id="update" parameterType="map" useGeneratedKeys="false"> update project_branches set merge_branch_uuid = #{dto.mergeBranchUuid, jdbcType=VARCHAR}, pull_request_binary = #{dto.pullRequestBinary, jdbcType=BINARY}, updated_at = #{now, jdbcType=BIGINT} where uuid = #{dto.uuid, jdbcType=VARCHAR} </update> <select id="selectByKey" resultType="org.sonar.db.component.BranchDto"> select <include refid="columns" /> from project_branches pb where pb.project_uuid = #{projectUuid, jdbcType=VARCHAR} and pb.kee = #{key, jdbcType=VARCHAR} and pb.key_type = #{keyType, jdbcType=VARCHAR} </select> <select id="selectByProjectUuid" parameterType="string" resultType="org.sonar.db.component.BranchDto"> select <include refid="columns" /> from project_branches pb where pb.project_uuid = #{projectUuid, jdbcType=VARCHAR} </select> <select id="selectByUuids" resultType="org.sonar.db.component.BranchDto"> select <include refid="columns" /> from project_branches pb where pb.uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=","> #{uuid,jdbcType=VARCHAR} </foreach> </select> <select id="selectByUuid" resultType="org.sonar.db.component.BranchDto"> select <include refid="columns" /> from project_branches pb where pb.uuid = #{uuid, jdbcType=VARCHAR} </select> <select id="countNonMainBranches" resultType="long"> select count(pb.uuid) from project_branches pb where pb.uuid <> pb.project_uuid </select> </mapper>