`
huangshenji
  • 浏览: 9772 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

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在上传的包里
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics