springBoot里整合activity,启动后生成表

package com.dh.zhdj_v2.config;

import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;

/**
 * Created by Administrator on 2018/5/4.
 */
@Configuration
public class ActivitiConfig {

    @Autowired
    PlatformTransactionManager transactionManager;

    @Autowired
    ApplicationContext applicationContext;

    @Bean
    public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
        DataSource dataSource = applicationContext.getBean(DataSource.class);
        SpringProcessEngineConfiguration config =
                new SpringProcessEngineConfiguration();
        config.setDataSource(dataSource);
          //config.setDbHistoryUsed(false);
        config.setDbIdentityUsed(false);
        config.setTransactionManager(transactionManager);
        //添加字体
        config.setActivityFontName("宋体");
        config.setLabelFontName("宋体");
        config.setAnnotationFontName("宋体");
        config.setDatabaseType("oracle");
        // config.getJobExecutor();
        //第一生成表要启动下面配置,以后重新生成create改为drop-create
        //如果有表不存在就更新添加
         //  config.setDatabaseSchemaUpdate("create");
        //设置Schema为ACT,他会字段添加表
        // config.setDatabaseSchema("ACT");
        return config;
    }

}

//下面一定要写不扫描这个类

@SpringBootApplication(exclude = {org.activiti.spring.boot.SecurityAutoConfiguration.class})
@Transactional(rollbackFor = Exception.class)
@MapperScan("com.dh.zhdj.modules.*.mapper")
@EnableRabbit
public class ZhdjApplication {
    public static void main(String[] args) {
        SpringApplication.run(ZhdjApplication.class, args);
    }

    @Primary
    @Bean
    public TaskExecutor primaryTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        return executor;
    }
}

-- 方案1:根据业务需求,删除工作量的三张表,对应你用户表,创建视图,

--方案2:用户和角色更新时,更新工作流里面的用户和组织信息
CREATE OR REPLACE VIEW ACT_ID_GROUP AS
SELECT r.role_name AS ID_,NULL AS REV_,r.full_name AS NAME_,NULL AS TYPE_ FROM sys_role r;
comment on table ACT_ID_GROUP is '用户组信息表';
comment on column ACT_ID_GROUP.REV_ is '乐观锁';
comment on column ACT_ID_GROUP.NAME_ is '节点名称';
comment on column ACT_ID_GROUP.TYPE_ is '节点类型';

CREATE OR REPLACE VIEW ACT_ID_MEMBERSHIP AS
SELECT u.user_name AS USER_ID_,r.role_name AS GROUP_ID_ FROM sys_user u  join sys_user_role ur ON ur.user_id = u.id  JOIN sys_role r ON r.id = ur.role_id;
comment on table ACT_ID_MEMBERSHIP is '用户与分组对应信息表';
comment on column ACT_ID_MEMBERSHIP.USER_ID_ is '用户ID';
comment on column ACT_ID_MEMBERSHIP.GROUP_ID_ is '用户组ID';

CREATE OR REPLACE VIEW ACT_ID_USER AS
SELECT
  au.user_name AS ID_,
  NULL          AS REV_,
  concat('first_',au.full_name)   AS FIRST_,
  concat('last_',au.full_name) AS LAST_,
  au.email      AS EMAIL_,
  au.user_pwd   AS PWD_,
  NULL         AS PICTURE_ID_
FROM sys_user au;
comment on table ACT_ID_USER is '用户信息表';
comment on column ACT_ID_USER.REV_ is '乐观锁';
comment on column ACT_ID_USER.FIRST_ is '姓';
comment on column ACT_ID_USER.LAST_ is '名';
comment on column ACT_ID_USER.EMAIL_ is 'EMAIL_';
comment on column ACT_ID_USER.PWD_ is '密码';
comment on column ACT_ID_USER.PICTURE_ID_ is '图片ID';
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值