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

org.flowable.db.mapping.entity.Deployment.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.engine.impl.persistence.entity.DeploymentEntityImpl">

  <!-- DEPLOYMENT INSERT -->
  
  <insert id="insertDeployment" parameterType="org.flowable.engine.impl.persistence.entity.DeploymentEntityImpl">
    insert into ${prefix}ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, KEY_, TENANT_ID_, DEPLOY_TIME_, DERIVED_FROM_, DERIVED_FROM_ROOT_, PARENT_DEPLOYMENT_ID_, ENGINE_VERSION_)
    values(#{id, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{category, jdbcType=VARCHAR}, #{key, jdbcType=VARCHAR}, #{tenantId, jdbcType=VARCHAR}, #{deploymentTime, jdbcType=TIMESTAMP}, #{derivedFrom, jdbcType=VARCHAR}, #{derivedFromRoot, jdbcType=VARCHAR}, #{parentDeploymentId, jdbcType=VARCHAR}, #{engineVersion, jdbcType=VARCHAR})
  </insert>

  <insert id="bulkInsertDeployment" parameterType="java.util.List">
    insert into ${prefix}ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, KEY_, TENANT_ID_, DEPLOY_TIME_, DERIVED_FROM_, DERIVED_FROM_ROOT_, PARENT_DEPLOYMENT_ID_, ENGINE_VERSION_)
    values
      <foreach collection="list" item="deployment" index="index" separator=",">
        (#{deployment.id, jdbcType=VARCHAR},
         #{deployment.name, jdbcType=VARCHAR},
         #{deployment.category, jdbcType=VARCHAR},
         #{deployment.key, jdbcType=VARCHAR},
         #{deployment.tenantId, jdbcType=VARCHAR},
         #{deployment.deploymentTime, jdbcType=TIMESTAMP},
         #{deployment.derivedFrom, jdbcType=VARCHAR},
         #{deployment.derivedFromRoot, jdbcType=VARCHAR},
         #{deployment.parentDeploymentId, jdbcType=VARCHAR},
         #{deployment.engineVersion, jdbcType=VARCHAR})
      </foreach>
  </insert>

  <insert id="bulkInsertDeployment" databaseId="oracle" parameterType="java.util.List">
    INSERT ALL 
      <foreach collection="list" item="deployment" index="index">
        into ${prefix}ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, KEY_, TENANT_ID_, DEPLOY_TIME_, DERIVED_FROM_, DERIVED_FROM_ROOT_, PARENT_DEPLOYMENT_ID_, ENGINE_VERSION_) VALUES 
          (#{deployment.id, jdbcType=VARCHAR},
           #{deployment.name, jdbcType=VARCHAR},
           #{deployment.category, jdbcType=VARCHAR},
           #{deployment.key, jdbcType=VARCHAR},
           #{deployment.tenantId, jdbcType=VARCHAR},
           #{deployment.deploymentTime, jdbcType=TIMESTAMP},
           #{deployment.derivedFrom, jdbcType=VARCHAR},
           #{deployment.derivedFromRoot, jdbcType=VARCHAR},
           #{deployment.parentDeploymentId, jdbcType=VARCHAR},
           #{deployment.engineVersion, jdbcType=VARCHAR})
      </foreach>
    SELECT * FROM dual
  </insert>

  <!-- DEPLOYMENT UPDATE -->
  
  <update id="updateDeployment" parameterType="org.flowable.engine.impl.persistence.entity.DeploymentEntityImpl">
    update ${prefix}ACT_RE_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>
          <if test="originalPersistentState.parentDeploymentId != parentDeploymentId">
              PARENT_DEPLOYMENT_ID_ = #{parentDeploymentId, jdbcType=VARCHAR}
          </if>
      </set>
    where ID_ = #{id, jdbcType=VARCHAR}
  </update>
  
  <!-- DEPLOYMENT DELETE -->
  
  <delete id="deleteDeployment" parameterType="string">
    delete from ${prefix}ACT_RE_DEPLOYMENT where ID_ = #{id}
  </delete>

  <!-- DEPLOYMENT RESULTMAP -->
  
  <resultMap id="deploymentResultMap" type="org.flowable.engine.impl.persistence.entity.DeploymentEntityImpl">
    <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"/>
    <result property="derivedFrom" column="DERIVED_FROM_" jdbcType="VARCHAR" />
    <result property="derivedFromRoot" column="DERIVED_FROM_ROOT_" jdbcType="VARCHAR" />
    <result property="parentDeploymentId" column="PARENT_DEPLOYMENT_ID_" jdbcType="VARCHAR" />
    <result property="engineVersion" column="ENGINE_VERSION_" jdbcType="VARCHAR" />
  </resultMap>

  <!-- DEPLOYMENT SELECT -->

  <select id="selectDeploymentsByQueryCriteria" parameterType="org.flowable.engine.impl.DeploymentQueryImpl" resultMap="deploymentResultMap">
  	<if test="firstResult != null and firstResult &gt;= 0">${limitBefore}</if>
    select RES.* <if test="firstResult != null and firstResult &gt;= 0">${limitBetween}</if>
    <include refid="selectDeploymentsByQueryCriteriaSql"/>
    ${orderBy}
    <if test="firstResult != null and firstResult &gt;= 0">${limitAfter}</if>
  </select>

  <select id="selectDeploymentCountByQueryCriteria" parameterType="org.flowable.engine.impl.DeploymentQueryImpl" resultType="long">
    select count(RES.ID_)
    <include refid="selectDeploymentsByQueryCriteriaSql"/>
  </select>
  
  <sql id="selectDeploymentsByQueryCriteriaSql">  
    from ${prefix}ACT_RE_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}${wildcardEscapeClause}
      </if>
      <if test="category != null">
        and RES.CATEGORY_ = #{category}
      </if>
      <if test="categoryLike != null">
        and RES.CATEGORY_ like #{categoryLike}${wildcardEscapeClause}
      </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="keyLike != null">
        and RES.KEY_ like #{keyLike}${wildcardEscapeClause}
      </if>
      <if test="tenantId != null">
        and RES.TENANT_ID_ = #{tenantId}
      </if>
      <if test="tenantIdLike != null">
        and RES.TENANT_ID_ like #{tenantIdLike}${wildcardEscapeClause}
      </if>
      <if test="withoutTenantId">
        and (RES.TENANT_ID_ = '' or RES.TENANT_ID_ is null)
      </if>
      <if test="derivedFrom != null">
        and (RES.DERIVED_FROM_ = #{derivedFrom} or RES.DERIVED_FROM_ROOT_ = #{derivedFrom})
      </if>
      <if test="parentDeploymentId != null">
        and (RES.PARENT_DEPLOYMENT_ID_ = #{parentDeploymentId})
      </if>
      <if test="parentDeploymentIdLike != null">
        and RES.PARENT_DEPLOYMENT_ID_ like #{parentDeploymentIdLike}${wildcardEscapeClause}
      </if>
      <if test="parentDeploymentIds != null &amp;&amp; parentDeploymentIds.size() &gt; 0">
        and RES.PARENT_DEPLOYMENT_ID_ IN
        <foreach item="parentDeploymentId" index="index" collection="parentDeploymentIds" 
                 open="(" separator="," close=")">
          #{parentDeploymentId}
        </foreach>
      </if>
      <if test="engineVersion != null">
        and RES.ENGINE_VERSION_ = #{engineVersion}
      </if>
      <if test="processDefinitionKey != null || processDefinitionKeyLike != null">
        and exists(select 1 from ${prefix}ACT_RE_PROCDEF PROCDEF where RES.ID_ = PROCDEF.DEPLOYMENT_ID_ 
            <if test="processDefinitionKey != null">
              and PROCDEF.KEY_ = #{processDefinitionKey}
            </if>
            <if test="processDefinitionKeyLike != null">
              and PROCDEF.KEY_ like #{processDefinitionKeyLike}${wildcardEscapeClause}
            </if>
        )
      </if>
      <if test="latest">
        and RES.DEPLOY_TIME_ = (select max(DEPLOY_TIME_) from ${prefix}ACT_RE_DEPLOYMENT where KEY_ = RES.KEY_ 
             <if test="derivedFrom != null">
                and (DERIVED_FROM_ = #{derivedFrom} or DERIVED_FROM_ROOT_ = #{derivedFrom})
             </if>
             <if test="derivedFrom == null">
                and DERIVED_FROM_ is null
             </if>
             <if test="tenantId != null">
	           and TENANT_ID_ = #{tenantId}
	         </if>
	         <if test="tenantIdLike != null">
	           and TENANT_ID_ like #{tenantIdLike}${wildcardEscapeClause}
	         </if>
	         <if test="withoutTenantId">
	           and (TENANT_ID_ = '' or TENANT_ID_ is null)
	         </if>
	         <if test="tenantId == null and tenantIdLike == null and !withoutTenantId">
	           and ( (TENANT_ID_ IS NOT NULL and TENANT_ID_ = RES.TENANT_ID_) or (TENANT_ID_ IS NULL and RES.TENANT_ID_ IS NULL) )
	         </if>
        )
      </if>
    </where>
  </sql>
    
  <select id="selectDeployment" parameterType="string" resultMap="deploymentResultMap">
    select * from ${prefix}ACT_RE_DEPLOYMENT where ID_ = #{id, jdbcType=VARCHAR}
  </select>

  <select id="selectDeploymentByNativeQuery" parameterType="java.util.Map" resultMap="deploymentResultMap">
    <include refid="org.flowable.engine.db.common.selectByNativeQuery"/>
  </select>

  <select id="selectDeploymentCountByNativeQuery" parameterType="java.util.Map" resultType="long">
    ${sql}
  </select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy