用视图覆盖同名的ACT_ID_系列表,
放弃使用系列表:ACT_ID_,创建同名的视图。
1.修改Activiti配置中默认的引擎配置:
设置属性**dbIdentityUsed**为**
false
**即可,此时不会建立ACT_ID_表
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
......
<!-- 是否使用activiti自带用户:用视图替换activiti用户 -->
<property name="dbIdentityUsed" value="false"></property>
......
</bean>
2.创建视图(mysql)
* ACT_ID_GROUP
create or replace view act_id_group
(id_, rev_, name_, type_)
as
select t.name , 1 as rev_,t.name ,'' as type_
from auth_role t;
* ACT_ID_MEMBERSHIP
create or replace view act_id_membership
(user_id_, group_id_)
as
select u.username,r.name
from auth_loginuser u inner join auth_loginuser_auth_role sh
on u.username=sh.loginUsers_username inner join auth_role r on sh.roles_name=r.name;
* ACT_ID_USER
CREATE OR REPLACE VIEW ACT_ID_USER_hhh
(id_, rev_, first_, last_, email_, pwd_, picture_id_)
AS
SELECT auth_loginuser.username,1,auth_loginuser.showName,null,null,auth_loginuser.PASSWORD,null
FROM auth_loginuser
创建的视图要保证数据类型一致,例如用户的ACT_ID_MEMBERSHIP表的两个字段都是字符型,一般系统中都是用NUMBER作为用
户、角色的主键类型,所以创建视图的时候要把数字类型转换为字符型。