org.sonar.db.ce.CeQueueMapper.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.ce.CeQueueMapper"> <sql id="columns"> cq.uuid, cq.task_type as taskType, cq.component_uuid as componentUuid, cq.status as status, cq.submitter_login as submitterLogin, cq.started_at as startedAt, cq.created_at as createdAt, cq.updated_at as updatedAt </sql> <sql id="orderByDateAndId"> order by cq.created_at asc, cq.id asc </sql> <select id="selectByUuid" parameterType="String" resultType="org.sonar.db.ce.CeQueueDto"> select <include refid="columns"/> from ce_queue cq where cq.uuid=#{uuid} </select> <select id="countByStatus" parameterType="org.sonar.db.ce.CeQueueDto$Status" resultType="int"> select count(id) from ce_queue where status=#{status} </select> <select id="countAll" resultType="int"> select count(id) from ce_queue </select> <select id="selectByComponentUuid" parameterType="String" resultType="org.sonar.db.ce.CeQueueDto"> select <include refid="columns"/> from ce_queue cq where cq.component_uuid=#{componentUuid} <include refid="orderByDateAndId"/> </select> <select id="selectAllInAscOrder" resultType="org.sonar.db.ce.CeQueueDto"> select <include refid="columns"/> from ce_queue cq <include refid="orderByDateAndId"/> </select> <select id="selectEligibleForPeek" resultType="String"> select cq.uuid from ce_queue cq where cq.status='PENDING' and not exists( select 1 from ce_queue cq2 where cq.component_uuid=cq2.component_uuid and cq2.status <> 'PENDING' ) <include refid="orderByDateAndId"/> </select> <insert id="insert" parameterType="org.sonar.db.ce.CeQueueDto" useGeneratedKeys="false"> insert into ce_queue (uuid, task_type, component_uuid, status, submitter_login, started_at, created_at, updated_at) values ( #{uuid,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{componentUuid,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{submitterLogin,jdbcType=VARCHAR}, #{startedAt,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT} ) </insert> <update id="resetAllToPendingStatus" parameterType="map"> update ce_queue set status='PENDING', started_at=NULL, updated_at=#{updatedAt,jdbcType=BIGINT} where status <> 'PENDING' </update> <update id="updateIfStatus" parameterType="map"> update ce_queue set status=#{newStatus,jdbcType=VARCHAR}, started_at=#{startedAt,jdbcType=BIGINT}, updated_at=#{updatedAt,jdbcType=BIGINT} where uuid=#{uuid} and status=#{oldStatus} </update> <delete id="deleteByUuid"> delete from ce_queue where uuid=#{uuid} </delete> </mapper>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy