parent
043db3e726
commit
74683e1fb1
@ -0,0 +1,79 @@ |
||||
/* |
||||
Navicat Premium Data Transfer |
||||
|
||||
Source Server : mysql-localhost |
||||
Source Server Type : MySQL |
||||
Source Server Version : 50724 |
||||
Source Host : localhost:3306 |
||||
Source Schema : sop |
||||
|
||||
Target Server Type : MySQL |
||||
Target Server Version : 50724 |
||||
File Encoding : 65001 |
||||
|
||||
Date: 27/03/2019 20:16:41 |
||||
*/ |
||||
|
||||
SET NAMES utf8mb4; |
||||
SET FOREIGN_KEY_CHECKS = 0; |
||||
|
||||
-- ---------------------------- |
||||
-- Table structure for isv_info |
||||
-- ---------------------------- |
||||
DROP TABLE IF EXISTS `isv_info`; |
||||
CREATE TABLE `isv_info` ( |
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
||||
`app_key` varchar(100) NOT NULL COMMENT 'appKey', |
||||
`secret` varchar(200) NOT NULL COMMENT 'secret', |
||||
`pub_key` text COMMENT '公钥', |
||||
`pri_key` text COMMENT '私钥', |
||||
`status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '0启用,1禁用', |
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
||||
PRIMARY KEY (`id`), |
||||
UNIQUE KEY `uk_app_key` (`app_key`) |
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='isv信息表'; |
||||
|
||||
-- ---------------------------- |
||||
-- Table structure for perm_isv_role |
||||
-- ---------------------------- |
||||
DROP TABLE IF EXISTS `perm_isv_role`; |
||||
CREATE TABLE `perm_isv_role` ( |
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
||||
`isv_info_id` bigint(20) NOT NULL COMMENT 'isv_info.id', |
||||
`role_code` varchar(50) NOT NULL COMMENT '角色code', |
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
||||
PRIMARY KEY (`id`), |
||||
UNIQUE KEY `uk_user_role` (`isv_info_id`,`role_code`) |
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='isv角色'; |
||||
|
||||
-- ---------------------------- |
||||
-- Table structure for perm_role |
||||
-- ---------------------------- |
||||
DROP TABLE IF EXISTS `perm_role`; |
||||
CREATE TABLE `perm_role` ( |
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
||||
`role_code` varchar(50) NOT NULL COMMENT '角色代码', |
||||
`description` varchar(50) NOT NULL COMMENT '角色描述', |
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
||||
PRIMARY KEY (`id`), |
||||
UNIQUE KEY `uk_code` (`role_code`) |
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色表'; |
||||
|
||||
-- ---------------------------- |
||||
-- Table structure for perm_role_permission |
||||
-- ---------------------------- |
||||
DROP TABLE IF EXISTS `perm_role_permission`; |
||||
CREATE TABLE `perm_role_permission` ( |
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
||||
`role_code` varchar(50) NOT NULL COMMENT '角色表code', |
||||
`route_id` bigint(20) NOT NULL COMMENT 'api_id', |
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
||||
PRIMARY KEY (`id`), |
||||
UNIQUE KEY `uk_role_perm` (`role_code`,`route_id`) |
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色权限表'; |
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1; |
@ -0,0 +1,16 @@ |
||||
package com.gitee.sop.adminserver.api.isv.result; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author thc |
||||
*/ |
||||
@Data |
||||
public class RoleVO { |
||||
private Long id; |
||||
private String roleCode; |
||||
private String description; |
||||
private Date gmtCreate; |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.gitee.sop.adminserver.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
import javax.persistence.Column; |
||||
import javax.persistence.GeneratedValue; |
||||
import javax.persistence.GenerationType; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.Table; |
||||
|
||||
|
||||
/** |
||||
* 表名:perm_isv_role |
||||
* 备注:isv角色 |
||||
* |
||||
* @author tanghc |
||||
*/ |
||||
@Table(name = "perm_isv_role") |
||||
@Data |
||||
public class PermIsvRole { |
||||
@Id |
||||
@Column(name = "id") |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
/** 数据库字段:id */ |
||||
private Long id; |
||||
|
||||
/** isv_info.id, 数据库字段:isv_info_id */ |
||||
private Long isvInfoId; |
||||
|
||||
/** 角色code, 数据库字段:role_code */ |
||||
private String roleCode; |
||||
|
||||
/** 数据库字段:gmt_create */ |
||||
private Date gmtCreate; |
||||
|
||||
/** 数据库字段:gmt_modified */ |
||||
private Date gmtModified; |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.gitee.sop.adminserver.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
import javax.persistence.Column; |
||||
import javax.persistence.GeneratedValue; |
||||
import javax.persistence.GenerationType; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.Table; |
||||
|
||||
|
||||
/** |
||||
* 表名:perm_role |
||||
* 备注:角色表 |
||||
* |
||||
* @author tanghc |
||||
*/ |
||||
@Table(name = "perm_role") |
||||
@Data |
||||
public class PermRole { |
||||
@Id |
||||
@Column(name = "id") |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
/** 数据库字段:id */ |
||||
private Long id; |
||||
|
||||
/** 角色代码, 数据库字段:role_code */ |
||||
private String roleCode; |
||||
|
||||
/** 角色描述, 数据库字段:description */ |
||||
private String description; |
||||
|
||||
/** 数据库字段:gmt_create */ |
||||
private Date gmtCreate; |
||||
|
||||
/** 数据库字段:gmt_modified */ |
||||
private Date gmtModified; |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.gitee.sop.adminserver.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
import javax.persistence.Column; |
||||
import javax.persistence.GeneratedValue; |
||||
import javax.persistence.GenerationType; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.Table; |
||||
|
||||
|
||||
/** |
||||
* 表名:perm_role_permission |
||||
* 备注:角色权限表 |
||||
* |
||||
* @author tanghc |
||||
*/ |
||||
@Table(name = "perm_role_permission") |
||||
@Data |
||||
public class PermRolePermission { |
||||
@Id |
||||
@Column(name = "id") |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
/** 数据库字段:id */ |
||||
private Long id; |
||||
|
||||
/** 角色表code, 数据库字段:role_code */ |
||||
private String roleCode; |
||||
|
||||
/** api_id, 数据库字段:route_id */ |
||||
private Long routeId; |
||||
|
||||
/** 数据库字段:gmt_create */ |
||||
private Date gmtCreate; |
||||
|
||||
/** 数据库字段:gmt_modified */ |
||||
private Date gmtModified; |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.gitee.sop.adminserver.mapper; |
||||
|
||||
import com.gitee.fastmybatis.core.mapper.CrudMapper; |
||||
|
||||
import com.gitee.sop.adminserver.entity.PermIsvRole; |
||||
|
||||
|
||||
/** |
||||
* @author tanghc |
||||
*/ |
||||
public interface PermIsvRoleMapper extends CrudMapper<PermIsvRole, Long> { |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.gitee.sop.adminserver.mapper; |
||||
|
||||
import com.gitee.fastmybatis.core.mapper.CrudMapper; |
||||
|
||||
import com.gitee.sop.adminserver.entity.PermRole; |
||||
|
||||
|
||||
/** |
||||
* @author tanghc |
||||
*/ |
||||
public interface PermRoleMapper extends CrudMapper<PermRole, Long> { |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.gitee.sop.adminserver.mapper; |
||||
|
||||
import com.gitee.fastmybatis.core.mapper.CrudMapper; |
||||
|
||||
import com.gitee.sop.adminserver.entity.PermRolePermission; |
||||
|
||||
|
||||
/** |
||||
* @author tanghc |
||||
*/ |
||||
public interface PermRolePermissionMapper extends CrudMapper<PermRolePermission, Long> { |
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.gitee.sop.adminserver.service; |
||||
|
||||
import com.gitee.sop.adminserver.entity.PermIsvRole; |
||||
import com.gitee.sop.adminserver.mapper.PermIsvRoleMapper; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author thc |
||||
*/ |
||||
@Service |
||||
public class PermService { |
||||
@Autowired |
||||
PermIsvRoleMapper permClientRoleMapper; |
||||
|
||||
/** |
||||
* 获取客户端角色码列表 |
||||
* |
||||
* @param clientId |
||||
* @return |
||||
*/ |
||||
public List<String> listClientRoleCode(Long clientId) { |
||||
List<PermIsvRole> list = permClientRoleMapper.listByColumn("client_id", clientId); |
||||
List<String> retList = new ArrayList<>(list.size()); |
||||
for (PermIsvRole permClientRole : list) { |
||||
retList.add(permClientRole.getRoleCode()); |
||||
} |
||||
return retList; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue