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

META-INF.modeler-mybatis-mappings.Model.xml Maven / Gradle / Ivy

There is a newer version: 6.8.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.ui.modeler.domain.Model">

    <resultMap id="modelResultMap" type="org.flowable.ui.modeler.domain.Model">
        <id property="id" column="id" jdbcType="VARCHAR" />
        <result property="name" column="name" jdbcType="VARCHAR" />
        <result property="key" column="model_key" jdbcType="VARCHAR" />
        <result property="description" column="description" jdbcType="VARCHAR" />
        <result property="comment" column="model_comment" jdbcType="VARCHAR" />
        <result property="created" column="created" jdbcType="TIMESTAMP" />
        <result property="createdBy" column="created_by" jdbcType="VARCHAR" />
        <result property="lastUpdated" column="last_updated" jdbcType="TIMESTAMP" />
        <result property="lastUpdatedBy" column="last_updated_by" jdbcType="VARCHAR" />
        <result property="version" column="version" jdbcType="INTEGER" />
        <result property="modelEditorJson" column="model_editor_json" jdbcType="VARCHAR" />
        <result property="modelType" column="model_type" jdbcType="INTEGER" />
        <result property="thumbnail" column="thumbnail" jdbcType="${blobType}" />
        <result property="tenantId" column="tenant_id" jdbcType="VARCHAR" />
    </resultMap>

    <insert id="insertModel" parameterType="org.flowable.ui.modeler.domain.Model">
        insert into ${prefix}ACT_DE_MODEL (
            id,
            name,
            model_key,
            description,
            model_comment,
            created,
            created_by,
            last_updated,
            last_updated_by,
            version,
            model_editor_json,
            model_type,
            thumbnail,
            tenant_id) 
         values (
            #{id, jdbcType=VARCHAR},
            #{name, jdbcType=VARCHAR},
            #{key, jdbcType=VARCHAR},
            #{description, jdbcType=VARCHAR},
            #{comment, jdbcType=VARCHAR},
            #{created, jdbcType=TIMESTAMP},
            #{createdBy, jdbcType=VARCHAR},
            #{lastUpdated, jdbcType=TIMESTAMP},
            #{lastUpdatedBy, jdbcType=VARCHAR},
            #{version, jdbcType=INTEGER},
            #{modelEditorJson, jdbcType=VARCHAR},
            #{modelType, jdbcType=INTEGER},
            #{thumbnail, jdbcType=${blobType}},
            #{tenantId, jdbcType=VARCHAR}
          )
    </insert>
    
    <update id="updateModel" parameterType="org.flowable.ui.modeler.domain.Model">
        update ${prefix}ACT_DE_MODEL
        <set>
            name = #{name, jdbcType=VARCHAR},
            model_key = #{key, jdbcType=VARCHAR},
            description = #{description, jdbcType=VARCHAR},
            model_comment = #{comment, jdbcType=VARCHAR},
            created = #{created, jdbcType=TIMESTAMP},
            created_by = #{createdBy, jdbcType=VARCHAR},
            last_updated = #{lastUpdated, jdbcType=TIMESTAMP},
            last_updated_by = #{lastUpdatedBy, jdbcType=VARCHAR},
            version = #{version, jdbcType=INTEGER},
            model_editor_json = #{modelEditorJson, jdbcType=VARCHAR},
            model_type = #{modelType, jdbcType=INTEGER},
            thumbnail = #{thumbnail, jdbcType=${blobType}},
            tenant_id = #{tenantId, jdbcType=VARCHAR}
        </set>
        where id = #{id, jdbcType=VARCHAR}
    </update>
    
    <select id="selectModel" parameterType="string" resultMap="modelResultMap">
        select * from ${prefix}ACT_DE_MODEL where id = #{id, jdbcType=VARCHAR}
    </select>
    
    <select id="selectModelByParentModelId" parameterType="string" resultMap="modelResultMap">
       select model.* from ${prefix}ACT_DE_MODEL_RELATION modelrelation 
       inner join ${prefix}ACT_DE_MODEL model on modelrelation.model_id = model.id
       where modelrelation.parent_model_id = #{parentModelId, jdbcType=VARCHAR}
    </select>
    
    <select id="selectModelByParameters" parameterType="map" resultMap="modelResultMap">
        select * from ${prefix}ACT_DE_MODEL
        <where> 
            <if test="modelType != null">
               model_type = #{modelType, jdbcType=VARCHAR}
            </if>
            <if test="filter != null">
               and (lower(name) like #{filter, jdbcType=VARCHAR} or lower(description) like #{filter, jdbcType=VARCHAR}) 
            </if>
            <if test="key != null">
               and model_key = #{key, jdbcType=VARCHAR}
            </if>
            <if test="tenantId != null">
               and tenant_id = #{tenantId, jdbcType=VARCHAR}
            </if>
        </where>
        <if test="sort != null">
            <if test="sort == 'nameAsc'">
                order by name asc
            </if>
            <if test="sort == 'nameDesc'">
                order by name desc
            </if>
            <if test="sort == 'modifiedAsc'">
                order by last_updated asc
            </if>
            <if test="sort == 'modifiedDesc'">
                order by last_updated desc
            </if>
        </if>
    </select>
    
    <select id="countByModelTypeAndCreatedBy" parameterType="map">
       select count(m.id) from ${prefix}ACT_DE_MODEL m 
       where m.created_by = #{createdBy, jdbcType=VARCHAR} and m.model_type = #{modelType, jdbcType=INTEGER}
      <if test="tenantId != null">
         and tenant_id = #{tenantId, jdbcType=VARCHAR}
      </if>
    </select>

    <delete id="deleteModel" parameterType="org.flowable.ui.modeler.domain.Model">
        delete from ${prefix}ACT_DE_MODEL where id = #{id}
    </delete>
    
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy