发表时间:2010-05-11
最后修改:2010-05-11
CREATE TABLE ss_authority(
id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,
display_name varchar(255) DEFAULT (NULL),
name varchar(255) NOT NULL UNIQUE
)
-- ----------------------------
-- Records of ss_authority
-- ----------------------------
INSERT INTO ss_authority VALUES ( '浏览用户', 'A_VIEW_USER');
INSERT INTO ss_authority VALUES ('修改用户', 'A_MODIFY_USER');
INSERT INTO ss_authority VALUES ( '浏览角色', 'A_VIEW_ROLE');
INSERT INTO ss_authority VALUES ( '修改角色', 'A_MODIFY_ROLE');
CREATE TABLE ss_resource (
id bigint NOT NULL identity(1,1) primary key ,
position float NOT NULL,
resource_type varchar(255) NOT NULL,
value varchar(255) NOT NULL UNIQUE
)
-- ----------------------------
-- Records of ss_resource
-- ----------------------------
INSERT INTO ss_resource VALUES ( '1', 'url', '/security/user!save*');
INSERT INTO ss_resource VALUES ( '2', 'url', '/security/user!delete*');
INSERT INTO ss_resource VALUES ( '3', 'url', '/security/user*');
INSERT INTO ss_resource VALUES ( '4', 'url', '/security/role!save*');
INSERT INTO ss_resource VALUES ( '5', 'url', '/security/role!delete*');
INSERT INTO ss_resource VALUES ( '6', 'url', '/security/role*');
CREATE TABLE ss_resource_authority (
resource_id bigint PRIMARY KEY NOT NULL,
authority_id bigint PRIMARY KEY NOT NULL,
CONSTRAINT PK_ss_resource_authority PRIMARY KEY CLUSTERED
(
resource_id ASC,
authority_id ASC
)WITH (IGNORE_DUP_KEY = OFF) ON PRIMARY
) ON PRIMARY
)
-- ----------------------------
-- Records of ss_resource_authority
-- ----------------------------
INSERT INTO ss_resource_authority VALUES ('1', '2');
INSERT INTO ss_resource_authority VALUES ('2', '2');
INSERT INTO ss_resource_authority VALUES ('3', '1');
INSERT INTO ss_resource_authority VALUES ('4', '4');
INSERT INTO ss_resource_authority VALUES ('5', '4');
INSERT INTO ss_resource_authority VALUES ('6', '3');
CREATE TABLE ss_role (
id bigint identity(1,1) primary key NOT NULL ,
name varchar(255) UNIQUE NOT NULL
)
-- ----------------------------
-- Records of ss_role
-- ----------------------------
INSERT INTO ss_role VALUES ( 'managerAdimin');
INSERT INTO ss_role VALUES ( '用户');
CREATE TABLE ss_role_authority(
role_id bigint NOT NULL,
authority_id bigint NOT NULL,
CONSTRAINT PK_ss_role_authority PRIMARY KEY CLUSTERED
(
role_id ASC,
authority_id ASC
)
)
ALTER TABLE ss_role_authority WITH CHECK ADD CONSTRAINT FK_ss_role_authority_ss_authority FOREIGN KEY(authority_id)
REFERENCES ss_authority (id)
GO
ALTER TABLE ss_role_authority WITH CHECK ADD CONSTRAINT FK_ss_role_authority_ss_role FOREIGN KEY(role_id)
REFERENCES ss_role (id)
-- ----------------------------
-- Records of ss_role_authority
-- ----------------------------
INSERT INTO ss_role_authority VALUES ('1', '1');
INSERT INTO ss_role_authority VALUES ('1', '3');
INSERT INTO ss_role_authority VALUES ('2', '4');
INSERT INTO ss_role_authority VALUES ('2', '1');
INSERT INTO ss_role_authority VALUES ('2', '2');
INSERT INTO ss_role_authority VALUES ('2', '3');
INSERT INTO ss_role_authority VALUES ('2', '4');
CREATE TABLE ss_user (
id bigint NOT NULL identity(1,1) PRIMARY KEY ,
email varchar(255) DEFAULT NULL,
login_name varchar(255) NOT NULL,
name varchar(255) DEFAULT NULL UNIQUE,
password varchar(255) DEFAULT NULL,
)
-- ----------------------------
-- Records of ss_user
-- ----------------------------
INSERT INTO ss_user VALUES ( 'admin@springside.org.cn', 'admin', 'Admin', 'admin');
INSERT INTO ss_user VALUES ( 'hongcai.z@gmail.com', '张洪财', 'Admin', 'admin');
CREATE TABLE [ss_user_role](
[user_id] [bigint] NOT NULL,
[role_id] [bigint] NOT NULL,
CONSTRAINT [PK_ss_user_role] PRIMARY KEY CLUSTERED
(
[user_id] ASC,
[role_id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
USE [magazine]
GO
ALTER TABLE [ss_user_role] WITH CHECK ADD CONSTRAINT [FK_ss_user_role_ss_role] FOREIGN KEY([role_id])
REFERENCES [ss_role] ([id])
GO
ALTER TABLE [ss_user_role] WITH CHECK ADD CONSTRAINT [FK_ss_user_role_ss_user] FOREIGN KEY([user_id])
REFERENCES [ss_user] ([id])
-- ----------------------------
-- Records of ss_user_role
-- ----------------------------
INSERT INTO ss_user_role VALUES ('1', '2');
INSERT INTO ss_user_role VALUES ('1', '4');
表结构建完后,改application.properties.
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://192.168.29.130:1433;DatabaseName=magazine;SelectMethod=Cursor
jdbc.username=
jdbc.password=
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
springside 就可以连接到SqlServer 2005