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

org.flowable.app.db.mapping.entity.AppDeployment.xml Maven / Gradle / Ivy

There is a newer version: 7.0.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-mapper.dtd"> 
  
<mapper namespace="org.flowable.app.engine.impl.persistence.entity.AppDeploymentEntityImpl">

  <!-- DEPLOYMENT INSERT -->
  
  <insert id="insertAppDeployment" parameterType="org.flowable.app.engine.impl.persistence.entity.AppDeploymentEntityImpl">
    insert into ${prefix}ACT_APP_DEPLOYMENT(ID_, NAME_, CATEGORY_, KEY_, TENANT_ID_, DEPLOY_TIME_)
    values(
        #{id, jdbcType=VARCHAR},
        #{name, jdbcType=VARCHAR},
        #{category, jdbcType=VARCHAR},
        #{key, jdbcType=VARCHAR},
        #{tenantId, jdbcType=VARCHAR},
        #{deploymentTime, jdbcType=TIMESTAMP}
    )
  </insert>
  
  <insert id="bulkInsertAppDeployment" parameterType="java.util.List">
    insert into ${prefix}ACT_APP_DEPLOYMENT(ID_, NAME_, CATEGORY_, KEY_, TENANT_ID_, DEPLOY_TIME_)
    values
        <foreach collection="list" item="appDeployment" index="index" separator=",">
        (
            #{appDeployment.id, jdbcType=VARCHAR},
            #{appDeployment.name, jdbcType=VARCHAR},
            #{appDeployment.category, jdbcType=VARCHAR},
            #{appDeployment.key, jdbcType=VARCHAR},
            #{appDeployment.tenantId, jdbcType=VARCHAR},
            #{appDeployment.deploymentTime, jdbcType=TIMESTAMP}
         )
        </foreach>
  </insert>
  
  <insert id="bulkInsertAppDeployment" databaseId="oracle" parameterType="java.util.List">
    INSERT ALL 
    <foreach collection="list" item="appDeployment" index="index">
      into ${prefix}ACT_APP_DEPLOYMENT(ID_, NAME_, CATEGORY_, KEY_, TENANT_ID_, DEPLOY_TIME_) values
        (
            #{appDeployment.id, jdbcType=VARCHAR},
            #{appDeployment.name, jdbcType=VARCHAR},
            #{appDeployment.category, jdbcType=VARCHAR},
            #{appDeployment.key, jdbcType=VARCHAR},
            #{appDeployment.tenantId, jdbcType=VARCHAR},
            #{appDeployment.deploymentTime, jdbcType=TIMESTAMP}
        )
    </foreach>
    SELECT * FROM dual
  </insert>

  <!-- DEPLOYMENT UPDATE -->
  
  <update id="updateAppDeployment" parameterType="org.flowable.app.engine.impl.persistence.entity.AppDeploymentEntityImpl">
    update ${prefix}ACT_APP_DEPLOYMENT
    <set>
      <if test="originalPersistentState.category != category">
        CATEGORY_ = #{category, jdbcType=VARCHAR},
      </if>
      <if test="originalPersistentState.key != key">
        KEY_ = #{key, jdbcType=VARCHAR},
      </if>
      <if test="originalPersistentState.tenantId != tenantId">
        TENANT_ID_ = #{tenantId, jdbcType=VARCHAR}
      </if>
    </set>  
    where ID_ = #{id, jdbcType=VARCHAR}
  </update>
  
  <!-- DEPLOYMENT DELETE -->
  
  <delete id="deleteAppDeployment" parameterType="string">
    delete from ${prefix}ACT_APP_DEPLOYMENT where ID_ = #{id}
  </delete>

  <!-- DEPLOYMENT RESULTMAP -->
  
  <resultMap id="appDeploymentResultMap" type="org.flowable.app.engine.impl.persistence.entity.AppDeploymentEntityImpl">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="name" column="NAME_" jdbcType="VARCHAR" />
    <result property="category" column="CATEGORY_" jdbcType="VARCHAR" />
    <result property="key" column="KEY_" jdbcType="VARCHAR" />
    <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR" />
    <result property="deploymentTime" column="DEPLOY_TIME_" jdbcType="TIMESTAMP"/>
  </resultMap>

  <!-- DEPLOYMENT SELECT -->

  <select id="selectAppDeploymentsByName" parameterType="org.flowable.common.engine.impl.db.ListQueryParameterObject" resultMap="appDeploymentResultMap">
    select * from ${prefix}ACT_APP_DEPLOYMENT D where NAME_=#{parameter} order by D.DEPLOY_TIME_ desc
  </select>
  
  <select id="selectAppDeployment" parameterType="string" resultMap="appDeploymentResultMap">
    select * from ${prefix}ACT_APP_DEPLOYMENT where ID_ = #{id, jdbcType=VARCHAR}
  </select>
  
  <select id="selectAppDeploymentsByQueryCriteria" parameterType="org.flowable.app.engine.impl.repository.AppDeploymentQueryImpl" resultMap="appDeploymentResultMap">
    <if test="firstResult != null and firstResult &gt;= 0">${limitBefore}</if>
    select RES.* <if test="nullHandlingColumn != null">, ${nullHandlingColumn}</if> <if test="firstResult != null and firstResult &gt;= 0">${limitBetween}</if>
    <include refid="selectAppDeploymentsByQueryCriteriaSql"/>
    ${orderBy}
    <if test="firstResult != null and firstResult &gt;= 0">${limitAfter}</if>
  </select>

  <select id="selectAppDeploymentCountByQueryCriteria" parameterType="org.flowable.app.engine.impl.repository.AppDeploymentQueryImpl" resultType="long">
    select count(RES.ID_)
    <include refid="selectAppDeploymentsByQueryCriteriaSql"/>
  </select>
  
  <sql id="selectAppDeploymentsByQueryCriteriaSql">  
    from ${prefix}ACT_APP_DEPLOYMENT RES
    <where>
      <if test="deploymentId != null">
        RES.ID_ = #{deploymentId}
      </if>
      <if test="deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0">
        and RES.ID_ IN
        <foreach item="deploymentId" index="index" collection="deploymentIds" 
                 open="(" separator="," close=")">
          #{deploymentId}
        </foreach>
      </if>
      <if test="name != null">
        and RES.NAME_ = #{name}
      </if>
      <if test="nameLike != null">
        and RES.NAME_ like #{nameLike}
      </if>
      <if test="category != null">
        and RES.CATEGORY_ = #{category}
      </if>
      <if test="categoryNotEquals != null">
        and ( RES.CATEGORY_ &lt;&gt; #{categoryNotEquals} OR RES.CATEGORY_ is null )  
      </if>
      <if test="key != null">
        and RES.KEY_ = #{key}
      </if>
      <if test="withoutTenantId">
        and (RES.TENANT_ID_ = '' or RES.TENANT_ID_ is null)
      </if>
      <if test="tenantId != null">
        and RES.TENANT_ID_ = #{tenantId}
      </if>
      <if test="tenantIdLike != null">
        and RES.TENANT_ID_ like #{tenantIdLike}
      </if>
      <if test="latest">
        and RES.DEPLOY_TIME_ = (select max(DEPLOY_TIME_) from ${prefix}ACT_APP_DEPLOYMENT where KEY_ = RES.KEY_ 
             <if test="tenantId != null">
               and TENANT_ID_ = #{tenantId}
             </if>
             <if test="tenantIdLike != null">
               and TENANT_ID_ like #{tenantIdLike}${wildcardEscapeClause}
             </if>
        )
      </if>
    </where>
  </sql>
  
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy