mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
admin后台登录
This commit is contained in:
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpSession;
|
|||||||
public class SystemApi {
|
public class SystemApi {
|
||||||
|
|
||||||
|
|
||||||
|
public static final int STATUS_FORBIDDEN = 2;
|
||||||
@Autowired
|
@Autowired
|
||||||
AdminUserInfoMapper adminUserInfoMapper;
|
AdminUserInfoMapper adminUserInfoMapper;
|
||||||
|
|
||||||
@@ -45,6 +46,9 @@ public class SystemApi {
|
|||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw AdminErrors.ERROR_USERNAME_PWD.getException();
|
throw AdminErrors.ERROR_USERNAME_PWD.getException();
|
||||||
} else {
|
} else {
|
||||||
|
if (user.getStatus() == STATUS_FORBIDDEN) {
|
||||||
|
throw AdminErrors.USER_FORBIDDEN.getException();
|
||||||
|
}
|
||||||
SessionManager sessionManager = ApiContext.getSessionManager();
|
SessionManager sessionManager = ApiContext.getSessionManager();
|
||||||
// 生成一个新session
|
// 生成一个新session
|
||||||
HttpSession session = sessionManager.getSession(null);
|
HttpSession session = sessionManager.getSession(null);
|
||||||
|
@@ -32,4 +32,6 @@ public class AdminErrors {
|
|||||||
|
|
||||||
public static final ErrorMeta NO_USER = new ErrorMeta(isvModule, "10015", "用户不存在");
|
public static final ErrorMeta NO_USER = new ErrorMeta(isvModule, "10015", "用户不存在");
|
||||||
|
|
||||||
|
public static final ErrorMeta USER_FORBIDDEN = new ErrorMeta(isvModule, "10016", "用户已禁用");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
19
sop.sql
19
sop.sql
@@ -61,8 +61,20 @@ CREATE TABLE `perm_role_permission` (
|
|||||||
UNIQUE KEY `uk_role_perm` (`role_code`,`route_id`) USING BTREE
|
UNIQUE KEY `uk_role_perm` (`role_code`,`route_id`) USING BTREE
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='角色权限表';
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='角色权限表';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `admin_user_info`;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `admin_user_info` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`username` varchar(64) NOT NULL DEFAULT '' COMMENT '用户名',
|
||||||
|
`password` varchar(128) NOT NULL DEFAULT '' COMMENT '密码',
|
||||||
|
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用',
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_username` (`username`) USING BTREE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='后台用户表';
|
||||||
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = @PREVIOUS_FOREIGN_KEY_CHECKS;
|
SET FOREIGN_KEY_CHECKS = @PREVIOUS_FOREIGN_KEY_CHECKS;
|
||||||
|
|
||||||
@@ -112,7 +124,12 @@ INSERT INTO `perm_role_permission` (`id`, `role_code`, `route_id`, `gmt_create`,
|
|||||||
ALTER TABLE `perm_role_permission` ENABLE KEYS;
|
ALTER TABLE `perm_role_permission` ENABLE KEYS;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
LOCK TABLES `admin_user_info` WRITE;
|
||||||
|
ALTER TABLE `admin_user_info` DISABLE KEYS;
|
||||||
|
INSERT INTO `admin_user_info` (`id`, `username`, `password`, `status`, `gmt_create`, `gmt_modified`) VALUES
|
||||||
|
(1,'admin','14e1b600b1fd579f47433b88e8d85291',1,'2019-04-02 19:55:26','2019-04-02 19:55:26');
|
||||||
|
ALTER TABLE `admin_user_info` ENABLE KEYS;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = @PREVIOUS_FOREIGN_KEY_CHECKS;
|
SET FOREIGN_KEY_CHECKS = @PREVIOUS_FOREIGN_KEY_CHECKS;
|
||||||
|
Reference in New Issue
Block a user