提交 038b33c9 编写于 作者: sq3536's avatar sq3536

提交modeler

上级 c70e3832
package cn.ibizlab;
import lombok.extern.slf4j.Slf4j;
import org.flowable.ui.common.service.idm.RemoteIdmService;
import org.flowable.ui.modeler.properties.FlowableModelerAppProperties;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
......@@ -16,6 +21,16 @@ import java.util.List;
@Configuration
@EnableTransactionManagement
@EnableFeignClients(basePackages = {"cn.ibizlab" })
@EnableConfigurationProperties(FlowableModelerAppProperties.class)
@ComponentScan(
basePackages = { "cn.ibizlab",
"org.flowable.ui.modeler.repository",
"org.flowable.ui.modeler.service",
"org.flowable.ui.common.service",
"org.flowable.ui.common.repository",
"org.flowable.ui.common.tenant" },
excludeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = RemoteIdmService.class), }
)
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,
})
......
......@@ -92,6 +92,27 @@
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.4.2</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>6.4.2</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-app</artifactId>
<version>6.4.2</version>
</dependency>
</dependencies>
</project>
package org.flowable.ui.common.security;
import org.flowable.idm.api.User;
import org.flowable.ui.common.model.RemoteUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.ArrayList;
import java.util.List;
public class SecurityUtils {
private static User assumeUser;
private SecurityUtils() {
}
/**
* Get the login of the current user.
*/
public static String getCurrentUserId() {
User user = getCurrentUserObject();
if (user != null) {
return user.getId();
}
return null;
}
/**
* 添加流程时会用到用户id,这里重构SecurityUtils.getCurrentUserObject 获取用户信息
*/
public static User getCurrentUserObject() {
if (assumeUser != null) {
return assumeUser;
}
RemoteUser user = new RemoteUser();
user.setId("admin");
user.setDisplayName("admin");
user.setFirstName("admin");
user.setLastName("admin");
user.setEmail("admin@admin.com");
user.setPassword("test");
List<String> pris = new ArrayList<>();
pris.add(DefaultPrivileges.ACCESS_MODELER);
pris.add(DefaultPrivileges.ACCESS_IDM);
pris.add(DefaultPrivileges.ACCESS_ADMIN);
pris.add(DefaultPrivileges.ACCESS_TASK);
pris.add(DefaultPrivileges.ACCESS_REST_API);
user.setPrivileges(pris);
return user;
}
public static FlowableAppUser getCurrentFlowableAppUser() {
FlowableAppUser user = null;
SecurityContext securityContext = SecurityContextHolder.getContext();
if (securityContext != null && securityContext.getAuthentication() != null) {
Object principal = securityContext.getAuthentication().getPrincipal();
if (principal instanceof FlowableAppUser) {
user = (FlowableAppUser) principal;
}
}
return user;
}
public static boolean currentUserHasCapability(String capability) {
FlowableAppUser user = getCurrentFlowableAppUser();
for (GrantedAuthority grantedAuthority : user.getAuthorities()) {
if (capability.equals(grantedAuthority.getAuthority())) {
return true;
}
}
return false;
}
public static void assumeUser(User user) {
assumeUser = user;
}
public static void clearAssumeUser() {
assumeUser = null;
}
}
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="Think (generated)" id="1561433044682-1">
<createTable remarks="文件" tableName="IBZFILE">
<column name="FILEID" type="VARCHAR2(100 BYTE)">
<constraints primaryKey="true" primaryKeyName="SYS_C00168533"/>
</column>
<column name="FILENAME" type="VARCHAR2(200 BYTE)"/>
<column name="FILEPATH" type="VARCHAR2(500 BYTE)"/>
<column name="FOLDER" type="VARCHAR2(20 BYTE)"/>
<column name="CREATEMAN" type="VARCHAR2(60 BYTE)"/>
<column name="CREATEDATE" type="date"/>
<column name="UPDATEMAN" type="VARCHAR2(60 BYTE)"/>
<column name="UPDATEDATE" type="date"/>
<column name="FILEEXT" type="VARCHAR2(10 BYTE)"/>
<column name="FILESIZE" type="INTEGER"/>
<column name="DIGESTCODE" type="VARCHAR2(64 BYTE)"/>
<column name="OWNERTYPE" type="VARCHAR2(100 BYTE)"/>
<column name="OWNERID" type="VARCHAR2(100 BYTE)"/>
<column name="MEMO" type="VARCHAR2(500 BYTE)"/>
<column name="RESERVER" type="VARCHAR2(100 BYTE)"/>
</createTable>
</changeSet>
<changeSet author="Think (generated)" id="1561433044682-2">
<createTable remarks="用户" tableName="IBZUSER">
<column name="USERID" type="VARCHAR2(100 BYTE)">
<constraints primaryKey="true" primaryKeyName="SYS_C00168531"/>
</column>
<column name="PERSONNAME" type="VARCHAR2(200 BYTE)"/>
<column name="USERNAME" type="VARCHAR2(200 BYTE)"/>
<column name="USERCODE" type="VARCHAR2(100 BYTE)"/>
<column name="LOGINNAME" type="VARCHAR2(100 BYTE)"/>
<column name="PASSWORD" type="VARCHAR2(100 BYTE)"/>
<column name="DOMAINS" type="VARCHAR2(100 BYTE)"/>
<column name="MDEPTID" type="VARCHAR2(100 BYTE)"/>
<column name="MDEPTCODE" type="VARCHAR2(100 BYTE)"/>
<column name="MDEPTNAME" type="VARCHAR2(200 BYTE)"/>
<column name="BCODE" type="VARCHAR2(100 BYTE)"/>
<column name="POSTID" type="VARCHAR2(100 BYTE)"/>
<column name="POSTCODE" type="VARCHAR2(100 BYTE)"/>
<column name="POSTNAME" type="VARCHAR2(200 BYTE)"/>
<column name="ORGID" type="VARCHAR2(100 BYTE)"/>
<column name="ORGCODE" type="VARCHAR2(100 BYTE)"/>
<column name="ORGNAME" type="VARCHAR2(200 BYTE)"/>
<column name="NICKNAME" type="VARCHAR2(36 BYTE)"/>
<column name="EMAIL" type="VARCHAR2(100 BYTE)"/>
<column name="AVATAR" type="VARCHAR2(100 BYTE)"/>
<column name="PHONE" type="VARCHAR2(100 BYTE)"/>
<column name="RESERVER" type="VARCHAR2(100 BYTE)"/>
<column name="USERICON" type="VARCHAR2(100 BYTE)"/>
<column name="SEX" type="VARCHAR2(10 BYTE)"/>
<column name="BIRTHDAY" type="date"/>
<column name="CERTCODE" type="VARCHAR2(36 BYTE)"/>
<column name="ADDR" type="VARCHAR2(200 BYTE)"/>
<column name="THEME" type="VARCHAR2(100 BYTE)"/>
<column name="FONTSIZE" type="VARCHAR2(10 BYTE)"/>
<column name="LANG" type="VARCHAR2(100 BYTE)"/>
<column name="MEMO" type="VARCHAR2(500 BYTE)"/>
</createTable>
</changeSet>
<changeSet author="Think (generated)" id="1561433044682-3">
<insert tableName="IBZUSER">
<column name="USERID" value="0100"/>
<column name="PERSONNAME" value="管理员"/>
<column name="USERNAME" value="系统管理员"/>
<column name="USERCODE" value="0100"/>
<column name="LOGINNAME" value="ibzadmin"/>
<column name="PASSWORD" value="123456"/>
<column name="DOMAINS" value="100000"/>
<column name="MDEPTID"/>
<column name="MDEPTCODE"/>
<column name="MDEPTNAME"/>
<column name="BCODE"/>
<column name="POSTID"/>
<column name="POSTCODE"/>
<column name="POSTNAME"/>
<column name="ORGID"/>
<column name="ORGCODE"/>
<column name="ORGNAME"/>
<column name="NICKNAME"/>
<column name="EMAIL"/>
<column name="AVATAR"/>
<column name="PHONE"/>
<column name="RESERVER"/>
<column name="USERICON"/>
<column name="SEX"/>
<column name="BIRTHDAY"/>
<column name="CERTCODE"/>
<column name="ADDR"/>
<column name="THEME"/>
<column name="FONTSIZE"/>
<column name="LANG"/>
<column name="MEMO"/>
</insert>
</changeSet>
</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="1561433044683-1" author="flowable">
<!-- model -->
<createTable tableName="ACT_DE_MODEL">
<column name="id" type="varchar(255)">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="name" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="model_key" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="description" type="varchar(4000)">
<constraints nullable="true" />
</column>
<column name="model_comment" type="varchar(4000)">
<constraints nullable="true" />
</column>
<column name="created" type="datetime(6)">
<constraints nullable="true" />
</column>
<column name="created_by" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="last_updated" type="datetime(6)">
<constraints nullable="true" />
</column>
<column name="last_updated_by" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="version" type="int">
<constraints nullable="true" />
</column>
<column name="model_editor_json" type="longtext">
<constraints nullable="true" />
</column>
<column name="thumbnail" type="longblob">
<constraints nullable="true" />
</column>
<column name="model_type" type="int">
<constraints nullable="true" />
</column>
</createTable>
<createIndex indexName="idx_proc_mod_created"
tableName="ACT_DE_MODEL" unique="false">
<column name="created_by" />
</createIndex>
<!-- Model history -->
<createTable tableName="ACT_DE_MODEL_HISTORY">
<column name="id" type="varchar(255)">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="name" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="model_key" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="description" type="varchar(4000)">
<constraints nullable="true" />
</column>
<column name="model_comment" type="varchar(4000)">
<constraints nullable="true" />
</column>
<column name="created" type="datetime(6)">
<constraints nullable="true" />
</column>
<column name="created_by" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="last_updated" type="datetime(6)">
<constraints nullable="true" />
</column>
<column name="last_updated_by" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="removal_date" type="datetime(6)">
<constraints nullable="true" />
</column>
<column name="version" type="int">
<constraints nullable="true" />
</column>
<column name="model_editor_json" type="longtext">
<constraints nullable="true" />
</column>
<column name="model_id" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="model_type" type="int">
<constraints nullable="true" />
</column>
</createTable>
<createIndex indexName="idx_proc_mod_history_proc"
tableName="ACT_DE_MODEL_HISTORY" unique="false">
<column name="model_id" />
</createIndex>
<!-- MODEL RELATION -->
<createTable tableName="ACT_DE_MODEL_RELATION">
<column name="id" type="varchar(255)">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="parent_model_id" type="varchar(255)" />
<column name="model_id" type="varchar(255)" />
<column name="relation_type" type="varchar(255)" />
</createTable>
<addForeignKeyConstraint baseColumnNames="parent_model_id"
baseTableName="ACT_DE_MODEL_RELATION" constraintName="fk_relation_parent"
referencedColumnNames="id" referencedTableName="ACT_DE_MODEL" />
<addForeignKeyConstraint baseColumnNames="model_id"
baseTableName="ACT_DE_MODEL_RELATION" constraintName="fk_relation_child"
referencedColumnNames="id" referencedTableName="ACT_DE_MODEL" />
</changeSet>
<!--
Bugfix: saving a model multiple times can sometimes give a conflict exception on sql server
due to the precision storage of the datetime data type. The datetime2 type has a better precision.
-->
<changeSet id="1561433044683-2" author="flowable" dbms="mssql">
<modifyDataType tableName="ACT_DE_MODEL" columnName="created" newDataType="datetime2" />
<modifyDataType tableName="ACT_DE_MODEL" columnName="last_updated" newDataType="datetime2" />
<modifyDataType tableName="ACT_DE_MODEL_HISTORY" columnName="created" newDataType="datetime2" />
<modifyDataType tableName="ACT_DE_MODEL_HISTORY" columnName="last_updated" newDataType="datetime2" />
<modifyDataType tableName="ACT_DE_MODEL_HISTORY" columnName="removal_date" newDataType="datetime2" />
</changeSet>
<changeSet id="1561433044683-3" author="flowable">
<addColumn tableName="ACT_DE_MODEL">
<column name="tenant_id" type="varchar(255)" />
</addColumn>
<addColumn tableName="ACT_DE_MODEL_HISTORY">
<column name="tenant_id" type="varchar(255)" />
</addColumn>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?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>
\ No newline at end of file
<?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.ModelHistory">
<resultMap id="modelHistoryResultMap" type="org.flowable.ui.modeler.domain.ModelHistory">
<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="modelId" column="model_id" jdbcType="VARCHAR" />
<result property="removalDate" column="removal_date" jdbcType="TIMESTAMP" />
<result property="tenantId" column="tenant_id" jdbcType="VARCHAR" />
</resultMap>
<insert id="insertModelHistory" parameterType="org.flowable.ui.modeler.domain.ModelHistory">
insert into ACT_DE_MODEL_HISTORY (
id,
name,
model_key,
description,
model_comment,
created,
created_by,
last_updated,
last_updated_by,
version,
model_editor_json,
model_type,
model_id,
removal_date,
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},
#{modelId, jdbcType=VARCHAR},
#{removalDate, jdbcType=TIMESTAMP},
#{tenantId, jdbcType=VARCHAR}
)
</insert>
<update id="updateModelHistory" parameterType="org.flowable.ui.modeler.domain.Model">
update ACT_DE_MODEL_HISTORY
<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_id = #{modelId, jdbcType=VARCHAR},
removal_date = #{removalDate, jdbcType=TIMESTAMP},
tenant_id = #{tenantId, jdbcType=VARCHAR}
</set>
where id = #{id, jdbcType=VARCHAR}
</update>
<select id="selectModelHistory" parameterType="string" resultMap="modelHistoryResultMap">
select * from ACT_DE_MODEL_HISTORY where id = #{id, jdbcType=VARCHAR}
</select>
<select id="selectModelHistoryByTypeAndCreatedBy" parameterType="map" resultMap="modelHistoryResultMap">
select * from ACT_DE_MODEL_HISTORY
where created_by = #{createdBy, jdbcType=VARCHAR}
and model_type = #{modelType, jdbcType=INTEGER}
and removal_date is null
<if test="tenantId != null">
and tenant_id = #{tenantId, jdbcType=VARCHAR}
</if>
</select>
<select id="selectModelHistoryByModelId" parameterType="string" resultMap="modelHistoryResultMap">
select * from ACT_DE_MODEL_HISTORY
where model_id = #{modelId, jdbcType=VARCHAR}
and removal_date is null
</select>
<delete id="deleteModelHistory" parameterType="org.flowable.ui.modeler.domain.ModelHistory">
delete from ACT_DE_MODEL_HISTORY where id = #{id, jdbcType=VARCHAR}
</delete>
</mapper>
\ No newline at end of file
<?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.ModelRelation">
<resultMap id="modelRelationResultMap" type="org.flowable.ui.modeler.domain.ModelRelation">
<id property="id" column="id" jdbcType="VARCHAR" />
<result property="parentModelId" column="parent_model_id" jdbcType="VARCHAR" />
<result property="modelId" column="model_id" jdbcType="VARCHAR" />
<result property="type" column="relation_type" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="modelInformationResultMap" type="org.flowable.ui.modeler.domain.ModelInformation">
<id property="id" column="id" jdbcType="VARCHAR" />
<result property="name" column="name" jdbcType="VARCHAR" />
<result property="type" column="model_type" jdbcType="INTEGER" />
</resultMap>
<insert id="insertModelRelation" parameterType="org.flowable.ui.modeler.domain.ModelRelation">
insert into ACT_DE_MODEL_RELATION (
id,
parent_model_id,
model_id,
relation_type)
values (
#{id, jdbcType=VARCHAR},
#{parentModelId, jdbcType=VARCHAR},
#{modelId, jdbcType=VARCHAR},
#{type, jdbcType=VARCHAR}
)
</insert>
<update id="updateModelRelation" parameterType="org.flowable.ui.modeler.domain.ModelRelation">
update ACT_DE_MODEL_RELATION
<set>
parent_model_id = #{parentModelId, jdbcType=VARCHAR},
model_id = #{modelId, jdbcType=VARCHAR},
relation_type = #{type, jdbcType=VARCHAR}
</set>
where id = #{id, jdbcType=VARCHAR}
</update>
<select id="selectModelRelationByParentModelIdAndType" parameterType="map" resultMap="modelRelationResultMap">
select * from ACT_DE_MODEL_RELATION
where parent_model_id = #{parentModelId, jdbcType=VARCHAR} and relation_type = #{type, jdbcType=VARCHAR}
</select>
<select id="selectModelInformationByParentModelId" parameterType="string" resultMap="modelInformationResultMap">
select m.id as id, m.name as name, m.model_type as model_type
from ACT_DE_MODEL_RELATION mr inner join ACT_DE_MODEL m on mr.model_id = m.id
where mr.parent_model_id = #{parentModelId, jdbcType=VARCHAR}
</select>
<select id="selectModelInformationModelId" parameterType="string" resultMap="modelInformationResultMap">
select m.id as id, m.name as name, m.model_type as model_type
from ACT_DE_MODEL_RELATION mr inner join ACT_DE_MODEL m on mr.parent_model_id = m.id
where mr.model_id = #{modelId, jdbcType=VARCHAR}
</select>
<delete id="deleteModelRelation" parameterType="org.flowable.ui.modeler.domain.ModelRelation">
delete from ACT_DE_MODEL_RELATION where id = #{id, jdbcType=VARCHAR}
</delete>
<delete id="deleteModelRelationByParentModelId" parameterType="string">
delete from ACT_DE_MODEL_RELATION where parent_model_id = #{parentModelId, jdbcType=VARCHAR}
</delete>
</mapper>
\ No newline at end of file
package cn.ibizlab.api;
import lombok.extern.slf4j.Slf4j;
import org.flowable.ui.common.service.idm.RemoteIdmService;
import org.flowable.ui.modeler.properties.FlowableModelerAppProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.mybatis.spring.annotation.MapperScan;
......@@ -19,6 +23,16 @@ import java.util.List;
@Configuration
@EnableTransactionManagement
@ComponentScan(basePackages = {"cn.ibizlab"})
@EnableConfigurationProperties(FlowableModelerAppProperties.class)
@ComponentScan(
basePackages = { "cn.ibizlab",
"org.flowable.ui.modeler.repository",
"org.flowable.ui.modeler.service",
"org.flowable.ui.common.service",
"org.flowable.ui.common.repository",
"org.flowable.ui.common.tenant" },
excludeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = RemoteIdmService.class), }
)
@EnableMongoRepositories(basePackages = {"cn.ibizlab"})
@MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册