batis+acegi实现的动态权限控制

前段时间把网上提供的于hibernate+acegi的基础i改成ibatis+acegi,共享给大家


数据库表


create table USER_INFO(
id int not null auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
username varchar(50) not null,
truename varchar(50) not null,
email varchar(50) not null,
nation int not null default 0,
birthday date not null,
sex int not null default 0,
idcard varchar(18) not null check (idcard.lan in (16,18)),
tel1 varchar(15),
tel2 varchar(15),
address varchar(150),
password varchar(50) not null,
auth_flag int not null default 0,
PRIMARY KEY (id),
UNIQUE KEY (username)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;


create table USER_LOGIN(
id int not null auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
uid int not null,
ip varchar(16) not null,
mac varchar(20) not null,
PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;


create table USER_SECURITY(
id int not null auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
ip_flag int not null,
ip varchar(15),
mac_flag int not null default 0,
mac varchar(15),
uid int not null,
PRIMARY KEY (id),
UNIQUE KEY (uid)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE ROLE(
id int not null auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
role_name varchar(50) not null,
role_desc varchar(50),
roleState int(11) NOT NULL default 0,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE AUTHTYPE (
id int(11) NOT NULL auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
typeName varchar(20) NOT NULL,
typeState int(11) NOT NULL default 0,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE AUTHORITIES (
id int(11) NOT NULL auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
authProtected varchar(100) NOT NULL,
authNote varchar(200) default NULL,
authType int(2) NOT NULL,
authState int(1) NOT NULL,
PRIMARY KEY (id),
KEY FK_authorities (authType),
CONSTRAINT authorities_ibfk_1 FOREIGN KEY (authType) REFERENCES authtype (id) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE ROLE_AUTH (
id int(11) NOT NULL auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
rid int(11) NOT NULL,
aid int(11) NOT NULL,
PRIMARY KEY (id),
KEY FK_role_auth (rid),
KEY FK_auth_role (aid),
CONSTRAINT role_auth_ibfk_1 FOREIGN KEY (rid) REFERENCES role (id) ON UPDATE CASCADE,
CONSTRAINT role_auth_ibfk_2 FOREIGN KEY (aid) REFERENCES authorities (id) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE USER_ROLE (
id int(11) NOT NULL auto_increment,
active_flag int not null default 0,
last_update_date timestamp,
create_date datetime not null,
uid int(11) NOT NULL,
rid int(11) NOT NULL,
PRIMARY KEY (id),
KEY FK_user_role (uid),
KEY FK_role_users (rid),
CONSTRAINT user_role_ibfk_1 FOREIGN KEY (uid) REFERENCES USER_INFO (id) ON UPDATE CASCADE,
CONSTRAINT user_role_ibfk_2 FOREIGN KEY (rid) REFERENCES role (id) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

src在上传的包里
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值