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

org.sonar.db.issue.ActionPlanMapper.xml Maven / Gradle / Ivy

There is a newer version: 6.3.1
Show newest version
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mappei.dtd">

<mapper namespace="org.sonar.db.issue.ActionPlanMapper">

  <sql id="actionPlanColumns">
    ap.id,
    ap.kee as kee,
    ap.name as name,
    ap.description as description,
    ap.user_login as userLogin,
    ap.project_id as projectId,
    ap.status as status,
    ap.deadline as deadLine,
    ap.created_at as createdAt,
    ap.updated_at as updatedAt,
    p.kee as projectKey,
    p.uuid as projectUuid
  </sql>

  <insert id="insert" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
    INSERT INTO action_plans (kee, name, description, user_login, project_id, status, deadline, created_at, updated_at)
    VALUES (#{kee}, #{name}, #{description}, #{userLogin}, #{projectId}, #{status}, #{deadLine}, #{createdAt},
    #{updatedAt})
  </insert>

  <update id="update" parameterType="ActionPlanIssue">
    update action_plans set
    name=#{name},
    description=#{description},
    user_login=#{userLogin},
    project_id=#{projectId},
    status=#{status},
    deadline=#{deadLine},
    updated_at=current_timestamp
    where kee = #{kee}
  </update>

  <delete id="delete" parameterType="String">
    delete from action_plans where kee=#{key}
  </delete>

  <select id="findByKey" parameterType="long" resultType="ActionPlanIssue">
    select
    <include refid="actionPlanColumns"/>
    from action_plans ap, projects p
    <where>
      and ap.kee=#{key}
      and ap.project_id=p.id
    </where>
  </select>

  <select id="findByKeys" parameterType="long" resultType="ActionPlanIssue">
    select
    <include refid="actionPlanColumns"/>
    from action_plans ap, projects p
    <where>
      and ap.kee in
      <foreach collection="keys" open="(" close=")" item="key" separator=",">
        #{key}
      </foreach>
      and ap.project_id=p.id
    </where>
  </select>

  <select id="findOpenByProjectId" parameterType="long" resultType="ActionPlanIssue">
    select
    <include refid="actionPlanColumns"/>
    from action_plans ap, projects p
    <where>
      and ap.project_id=#{projectId}
      and ap.status='OPEN'
      and ap.project_id=p.id
    </where>
  </select>

  <select id="findByNameAndProjectId" parameterType="long" resultType="ActionPlanIssue">
    select
    <include refid="actionPlanColumns"/>
    from action_plans ap, projects p
    <where>
      and ap.project_id=#{projectId}
      and ap.name=#{name}
      and ap.project_id=p.id
    </where>
  </select>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy