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

org.flowable.db.mapping.entity.Model.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.ModelEntityImpl">

  <!-- MODEL INSERT -->
  
  <insert id="insertModel" parameterType="org.flowable.engine.impl.persistence.entity.ModelEntityImpl">
    insert into ${prefix}ACT_RE_MODEL(ID_, REV_, NAME_, KEY_, CATEGORY_, CREATE_TIME_, LAST_UPDATE_TIME_, VERSION_, META_INFO_, DEPLOYMENT_ID_, EDITOR_SOURCE_VALUE_ID_, EDITOR_SOURCE_EXTRA_VALUE_ID_, TENANT_ID_)
    values(#{id, jdbcType=VARCHAR}, 
           1, #{name, jdbcType=VARCHAR},
           #{key, jdbcType=VARCHAR}, 
           #{category, jdbcType=VARCHAR}, 
           #{createTime, jdbcType=TIMESTAMP},
           #{lastUpdateTime, jdbcType=TIMESTAMP},
           #{version, jdbcType=INTEGER}, 
           #{metaInfo, jdbcType=VARCHAR}, 
           #{deploymentId, jdbcType=VARCHAR},
           #{editorSourceValueId, jdbcType=VARCHAR}, 
           #{editorSourceExtraValueId, jdbcType=VARCHAR},
           #{tenantId, jdbcType=VARCHAR})
  </insert>

  <insert id="bulkInsertModel" parameterType="java.util.List">
    INSERT INTO ${prefix}ACT_RE_MODEL(ID_, REV_, NAME_, KEY_, CATEGORY_, CREATE_TIME_, LAST_UPDATE_TIME_, VERSION_, META_INFO_, DEPLOYMENT_ID_, EDITOR_SOURCE_VALUE_ID_, EDITOR_SOURCE_EXTRA_VALUE_ID_, TENANT_ID_)
    VALUES 
      <foreach collection="list" item="model" index="index" separator=","> 
        (#{model.id, jdbcType=VARCHAR}, 
         1, #{model.name, jdbcType=VARCHAR},
         #{model.key, jdbcType=VARCHAR}, 
         #{model.category, jdbcType=VARCHAR}, 
         #{model.createTime, jdbcType=TIMESTAMP},
         #{model.lastUpdateTime, jdbcType=TIMESTAMP},
         #{model.version, jdbcType=INTEGER}, 
         #{model.metaInfo, jdbcType=VARCHAR}, 
         #{model.deploymentId, jdbcType=VARCHAR},
         #{model.editorSourceValueId, jdbcType=VARCHAR}, 
         #{model.editorSourceExtraValueId, jdbcType=VARCHAR},
         #{model.tenantId, jdbcType=VARCHAR})
     </foreach>
  </insert>

  <insert id="bulkInsertModel" databaseId="oracle" parameterType="java.util.List">
    INSERT ALL 
      <foreach collection="list" item="model" index="index"> 
        INTO ${prefix}ACT_RE_MODEL(ID_, REV_, NAME_, KEY_, CATEGORY_, CREATE_TIME_, LAST_UPDATE_TIME_,
        VERSION_, META_INFO_, DEPLOYMENT_ID_, EDITOR_SOURCE_VALUE_ID_, EDITOR_SOURCE_EXTRA_VALUE_ID_, TENANT_ID_) VALUES 
          (#{model.id, jdbcType=VARCHAR}, 
           1, #{model.name, jdbcType=VARCHAR},
           #{model.key, jdbcType=VARCHAR}, 
           #{model.category, jdbcType=VARCHAR}, 
           #{model.createTime, jdbcType=TIMESTAMP},
           #{model.lastUpdateTime, jdbcType=TIMESTAMP},
           #{model.version, jdbcType=INTEGER}, 
           #{model.metaInfo, jdbcType=VARCHAR}, 
           #{model.deploymentId, jdbcType=VARCHAR},
           #{model.editorSourceValueId, jdbcType=VARCHAR}, 
           #{model.editorSourceExtraValueId, jdbcType=VARCHAR},
           #{model.tenantId, jdbcType=VARCHAR})
     </foreach>
    SELECT * FROM dual
  </insert>

  <!-- MODEL UPDATE -->
  <update id="updateModel" parameterType="org.flowable.engine.impl.persistence.entity.ModelEntityImpl">
    update ${prefix}ACT_RE_MODEL
      <set>
          REV_ = #{revisionNext, jdbcType=INTEGER},
          <if test="originalPersistentState.name != name">
              NAME_ = #{name, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.key != key">
              KEY_ = #{key, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.category != category">
              CATEGORY_ = #{category, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.lastUpdateTime != lastUpdateTime">
              LAST_UPDATE_TIME_ = #{lastUpdateTime, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.version != version">
              VERSION_ = #{version, jdbcType=INTEGER},
          </if>
          <if test="originalPersistentState.metaInfo != metaInfo">
              META_INFO_ = #{metaInfo, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.deploymentId != deploymentId">
              DEPLOYMENT_ID_ = #{deploymentId, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.editorSourceValueId != editorSourceValueId">
              EDITOR_SOURCE_VALUE_ID_ = #{editorSourceValueId, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.editorSourceExtraValueId != editorSourceExtraValueId">
              EDITOR_SOURCE_EXTRA_VALUE_ID_ = #{editorSourceExtraValueId, jdbcType=VARCHAR},
          </if>
          <if test="originalPersistentState.tenantId != tenantId">
              TENANT_ID_ = #{tenantId, jdbcType=VARCHAR}
          </if>
      </set>
    where ID_ = #{id, jdbcType=VARCHAR} and REV_ = #{revision, jdbcType=INTEGER}
  </update>

  
  <!-- MODEL DELETE -->
  
  <delete id="deleteModel" parameterType="org.flowable.engine.impl.persistence.entity.ModelEntityImpl">
    delete from ${prefix}ACT_RE_MODEL where ID_ = #{id} and REV_ = #{revision}
  </delete>

  <!-- MODEL RESULTMAP -->
  
  <resultMap id="modelResultMap" type="org.flowable.engine.impl.persistence.entity.ModelEntityImpl">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="revision" column="REV_" jdbcType="INTEGER"/>
    <result property="name" column="NAME_" jdbcType="VARCHAR" />
    <result property="key" column="KEY_" jdbcType="VARCHAR" />
    <result property="category" column="CATEGORY_" jdbcType="VARCHAR" />
    <result property="createTime" column="CREATE_TIME_" jdbcType="TIMESTAMP"/>
    <result property="lastUpdateTime" column="LAST_UPDATE_TIME_" jdbcType="TIMESTAMP"/>
    <result property="version" column="VERSION_" jdbcType="INTEGER" />
    <result property="metaInfo" column="META_INFO_" jdbcType="VARCHAR" />
    <result property="deploymentId" column="DEPLOYMENT_ID_" jdbcType="VARCHAR" />
    <result property="editorSourceValueId" column="EDITOR_SOURCE_VALUE_ID_" jdbcType="VARCHAR" />
    <result property="editorSourceExtraValueId" column="EDITOR_SOURCE_EXTRA_VALUE_ID_" jdbcType="VARCHAR" />
    <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR" />
  </resultMap>

  <!-- MODEL SELECT -->

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

  <select id="selectModelCountByQueryCriteria" parameterType="org.flowable.engine.impl.ModelQueryImpl" resultType="long">
    select count(RES.ID_)
    <include refid="selectModelsByQueryCriteriaSql"/>
  </select>
  
  <sql id="selectModelsByQueryCriteriaSql">  
    from ${prefix}ACT_RE_MODEL RES
    <where>
      <if test="id != null">
        RES.ID_ = #{id}
      </if>
      <if test="name != null">
        and RES.NAME_ = #{name}
      </if>
      <if test="nameLike != null">
        and RES.NAME_ like #{nameLike}${wildcardEscapeClause}
      </if>
      <if test="key != null">
        and RES.KEY_ = #{key}
      </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="version != null">
        and RES.VERSION_ = #{version}
      </if>
      <if test="deploymentId != null">
        and RES.DEPLOYMENT_ID_ = #{deploymentId}
      </if>
      <if test="notDeployed">
        and RES.DEPLOYMENT_ID_ is null
      </if>
      <if test="deployed">
        and RES.DEPLOYMENT_ID_ is not null
      </if>
      <if test="latest">
        and RES.VERSION_ = (select max(VERSION_) from ${prefix}ACT_RE_MODEL where KEY_ = RES.KEY_)
      </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>
    </where>
  </sql>
  
  <select id="selectModel" parameterType="string" resultMap="modelResultMap">
    select * from ${prefix}ACT_RE_MODEL where ID_ = #{id, jdbcType=VARCHAR}
  </select>
  
  <select id="selectModelByNativeQuery" parameterType="java.util.Map" resultMap="modelResultMap">
    <include refid="org.flowable.engine.db.common.selectByNativeQuery"/>
  </select>

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

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy