You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
5.5 KiB
132 lines
5.5 KiB
<?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="BLOB" />
|
|
<result property="tenantId" column="tenant_id" jdbcType="VARCHAR" />
|
|
</resultMap>
|
|
|
|
<insert id="insertModel" parameterType="org.flowable.ui.modeler.domain.Model">
|
|
insert into 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=BLOB},
|
|
#{tenantId, jdbcType=VARCHAR}
|
|
)
|
|
</insert>
|
|
|
|
<update id="updateModel" parameterType="org.flowable.ui.modeler.domain.Model">
|
|
update 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=BLOB},
|
|
tenant_id = #{tenantId, jdbcType=VARCHAR}
|
|
</set>
|
|
where id = #{id, jdbcType=VARCHAR}
|
|
</update>
|
|
|
|
<select id="selectModel" parameterType="string" resultMap="modelResultMap">
|
|
select * from ACT_DE_MODEL where id = #{id, jdbcType=VARCHAR}
|
|
</select>
|
|
|
|
<select id="selectModelByParentModelId" parameterType="string" resultMap="modelResultMap">
|
|
select model.* from ACT_DE_MODEL_RELATION modelrelation
|
|
inner join 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 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 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 ACT_DE_MODEL where id = #{id}
|
|
</delete>
|
|
|
|
</mapper> |