Browse Source

新增 运营端访问权限控制模块

dev
hosinokamui 6 years ago
parent
commit
0608964736
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 14
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  3. 38
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java
  4. 25
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java
  5. 4
      epmet-gateway/pom.xml
  6. 8
      epmet-gateway/src/main/resources/bootstrap.yml
  7. 35
      epmet-module/oper-access/oper-access-client/pom.xml
  8. 61
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java
  9. 115
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java
  10. 101
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java
  11. 86
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java
  12. 81
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java
  13. 81
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java
  14. 49
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java
  15. 29
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java
  16. 158
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java
  17. 36
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java
  18. 36
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java
  19. 29
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java
  20. 30
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java
  21. 30
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java
  22. 150
      epmet-module/oper-access/oper-access-server/pom.xml
  23. 21
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java
  24. 26
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java
  25. 94
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java
  26. 101
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java
  27. 94
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java
  28. 94
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java
  29. 94
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java
  30. 94
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java
  31. 27
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java
  32. 52
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java
  33. 48
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java
  34. 24
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java
  35. 42
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java
  36. 45
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java
  37. 49
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java
  38. 67
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java
  39. 57
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java
  40. 46
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java
  41. 37
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java
  42. 37
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java
  43. 50
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java
  44. 74
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java
  45. 74
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java
  46. 65
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java
  47. 62
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java
  48. 62
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java
  49. 32
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  50. 21
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  51. 47
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java
  52. 73
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java
  53. 47
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java
  54. 47
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java
  55. 47
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java
  56. 47
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java
  57. 95
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java
  58. 121
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java
  59. 95
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java
  60. 95
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java
  61. 95
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java
  62. 95
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java
  63. 104
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java
  64. 173
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java
  65. 104
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperResourceServiceImpl.java
  66. 104
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleMenuServiceImpl.java
  67. 104
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java
  68. 104
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleUserServiceImpl.java
  69. 102
      epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml
  70. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages.properties
  71. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_en_US.properties
  72. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_CN.properties
  73. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_TW.properties
  74. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation.properties
  75. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_en_US.properties
  76. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_CN.properties
  77. 1
      epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_TW.properties
  78. 159
      epmet-module/oper-access/oper-access-server/src/main/resources/logback-spring.xml
  79. 16
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperLanguageDao.xml
  80. 42
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml
  81. 25
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperResourceDao.xml
  82. 6
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleDao.xml
  83. 18
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml
  84. 21
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleUserDao.xml
  85. 20
      epmet-module/oper-access/pom.xml
  86. 1
      epmet-module/pom.xml
  87. 126
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java
  88. 109
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java
  89. 39
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/OperUserDao.java
  90. 96
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java
  91. 89
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/OperUserExcel.java
  92. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java
  93. 102
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/OperUserService.java
  94. 111
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java
  95. 37
      epmet-user/epmet-user-server/src/main/resources/mapper/OperUserDao.xml

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://47.104.224.45:3308/epmet_oper_crm?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://47.104.224.45:3308/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet
password: elink@833066
#oracle配置

14
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -61,6 +61,13 @@ public class RedisKeys {
return rootPrefix.concat("sys:user:nav:").concat(String.valueOf(userId)).concat("_").concat(language);
}
/**
* 用户菜单导航Key
*/
public static String getUserMenuNavKey(String userId, String app, String client, String language) {
return rootPrefix.concat("oper:access:nav:").concat(userId).concat("_").concat(app).concat("_").concat(client).concat("_").concat(language);
}
/**
* 用户菜单导航Key
*/
@ -75,6 +82,13 @@ public class RedisKeys {
return rootPrefix.concat("sys:user:permissions:").concat(String.valueOf(userId));
}
/**
* 用户权限标识Key
*/
public static String getUserPermissionsKey(String userId, String app, String client) {
return rootPrefix.concat("oper:access:permissions:").concat(userId).concat("_").concat(app).concat("_").concat(client);
}
/**
* epmet用户token对应redis中的Key
* epmet:sys:security:user:token字符串

38
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java

@ -0,0 +1,38 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.utils;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 树节点所有需要实现树节点的都需要继承该类
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
public class TreeStringNode<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 上级ID
*/
private String pid;
/**
* 子节点列表
*/
private List<T> children = new ArrayList<>();
}

25
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java

@ -77,4 +77,29 @@ public class TreeUtils {
return result;
}
/**
* 构建树节点
*/
public static <T extends TreeStringNode> List<T> buildTree(List<T> treeNodes) {
List<T> result = new ArrayList<>();
//list转map
Map<String, T> nodeMap = new LinkedHashMap<>(treeNodes.size());
for(T treeNode : treeNodes){
nodeMap.put(treeNode.getId(), treeNode);
}
for(T node : nodeMap.values()) {
T parent = nodeMap.get(node.getPid());
if(parent != null && !(node.getId().equals(parent.getId()))){
parent.getChildren().add(node);
continue;
}
result.add(node);
}
return result;
}
}

4
epmet-gateway/pom.xml

@ -135,6 +135,8 @@
<!-- 13、gov-org 数据网格库 原epmet-business -->
<!-- <gateway.routes.gov-org-server.uri>lb://gov-org-server</gateway.routes.gov-org-server.uri>-->
<gateway.routes.gov-org-server.uri>http://127.0.0.1:8092</gateway.routes.gov-org-server.uri>
<!-- 14、#运营端访问权限控制 -->
<gateway.routes.oper-access-server.uri>http://127.0.0.1:8093</gateway.routes.oper-access-server.uri>
</properties>
</profile>
@ -186,6 +188,8 @@
<gateway.routes.resi-guide-server.uri>lb://resi-guid-server</gateway.routes.resi-guide-server.uri>
<!-- 13、gov-org 数据网格库 原epmet-business -->
<gateway.routes.gov-org-server.uri>lb://gov-org-server</gateway.routes.gov-org-server.uri>
<!-- 14、#运营端访问权限控制 -->
<gateway.routes.oper-access-server.uri>lb://oper-access-server</gateway.routes.oper-access-server.uri>
</properties>
</profile>
</profiles>

8
epmet-gateway/src/main/resources/bootstrap.yml

@ -130,6 +130,14 @@ spring:
- Path=${server.servlet.context-path}/gov/org/**
filters:
- StripPrefix=1
#运营端访问权限控制
- id: oper-access-server
uri: @gateway.routes.oper-access-server.uri@
order: 14
predicates:
- Path=${server.servlet.context-path}/oper/access/**
filters:
- StripPrefix=1
nacos:
discovery:
server-addr: @nacos.server-addr@

35
epmet-module/oper-access/oper-access-client/pom.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>oper-access</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>oper-access-client</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

61
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java

@ -0,0 +1,61 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 国际化
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperLanguageDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 表名
*/
private String tableName;
/**
* 表主键
*/
private String tableId;
/**
* 字段名
*/
private String fieldName;
/**
* 字段值
*/
private String fieldValue;
/**
* 语言
*/
private String language;
}

115
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java

@ -0,0 +1,115 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.epmet.commons.tools.utils.TreeStringNode;
import com.epmet.dto.result.MenuResourceDTO;
import lombok.Data;
/**
* 菜单管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperMenuDTO extends TreeStringNode<OperMenuDTO> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 上级ID一级菜单为0
*/
private String pid;
/**
* 菜单URL
*/
private String url;
/**
* 类型 0菜单 1按钮
*/
private Integer type;
/**
* 菜单图标
*/
private String icon;
/**
* 权限标识sys:menu:save
*/
private String permissions;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 菜单资源
*/
private List<MenuResourceDTO> resourceList;
/**
* 上级菜单名称
*/
private String parentName;
}

101
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 资源管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperResourceDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 资源编码如菜单ID
*/
private String resourceCode;
/**
* 资源名称
*/
private String resourceName;
/**
* 资源URL
*/
private String resourceUrl;
/**
* 请求方式GETPOSTPUTDELETE
*/
private String resourceMethod;
/**
* 菜单标识 0非菜单资源 1菜单资源
*/
private Integer menuFlag;
/**
* 认证等级 0权限认证 1登录认证 2无需认证
*/
private Integer authLevel;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

86
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperRoleDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 角色名称
*/
private String name;
/**
* 备注
*/
private String remark;
/**
* 部门ID
*/
private Long deptId;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

81
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 角色菜单关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperRoleMenuDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 角色ID
*/
private String roleId;
/**
* 菜单ID
*/
private String menuId;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

81
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 角色用户关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperRoleUserDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 角色ID
*/
private String roleId;
/**
* 用户ID
*/
private String userId;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

49
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java

@ -0,0 +1,49 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
*
* 用户信息token
*
* @author zhaoqifeng
* @date 2020/3/18 10:23
*/
@Data
public class UserInfoDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 政府端:gov居民端:resi运营端:oper
*/
private String app;
/**
* PC端:web微信小程序:wxmp
*/
private String client;
/**
* 用户ID
*/
private String userId;
/**
* openId
*/
private String openId;
/**
* unionId
*/
private String unionId;
/**
* 超级管理员 0 1
*/
private Integer superAdmin;
}

29
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java

@ -0,0 +1,29 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dto.result;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 菜单资源
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
@ApiModel(value = "菜单资源")
public class MenuResourceDTO {
@ApiModelProperty(value = "资源URL")
private String resourceUrl;
@ApiModelProperty(value = "请求方式(如:GET、POST、PUT、DELETE)")
private String resourceMethod;
}

158
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java

@ -0,0 +1,158 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dto.result;
import com.epmet.commons.tools.utils.TreeNode;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 菜单管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@ApiModel(value = "菜单管理")
public class OperMenuDTO extends TreeNode<OperMenuDTO> implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
@Null(message="{id.null}", groups = AddGroup.class)
@NotNull(message="{id.require}", groups = UpdateGroup.class)
private Long id;
@ApiModelProperty(value = "上级ID")
@NotNull(message="{sysmenu.pid.require}", groups = DefaultGroup.class)
private Long pid;
@ApiModelProperty(value = "菜单名称")
@NotBlank(message="{sysmenu.name.require}", groups = DefaultGroup.class)
private String name;
@ApiModelProperty(value = "菜单URL")
private String url;
@ApiModelProperty(value = "类型 0:菜单 1:按钮")
@Range(min=0, max=1, message = "{sysmenu.type.range}", groups = DefaultGroup.class)
private Integer type;
@ApiModelProperty(value = "菜单图标")
private String icon;
@ApiModelProperty(value = "权限标识,如:sys:menu:save")
private String permissions;
@ApiModelProperty(value = "排序")
@Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
private Integer sort;
@ApiModelProperty(value = "创建时间")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Date createDate;
@ApiModelProperty(value = "菜单资源")
private List<MenuResourceDTO> resourceList;
@ApiModelProperty(value = "上级菜单名称")
private String parentName;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setUrl(String url) {
this.url = url;
}
public String getUrl() {
return url;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getIcon() {
return icon;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getSort() {
return sort;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getCreateDate() {
return createDate;
}
public String getPermissions() {
return permissions;
}
public void setPermissions(String permissions) {
this.permissions = permissions;
}
public List<MenuResourceDTO> getResourceList() {
return resourceList;
}
public void setResourceList(List<MenuResourceDTO> resourceList) {
this.resourceList = resourceList;
}
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public Long getPid() {
return pid;
}
@Override
public void setPid(Long pid) {
this.pid = pid;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
}

36
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java

@ -0,0 +1,36 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.enums;
/**
* 菜单资源标识
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public enum MenuFlagEnum {
/**
* 菜单资源
*/
YES(1),
/**
* 非菜单资源
*/
NO(0);
private int value;
MenuFlagEnum(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}

36
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java

@ -0,0 +1,36 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.enums;
/**
* 菜单类型枚举
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public enum MenuTypeEnum {
/**
* 菜单
*/
MENU(0),
/**
* 按钮
*/
BUTTON(1);
private int value;
MenuTypeEnum(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}

29
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java

@ -0,0 +1,29 @@
/**
* Copyright (c) 2019 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.enums;
/**
* 叶子节点枚举
*
* @author Mark sunlightcs@gmail.com
*/
public enum RegionLeafEnum {
YES(1),
NO(0);
private int value;
RegionLeafEnum(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}

30
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java

@ -0,0 +1,30 @@
/**
* Copyright (c) 2019 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.enums;
/**
* 行政区域 级别枚举
*
* @author Mark sunlightcs@gmail.com
*/
public enum RegionLevelEnum {
ONE(1),
TWO(2),
THREE(3);
private int value;
RegionLevelEnum(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}

30
epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java

@ -0,0 +1,30 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.enums;
/**
* 用户状态
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public enum UserStatusEnum {
DISABLE(0),
ENABLED(1);
private int value;
UserStatusEnum(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}

150
epmet-module/oper-access/oper-access-server/pom.xml

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>oper-access</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>oper-access-server</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-access-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-mybatis</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<server.port>8093</server.port>
<spring.profiles.active>dev</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_oper_access?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
</properties>
</profile>
<profile>
<id>test</id>
<!--<activation>
<activeByDefault>true</activeByDefault>
</activation>-->
<properties>
<server.port>8093</server.port>
<spring.profiles.active>test</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_oper_access?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
</properties>
</profile>
</profiles>
</project>

21
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java

@ -0,0 +1,21 @@
package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* 管理后台
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class AccessApplication {
public static void main(String[] args) {
SpringApplication.run(AccessApplication.class, args);
}
}

26
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java

@ -0,0 +1,26 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.config;
import com.epmet.commons.tools.config.ModuleConfig;
import org.springframework.stereotype.Service;
/**
* 模块配置信息-新闻公告模块
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Service
public class ModuleConfigImpl implements ModuleConfig {
@Override
public String getName() {
return "access";
}
}

94
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.OperLanguageDTO;
import com.epmet.excel.OperLanguageExcel;
import com.epmet.service.OperLanguageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 国际化
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@RestController
@RequestMapping("operlanguage")
public class OperLanguageController {
@Autowired
private OperLanguageService operLanguageService;
@GetMapping("page")
public Result<PageData<OperLanguageDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperLanguageDTO> page = operLanguageService.page(params);
return new Result<PageData<OperLanguageDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperLanguageDTO> get(@PathVariable("id") String id){
OperLanguageDTO data = operLanguageService.get(id);
return new Result<OperLanguageDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperLanguageDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operLanguageService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperLanguageDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operLanguageService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operLanguageService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperLanguageDTO> list = operLanguageService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperLanguageExcel.class);
}
}

101
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java

@ -0,0 +1,101 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.OperMenuDTO;
import com.epmet.dto.form.UserInfoDto;
import com.epmet.excel.OperMenuExcel;
import com.epmet.service.OperMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
*
* 菜单管理
*
* @author zhaoqifeng
* @date 2020/3/17 16:35
*/
@RestController
@RequestMapping("menu")
public class OperMenuController {
@Autowired
private OperMenuService operMenuService;
@GetMapping("page")
public Result<PageData<OperMenuDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperMenuDTO> page = operMenuService.page(params);
return new Result<PageData<OperMenuDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperMenuDTO> get(@PathVariable("id") String id){
OperMenuDTO data = operMenuService.get(id);
return new Result<OperMenuDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operMenuService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operMenuService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operMenuService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperMenuDTO> list = operMenuService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperMenuExcel.class);
}
/**
* 导航
* @param userInfo token
* @return List<OperMenuDTO>
*/
@PostMapping("nav")
public Result<List<OperMenuDTO>> nav(@RequestBody UserInfoDto userInfo){
List<OperMenuDTO> list = operMenuService.getUserMenuNavList(userInfo);
return new Result<List<OperMenuDTO>>().ok(list);
}
/**
* 权限标识
* @param userInfo token
* @return Set<String>
*/
@PostMapping("permissions")
public Result<Set<String>> permissions(@RequestBody UserInfoDto userInfo){
Set<String> set = operMenuService.getUserPermissions(userInfo);
return new Result<Set<String>>().ok(set);
}
}

94
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.OperResourceDTO;
import com.epmet.excel.OperResourceExcel;
import com.epmet.service.OperResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 资源管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@RestController
@RequestMapping("operresource")
public class OperResourceController {
@Autowired
private OperResourceService operResourceService;
@GetMapping("page")
public Result<PageData<OperResourceDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperResourceDTO> page = operResourceService.page(params);
return new Result<PageData<OperResourceDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperResourceDTO> get(@PathVariable("id") String id){
OperResourceDTO data = operResourceService.get(id);
return new Result<OperResourceDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperResourceDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operResourceService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperResourceDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operResourceService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operResourceService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperResourceDTO> list = operResourceService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperResourceExcel.class);
}
}

94
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.OperRoleDTO;
import com.epmet.excel.OperRoleExcel;
import com.epmet.service.OperRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@RestController
@RequestMapping("operrole")
public class OperRoleController {
@Autowired
private OperRoleService operRoleService;
@GetMapping("page")
public Result<PageData<OperRoleDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperRoleDTO> page = operRoleService.page(params);
return new Result<PageData<OperRoleDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperRoleDTO> get(@PathVariable("id") String id){
OperRoleDTO data = operRoleService.get(id);
return new Result<OperRoleDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperRoleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operRoleService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperRoleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operRoleService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operRoleService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperRoleDTO> list = operRoleService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperRoleExcel.class);
}
}

94
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.OperRoleMenuDTO;
import com.epmet.excel.OperRoleMenuExcel;
import com.epmet.service.OperRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 角色菜单关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@RestController
@RequestMapping("operrolemenu")
public class OperRoleMenuController {
@Autowired
private OperRoleMenuService operRoleMenuService;
@GetMapping("page")
public Result<PageData<OperRoleMenuDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperRoleMenuDTO> page = operRoleMenuService.page(params);
return new Result<PageData<OperRoleMenuDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperRoleMenuDTO> get(@PathVariable("id") String id){
OperRoleMenuDTO data = operRoleMenuService.get(id);
return new Result<OperRoleMenuDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperRoleMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operRoleMenuService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperRoleMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operRoleMenuService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operRoleMenuService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperRoleMenuDTO> list = operRoleMenuService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperRoleMenuExcel.class);
}
}

94
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.OperRoleUserDTO;
import com.epmet.excel.OperRoleUserExcel;
import com.epmet.service.OperRoleUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 角色用户关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@RestController
@RequestMapping("operroleuser")
public class OperRoleUserController {
@Autowired
private OperRoleUserService operRoleUserService;
@GetMapping("page")
public Result<PageData<OperRoleUserDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperRoleUserDTO> page = operRoleUserService.page(params);
return new Result<PageData<OperRoleUserDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperRoleUserDTO> get(@PathVariable("id") String id){
OperRoleUserDTO data = operRoleUserService.get(id);
return new Result<OperRoleUserDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperRoleUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operRoleUserService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperRoleUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operRoleUserService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operRoleUserService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperRoleUserDTO> list = operRoleUserService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperRoleUserExcel.class);
}
}

27
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java

@ -0,0 +1,27 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.OperLanguageEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 国际化
*
* @author Mark sunlightcs@gmail.com
*/
@Mapper
public interface OperLanguageDao extends BaseDao<OperLanguageEntity> {
OperLanguageEntity getLanguage(OperLanguageEntity entity);
void updateLanguage(OperLanguageEntity entity);
}

52
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java

@ -0,0 +1,52 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.OperMenuEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 菜单管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Mapper
public interface OperMenuDao extends BaseDao<OperMenuEntity> {
OperMenuEntity getById(@Param("id") String id, @Param("language") String language);
/**
* 查询所有菜单列表
*
* @param type 菜单类型
* @param language 语言
*/
List<OperMenuEntity> getMenuList(@Param("type") Integer type, @Param("language") String language);
/**
* 查询用户菜单列表
*
* @param userId 用户ID
* @param type 菜单类型
* @param language 语言
*/
List<OperMenuEntity> getUserMenuList(@Param("userId") String userId, @Param("type") Integer type, @Param("language") String language);
/**
* 根据父菜单查询子菜单
* @param pid 父菜单ID
*/
List<OperMenuEntity> getListPid(String pid);
}

48
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java

@ -0,0 +1,48 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.OperResourceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 资源管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Mapper
public interface OperResourceDao extends BaseDao<OperResourceEntity> {
/**
* 根据资源编码删除对应的资源
* @param code 资源编码
*/
void deleteByCode(String code);
/**
* 获取资源列表
* @param menuId 菜单ID
*/
List<OperResourceEntity> getMenuResourceList(String menuId);
/**
* 获取所有资源列表
*/
List<OperResourceEntity> getResourceList();
/**
* 获取用户资源列表
* @param userId 用户ID
*/
List<OperResourceEntity> getUserResourceList(@Param("userId") String userId);
}

24
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java

@ -0,0 +1,24 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.OperRoleEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 角色管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Mapper
public interface OperRoleDao extends BaseDao<OperRoleEntity> {
}

42
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java

@ -0,0 +1,42 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.OperRoleMenuEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 角色菜单关系
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Mapper
public interface OperRoleMenuDao extends BaseDao<OperRoleMenuEntity> {
/**
* 根据角色ID获取菜单ID列表
*/
List<String> getMenuIdList(String roleId);
/**
* 根据角色id删除角色菜单关系
* @param roleId 角色id
*/
void deleteByRoleId(String roleId);
/**
* 根据菜单id删除角色菜单关系
* @param menuId 菜单id
*/
void deleteByMenuId(String menuId);
}

45
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java

@ -0,0 +1,45 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.OperRoleUserEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 角色用户关系
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Mapper
public interface OperRoleUserDao extends BaseDao<OperRoleUserEntity> {
/**
* 根据角色ids删除角色用户关系
* @param roleIds 角色ids
*/
void deleteByRoleIds(String[] roleIds);
/**
* 根据用户id删除角色用户关系
* @param userId 用户id
*/
void deleteByUserId(String userId);
/**
* 角色ID列表
* @param userId 用户ID
*
* @return
*/
List<String> getRoleIdList(String userId);
}

49
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java

@ -0,0 +1,49 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* 国际化
*
* @author Mark sunlightcs@gmail.com
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_language")
public class OperLanguageEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 表名
*/
private String tableName;
/**
* 表主键
*/
private String tableId;
/**
* 字段名
*/
private String fieldName;
/**
* 字段值
*/
private String fieldValue;
/**
* 语言
*/
private String language;
}

67
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java

@ -0,0 +1,67 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 菜单管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_menu")
public class OperMenuEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 上级ID一级菜单为0
*/
private String pid;
/**
* 菜单名称
*/
@TableField(exist = false)
private String name;
/**
* 菜单URL
*/
private String url;
/**
* 类型 0菜单 1按钮
*/
private Integer type;
/**
* 菜单图标
*/
private String icon;
/**
* 权限标识sys:menu:save
*/
private String permissions;
/**
* 排序
*/
private Integer sort;
/**
* 上级菜单名称
*/
@TableField(exist = false)
private String parentName;
}

57
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java

@ -0,0 +1,57 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 资源管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_resource")
public class OperResourceEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 资源编码如菜单ID
*/
private String resourceCode;
/**
* 资源名称
*/
private String resourceName;
/**
* 资源URL
*/
private String resourceUrl;
/**
* 请求方式GETPOSTPUTDELETE
*/
private String resourceMethod;
/**
* 菜单标识 0非菜单资源 1菜单资源
*/
private Integer menuFlag;
/**
* 认证等级 0权限认证 1登录认证 2无需认证
*/
private Integer authLevel;
}

46
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java

@ -0,0 +1,46 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 角色管理
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_role")
public class OperRoleEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 角色名称
*/
private String name;
/**
* 备注
*/
private String remark;
/**
* 部门ID
*/
@TableField(fill = FieldFill.INSERT)
private Long deptId;
}

37
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java

@ -0,0 +1,37 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEntity;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 角色菜单关系
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_role_menu")
public class OperRoleMenuEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
private String roleId;
/**
* 菜单ID
*/
private String menuId;
}

37
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java

@ -0,0 +1,37 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 角色用户关系
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_role_user")
public class OperRoleUserEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
private String roleId;
/**
* 用户ID
*/
private String userId;
}

50
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java

@ -0,0 +1,50 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 国际化
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperLanguageExcel {
@Excel(name = "表名")
private String tableName;
@Excel(name = "表主键")
private String tableId;
@Excel(name = "字段名")
private String fieldName;
@Excel(name = "字段值")
private String fieldValue;
@Excel(name = "语言")
private String language;
}

74
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java

@ -0,0 +1,74 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 菜单管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperMenuExcel {
@Excel(name = "id")
private String id;
@Excel(name = "上级ID,一级菜单为0")
private String pid;
@Excel(name = "菜单URL")
private String url;
@Excel(name = "类型 0:菜单 1:按钮")
private Integer type;
@Excel(name = "菜单图标")
private String icon;
@Excel(name = "权限标识,如:sys:menu:save")
private String permissions;
@Excel(name = "排序")
private Integer sort;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0:未删除 1:删除")
private Integer delFlag;
@Excel(name = "创建者")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新者")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

74
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java

@ -0,0 +1,74 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 资源管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperResourceExcel {
@Excel(name = "id")
private String id;
@Excel(name = "资源编码,如菜单ID")
private String resourceCode;
@Excel(name = "资源名称")
private String resourceName;
@Excel(name = "资源URL")
private String resourceUrl;
@Excel(name = "请求方式(如:GET、POST、PUT、DELETE)")
private String resourceMethod;
@Excel(name = "菜单标识 0:非菜单资源 1:菜单资源")
private Integer menuFlag;
@Excel(name = "认证等级 0:权限认证 1:登录认证 2:无需认证")
private Integer authLevel;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0:未删除 1:删除")
private Integer delFlag;
@Excel(name = "创建者")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新者")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

65
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java

@ -0,0 +1,65 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperRoleExcel {
@Excel(name = "id")
private String id;
@Excel(name = "角色名称")
private String name;
@Excel(name = "备注")
private String remark;
@Excel(name = "部门ID")
private Long deptId;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0:未删除 1:删除")
private Integer delFlag;
@Excel(name = "创建者")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新者")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

62
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 角色菜单关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperRoleMenuExcel {
@Excel(name = "id")
private String id;
@Excel(name = "角色ID")
private String roleId;
@Excel(name = "菜单ID")
private String menuId;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0:未删除 1:删除")
private Integer delFlag;
@Excel(name = "创建者")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新者")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

62
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 角色用户关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperRoleUserExcel {
@Excel(name = "id")
private String id;
@Excel(name = "角色ID")
private String roleId;
@Excel(name = "用户ID")
private String userId;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0:未删除 1:删除")
private Integer delFlag;
@Excel(name = "创建者")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新者")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

32
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -0,0 +1,32 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.OperUserDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/3/19 9:32
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, path="/epmetuser", fallback = EpmetUserFeignClientFallback.class)
public interface EpmetUserFeignClient {
/**
*
* 根据id查询运营人员详情
*
* @param id ID
* @return com.epmet.commons.tools.utils.Result<java.util.List <com.epmet.dto.OperUserDTO>>
* @author zhaoqifeng
* @date 2020/3/19 09:28
**/
@PostMapping("/user/info/")
Result<OperUserDTO> info(@RequestBody String id);
}

21
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java

@ -0,0 +1,21 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.OperUserDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
/**
* 用户模块
* @author zhaoqifeng
* @date 2020/3/19 9:34
*/
@Component
public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
@Override
public Result<OperUserDTO> info(String id) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "info",id);
}
}

47
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 国际化
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperLanguageRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

73
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java

@ -0,0 +1,73 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.dto.OperMenuDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set;
/**
* 菜单管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperMenuRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
public void setUserMenuNavList(String userId, String app, String client, List<OperMenuDTO> menuList){
String key = RedisKeys.getUserMenuNavKey(userId, app, client, HttpContextUtils.getLanguage());
redisUtils.set(key, menuList);
}
public List<OperMenuDTO> getUserMenuNavList(String userId, String app, String client){
String key = RedisKeys.getUserMenuNavKey(userId, app, client, HttpContextUtils.getLanguage());
return (List<OperMenuDTO>)redisUtils.get(key);
}
public void setUserPermissions(String userId, String app, String client, Set<String> permsSet){
String key = RedisKeys.getUserPermissionsKey(userId, app, client);
redisUtils.set(key, permsSet);
}
public Set<String> getUserPermissions(String userId, String app, String client){
String key = RedisKeys.getUserPermissionsKey(userId, app, client);
return (Set<String>)redisUtils.get(key);
}
}

47
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 资源管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperResourceRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 角色菜单关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperRoleMenuRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperRoleRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 角色用户关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperRoleUserRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OperLanguageDTO;
import com.epmet.entity.OperLanguageEntity;
import java.util.List;
import java.util.Map;
/**
* 国际化
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperLanguageService extends BaseService<OperLanguageEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperLanguageDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperLanguageDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperLanguageDTO>
* @author generator
* @date 2020-03-18
*/
List<OperLanguageDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperLanguageDTO
* @author generator
* @date 2020-03-18
*/
OperLanguageDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperLanguageDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperLanguageDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
}

121
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.dto.OperMenuDTO;
import com.epmet.dto.form.UserInfoDto;
import com.epmet.entity.OperMenuEntity;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 菜单管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperMenuService extends BaseService<OperMenuEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperMenuDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperMenuDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperMenuDTO>
* @author generator
* @date 2020-03-18
*/
List<OperMenuDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperMenuDTO
* @author generator
* @date 2020-03-18
*/
OperMenuDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperMenuDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperMenuDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
/**
* 用户菜单列表
*
* @param userInfo 用户信息
* @param type 菜单类型
* @return java.util.List<OperMenuDTO>
*/
List<OperMenuDTO> getUserMenuList(UserInfoDto userInfo, Integer type);
/**
* 用户菜单导航
* @param userInfo 用户信息
* @return java.util.List<OperMenuDTO>
*/
List<OperMenuDTO> getUserMenuNavList(UserInfoDto userInfo);
/**
* 获取用户权限标识
* @param userInfo 用户信息
* @return java.util.Set<OperMenuDTO>
*/
Set<String> getUserPermissions(UserInfoDto userInfo);
}

95
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OperResourceDTO;
import com.epmet.entity.OperResourceEntity;
import java.util.List;
import java.util.Map;
/**
* 资源管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperResourceService extends BaseService<OperResourceEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperResourceDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperResourceDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperResourceDTO>
* @author generator
* @date 2020-03-18
*/
List<OperResourceDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperResourceDTO
* @author generator
* @date 2020-03-18
*/
OperResourceDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperResourceDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperResourceDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
}

95
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OperRoleMenuDTO;
import com.epmet.entity.OperRoleMenuEntity;
import java.util.List;
import java.util.Map;
/**
* 角色菜单关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperRoleMenuService extends BaseService<OperRoleMenuEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperRoleMenuDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperRoleMenuDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperRoleMenuDTO>
* @author generator
* @date 2020-03-18
*/
List<OperRoleMenuDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperRoleMenuDTO
* @author generator
* @date 2020-03-18
*/
OperRoleMenuDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperRoleMenuDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperRoleMenuDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
}

95
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OperRoleDTO;
import com.epmet.entity.OperRoleEntity;
import java.util.List;
import java.util.Map;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperRoleService extends BaseService<OperRoleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperRoleDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperRoleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperRoleDTO>
* @author generator
* @date 2020-03-18
*/
List<OperRoleDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperRoleDTO
* @author generator
* @date 2020-03-18
*/
OperRoleDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperRoleDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperRoleDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
}

95
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OperRoleUserDTO;
import com.epmet.entity.OperRoleUserEntity;
import java.util.List;
import java.util.Map;
/**
* 角色用户关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperRoleUserService extends BaseService<OperRoleUserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperRoleUserDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperRoleUserDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperRoleUserDTO>
* @author generator
* @date 2020-03-18
*/
List<OperRoleUserDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperRoleUserDTO
* @author generator
* @date 2020-03-18
*/
OperRoleUserDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperRoleUserDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperRoleUserDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
}

104
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.OperLanguageDao;
import com.epmet.dto.OperLanguageDTO;
import com.epmet.entity.OperLanguageEntity;
import com.epmet.redis.OperLanguageRedis;
import com.epmet.service.OperLanguageService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 国际化
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperLanguageServiceImpl extends BaseServiceImpl<OperLanguageDao, OperLanguageEntity> implements OperLanguageService {
@Autowired
private OperLanguageRedis operLanguageRedis;
@Override
public PageData<OperLanguageDTO> page(Map<String, Object> params) {
IPage<OperLanguageEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperLanguageDTO.class);
}
@Override
public List<OperLanguageDTO> list(Map<String, Object> params) {
List<OperLanguageEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperLanguageDTO.class);
}
private QueryWrapper<OperLanguageEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperLanguageEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperLanguageDTO get(String id) {
OperLanguageEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperLanguageDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperLanguageDTO dto) {
OperLanguageEntity entity = ConvertUtils.sourceToTarget(dto, OperLanguageEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperLanguageDTO dto) {
OperLanguageEntity entity = ConvertUtils.sourceToTarget(dto, OperLanguageEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

173
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java

@ -0,0 +1,173 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.enums.SuperAdminEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.TreeUtils;
import com.epmet.dao.OperMenuDao;
import com.epmet.dto.OperMenuDTO;
import com.epmet.dto.OperUserDTO;
import com.epmet.dto.form.UserInfoDto;
import com.epmet.entity.OperMenuEntity;
import com.epmet.enums.MenuTypeEnum;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.OperMenuRedis;
import com.epmet.service.OperMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 菜单管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperMenuServiceImpl extends BaseServiceImpl<OperMenuDao, OperMenuEntity> implements OperMenuService {
@Autowired
private OperMenuRedis operMenuRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<OperMenuDTO> page(Map<String, Object> params) {
IPage<OperMenuEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperMenuDTO.class);
}
@Override
public List<OperMenuDTO> list(Map<String, Object> params) {
List<OperMenuEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperMenuDTO.class);
}
private QueryWrapper<OperMenuEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperMenuEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperMenuDTO get(String id) {
OperMenuEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperMenuDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperMenuDTO dto) {
OperMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperMenuEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperMenuDTO dto) {
OperMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperMenuEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public List<OperMenuDTO> getUserMenuList(UserInfoDto userInfo, Integer type) {
List<OperMenuEntity> menuList;
Result<OperUserDTO> operUserDTOResult = epmetUserFeignClient.info(userInfo.getUserId());
//系统管理员,拥有最高权限
if(operUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){
menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage());
}else {
menuList = baseDao.getUserMenuList(userInfo.getUserId(), type, HttpContextUtils.getLanguage());
}
List<OperMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, OperMenuDTO.class);
return TreeUtils.buildTree(dtoList);
}
@Override
public List<OperMenuDTO> getUserMenuNavList(UserInfoDto userInfo) {
List<OperMenuDTO> menuList = operMenuRedis.getUserMenuNavList(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient());
if(menuList == null){
menuList = getUserMenuList(userInfo, MenuTypeEnum.MENU.value());
operMenuRedis.setUserMenuNavList(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient(), menuList);
}
return menuList;
}
@Override
public Set<String> getUserPermissions(UserInfoDto userInfo) {
//用户权限列表
Set<String> permsSet = operMenuRedis.getUserPermissions(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient());
if(permsSet != null){
return permsSet;
}
Result<OperUserDTO> operUserDTOResult = epmetUserFeignClient.info(userInfo.getUserId());
//超级管理员,拥有最高权限
List<OperMenuEntity> menuList;
if(operUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){
menuList = baseDao.getMenuList(MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage());
}else{
menuList = baseDao.getUserMenuList(userInfo.getUserId(), MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage());
}
permsSet = new HashSet<>();
for(OperMenuEntity menu : menuList){
if(StringUtils.isNotBlank(menu.getPermissions())){
permsSet.add(menu.getPermissions());
}
}
//保存到缓存
operMenuRedis.setUserPermissions(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient(), permsSet);
return permsSet;
}
}

104
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperResourceServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.OperResourceDao;
import com.epmet.dto.OperResourceDTO;
import com.epmet.entity.OperResourceEntity;
import com.epmet.redis.OperResourceRedis;
import com.epmet.service.OperResourceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 资源管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperResourceServiceImpl extends BaseServiceImpl<OperResourceDao, OperResourceEntity> implements OperResourceService {
@Autowired
private OperResourceRedis operResourceRedis;
@Override
public PageData<OperResourceDTO> page(Map<String, Object> params) {
IPage<OperResourceEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperResourceDTO.class);
}
@Override
public List<OperResourceDTO> list(Map<String, Object> params) {
List<OperResourceEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperResourceDTO.class);
}
private QueryWrapper<OperResourceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperResourceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperResourceDTO get(String id) {
OperResourceEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperResourceDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperResourceDTO dto) {
OperResourceEntity entity = ConvertUtils.sourceToTarget(dto, OperResourceEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperResourceDTO dto) {
OperResourceEntity entity = ConvertUtils.sourceToTarget(dto, OperResourceEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

104
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleMenuServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.OperRoleMenuDao;
import com.epmet.dto.OperRoleMenuDTO;
import com.epmet.entity.OperRoleMenuEntity;
import com.epmet.redis.OperRoleMenuRedis;
import com.epmet.service.OperRoleMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 角色菜单关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperRoleMenuServiceImpl extends BaseServiceImpl<OperRoleMenuDao, OperRoleMenuEntity> implements OperRoleMenuService {
@Autowired
private OperRoleMenuRedis operRoleMenuRedis;
@Override
public PageData<OperRoleMenuDTO> page(Map<String, Object> params) {
IPage<OperRoleMenuEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperRoleMenuDTO.class);
}
@Override
public List<OperRoleMenuDTO> list(Map<String, Object> params) {
List<OperRoleMenuEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperRoleMenuDTO.class);
}
private QueryWrapper<OperRoleMenuEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperRoleMenuEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperRoleMenuDTO get(String id) {
OperRoleMenuEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperRoleMenuDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperRoleMenuDTO dto) {
OperRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleMenuEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperRoleMenuDTO dto) {
OperRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleMenuEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

104
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.OperRoleDao;
import com.epmet.dto.OperRoleDTO;
import com.epmet.entity.OperRoleEntity;
import com.epmet.redis.OperRoleRedis;
import com.epmet.service.OperRoleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperRoleServiceImpl extends BaseServiceImpl<OperRoleDao, OperRoleEntity> implements OperRoleService {
@Autowired
private OperRoleRedis operRoleRedis;
@Override
public PageData<OperRoleDTO> page(Map<String, Object> params) {
IPage<OperRoleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperRoleDTO.class);
}
@Override
public List<OperRoleDTO> list(Map<String, Object> params) {
List<OperRoleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperRoleDTO.class);
}
private QueryWrapper<OperRoleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperRoleEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperRoleDTO get(String id) {
OperRoleEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperRoleDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperRoleDTO dto) {
OperRoleEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperRoleDTO dto) {
OperRoleEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

104
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleUserServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.OperRoleUserDao;
import com.epmet.dto.OperRoleUserDTO;
import com.epmet.entity.OperRoleUserEntity;
import com.epmet.redis.OperRoleUserRedis;
import com.epmet.service.OperRoleUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 角色用户关系
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperRoleUserServiceImpl extends BaseServiceImpl<OperRoleUserDao, OperRoleUserEntity> implements OperRoleUserService {
@Autowired
private OperRoleUserRedis operRoleUserRedis;
@Override
public PageData<OperRoleUserDTO> page(Map<String, Object> params) {
IPage<OperRoleUserEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperRoleUserDTO.class);
}
@Override
public List<OperRoleUserDTO> list(Map<String, Object> params) {
List<OperRoleUserEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperRoleUserDTO.class);
}
private QueryWrapper<OperRoleUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperRoleUserEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperRoleUserDTO get(String id) {
OperRoleUserEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperRoleUserDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperRoleUserDTO dto) {
OperRoleUserEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleUserEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperRoleUserDTO dto) {
OperRoleUserEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleUserEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

102
epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml

@ -0,0 +1,102 @@
server:
port: @server.port@
servlet:
context-path: /oper/access
spring:
application:
name: oper-access-server
#环境 dev|test|prod
profiles:
active: dev
messages:
encoding: UTF-8
basename: i18n/messages,i18n/messages_common
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
redis:
database: @spring.redis.index@
host: @spring.redis.host@
port: @spring.redis.port@
password: @spring.redis.password@
timeout: 30s
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: @spring.datasource.druid.url@
username: @spring.datasource.druid.username@
password: @spring.datasource.druid.password@
cloud:
nacos:
discovery:
server-addr: @nacos.server-addr@
#nacos的命名空间ID,默认是public
namespace: @nacos.discovery.namespace@
#不把自己注册到注册中心的地址
register-enabled: @nacos.register-enabled@
ip: @nacos.ip@
config:
enabled: @nacos.config-enabled@
server-addr: @nacos.server-addr@
namespace: @nacos.config.namespace@
group: @nacos.config.group@
file-extension: yaml
#指定共享配置,且支持动态刷新
# ext-config:
# - data-id: datasource.yaml
# group: ${spring.cloud.nacos.config.group}
# refresh: true
# - data-id: common.yaml
# group: ${spring.cloud.nacos.config.group}
# refresh: true
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.epmet.entity
global-config:
#数据库相关配置
db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: ID_WORKER
banner: false
#原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
feign:
hystrix:
enabled: true
client:
config:
default:
loggerLevel: BASIC
httpclient:
enabled: true
max-connections: 200
max-connections-per-route: 50
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages.properties

@ -0,0 +1 @@
#Default

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_en_US.properties

@ -0,0 +1 @@
#English

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_CN.properties

@ -0,0 +1 @@
#\u7B80\u4F53\u4E2D\u6587

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_TW.properties

@ -0,0 +1 @@
#\u7E41\u4F53\u4E2D\u6587

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation.properties

@ -0,0 +1 @@
#Default

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_en_US.properties

@ -0,0 +1 @@
#English

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_CN.properties

@ -0,0 +1 @@
#\u7B80\u4F53\u4E2D\u6587

1
epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_TW.properties

@ -0,0 +1 @@
#\u7E41\u4F53\u4E2D\u6587

159
epmet-module/oper-access/oper-access-server/src/main/resources/logback-spring.xml

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<property name="log.path" value="logs/oper-access"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--1. 输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--2. 输出到文档-->
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/debug.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/info.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/warn.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/error.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
</configuration>

16
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperLanguageDao.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperLanguageDao">
<select id="getLanguage" resultType="com.epmet.entity.OperLanguageEntity">
select * from oper_language
where table_name=#{tableName} and table_id=#{tableId} and field_name=#{fieldName} and language=#{language}
</select>
<select id="updateLanguage">
update oper_language set field_value=#{fieldValue}
where table_name=#{tableName} and table_id=#{tableId} and field_name=#{fieldName} and language=#{language}
</select>
</mapper>

42
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperMenuDao">
<select id="getById" resultType="com.epmet.entity.OperMenuEntity">
select t1.*,
(select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name'
and lang.table_id=t1.pid and lang.language=#{language}) as parentName,
(select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
from oper_menu t1
where t1.id = #{id} and t1.del_flag = 0
</select>
<select id="getMenuList" resultType="com.epmet.entity.OperMenuEntity">
select t1.*, (select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
from oper_menu t1 where t1.del_flag = 0
<if test="type != null">
and t1.type = #{type}
</if>
order by t1.sort asc
</select>
<select id="getUserMenuList" resultType="com.epmet.entity.OperMenuEntity">
select t3.*, (select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name'
and lang.table_id=t3.id and lang.language=#{language}) as name from oper_role_user t1
left join oper_role_menu t2 on t1.role_id = t2.role_id
left join oper_menu t3 on t2.menu_id = t3.id
where t1.user_id = #{userId} and t3.del_flag = 0
<if test="type != null">
and t3.type = #{type}
</if>
order by t3.sort asc
</select>
<select id="getListPid" resultType="com.epmet.entity.OperMenuEntity">
select * from oper_menu where del_flag = 0 and pid = #{value}
</select>
</mapper>

25
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperResourceDao.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperResourceDao">
<delete id="deleteByCode">
delete from oper_resource where resource_code = #{value}
</delete>
<select id="getMenuResourceList" resultType="com.epmet.entity.OperResourceEntity">
select resource_url, resource_method from oper_resource where resource_code = #{value} order by create_date asc
</select>
<select id="getResourceList" resultType="com.epmet.entity.OperResourceEntity">
select resource_url, resource_method, auth_level from oper_resource order by auth_level desc
</select>
<select id="getUserResourceList" resultType="com.epmet.entity.OperResourceEntity">
select t3.resource_url, t3.resource_method from oper_role_user t1
left join oper_role_menu t2 on t1.role_id = t2.role_id
inner join oper_resource t3 on t2.menu_id = t3.resource_code
where t1.user_id = #{userId}
</select>
</mapper>

6
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleDao.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperRoleDao">
</mapper>

18
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperRoleMenuDao">
<select id="getMenuIdList" resultType="long">
select menu_id from oper_role_menu where role_id = #{value}
</select>
<delete id="deleteByRoleId">
delete from oper_role_menu where role_id = #{value}
</delete>
<delete id="deleteByMenuId">
delete from oper_role_menu where menu_id = #{value}
</delete>
</mapper>

21
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleUserDao.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperRoleUserDao">
<delete id="deleteByRoleIds">
delete from oper_role_user where role_id in
<foreach item="roleId" collection="array" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<delete id="deleteByUserId">
delete from oper_role_user where user_id = #{value}
</delete>
<select id="getRoleIdList" resultType="long">
select role_id from oper_role_user where user_id = #{value}
</select>
</mapper>

20
epmet-module/oper-access/pom.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>epmet-module</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>oper-access</artifactId>
<packaging>pom</packaging>
<modules>
<module>oper-access-client</module>
<module>oper-access-server</module>
</modules>
</project>

1
epmet-module/pom.xml

@ -23,6 +23,7 @@
<module>oper-crm</module>
<module>resi-guide</module>
<module>gov-org</module>
<module>oper-access</module>
</modules>
</project>

126
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperUserDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 姓名
*/
private String realName;
/**
* 密码
*/
private String password;
/**
* 头像
*/
private String headUrl;
/**
* 性别 0 1 2保密
*/
private Integer gender;
/**
* 邮箱
*/
private String email;
/**
* 手机号
*/
private String phone;
/**
* 微信openId
*/
private String wxOpenId;
/**
* 部门ID
*/
private Long deptId;
/**
* 超级管理员 0 1
*/
private Integer superAdmin;
/**
* 状态 0停用 1正常
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 删除标识
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

109
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java

@ -0,0 +1,109 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.OperUserDTO;
import com.epmet.excel.OperUserExcel;
import com.epmet.service.OperUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@RestController
@RequestMapping("user")
public class OperUserController {
@Autowired
private OperUserService operUserService;
@GetMapping("page")
public Result<PageData<OperUserDTO>> page(@RequestParam Map<String, Object> params){
PageData<OperUserDTO> page = operUserService.page(params);
return new Result<PageData<OperUserDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<OperUserDTO> get(@PathVariable("id") String id){
OperUserDTO data = operUserService.get(id);
return new Result<OperUserDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody OperUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
operUserService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody OperUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
operUserService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
operUserService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<OperUserDTO> list = operUserService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, OperUserExcel.class);
}
/**
* 获取运营人员信息
* @param id 主键
* @return OperUserDTO
* @author zhaoqifeng
*/
@PostMapping("info")
public Result<OperUserDTO> info(@RequestBody String id){
OperUserDTO data = operUserService.getOperUserInfoById(id);
return new Result<OperUserDTO>().ok(data);
}
}

39
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/OperUserDao.java

@ -0,0 +1,39 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.OperUserDTO;
import com.epmet.entity.OperUserEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Mapper
public interface OperUserDao extends BaseDao<OperUserEntity> {
/**
* 根据id查询运营人员信息
* @param id
* @return OperUserDTO
*/
OperUserDTO selectOperUserInfoById(String id);
}

96
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("oper_user")
public class OperUserEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 姓名
*/
private String realName;
/**
* 密码
*/
private String password;
/**
* 头像
*/
private String headUrl;
/**
* 性别 0 1 2保密
*/
private Integer gender;
/**
* 邮箱
*/
private String email;
/**
* 手机号
*/
private String phone;
/**
* 微信openId
*/
private String wxOpenId;
/**
* 部门ID
*/
private Long deptId;
/**
* 超级管理员 0 1
*/
private Integer superAdmin;
/**
* 状态 0停用 1正常
*/
private Integer status;
/**
* 备注
*/
private String remark;
}

89
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/OperUserExcel.java

@ -0,0 +1,89 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class OperUserExcel {
@Excel(name = "id")
private Long id;
@Excel(name = "姓名")
private String realName;
@Excel(name = "密码")
private String password;
@Excel(name = "头像")
private String headUrl;
@Excel(name = "性别 0:男 1:女 2:保密")
private Integer gender;
@Excel(name = "邮箱")
private String email;
@Excel(name = "手机号")
private String phone;
@Excel(name = "微信openId")
private String wxOpenId;
@Excel(name = "部门ID")
private Long deptId;
@Excel(name = "超级管理员 0:否 1:是")
private Integer superAdmin;
@Excel(name = "状态 0:停用 1:正常")
private Integer status;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标识")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Component
public class OperUserRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

102
epmet-user/epmet-user-server/src/main/java/com/epmet/service/OperUserService.java

@ -0,0 +1,102 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OperUserDTO;
import com.epmet.entity.OperUserEntity;
import java.util.List;
import java.util.Map;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
public interface OperUserService extends BaseService<OperUserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OperUserDTO>
* @author generator
* @date 2020-03-18
*/
PageData<OperUserDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OperUserDTO>
* @author generator
* @date 2020-03-18
*/
List<OperUserDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OperUserDTO
* @author generator
* @date 2020-03-18
*/
OperUserDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(OperUserDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(OperUserDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
/**
* 根据id查询运营人员信息
* @param id 主键id
* @return
*/
OperUserDTO getOperUserInfoById(String id);
}

111
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java

@ -0,0 +1,111 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.OperUserDao;
import com.epmet.dto.OperUserDTO;
import com.epmet.entity.OperUserEntity;
import com.epmet.redis.OperUserRedis;
import com.epmet.service.OperUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 运营人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Service
public class OperUserServiceImpl extends BaseServiceImpl<OperUserDao, OperUserEntity> implements OperUserService {
@Autowired
private OperUserRedis operUserRedis;
@Autowired
private OperUserDao operUserDao;
@Override
public PageData<OperUserDTO> page(Map<String, Object> params) {
IPage<OperUserEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OperUserDTO.class);
}
@Override
public List<OperUserDTO> list(Map<String, Object> params) {
List<OperUserEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OperUserDTO.class);
}
private QueryWrapper<OperUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OperUserEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OperUserDTO get(String id) {
OperUserEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OperUserDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OperUserDTO dto) {
OperUserEntity entity = ConvertUtils.sourceToTarget(dto, OperUserEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OperUserDTO dto) {
OperUserEntity entity = ConvertUtils.sourceToTarget(dto, OperUserEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public OperUserDTO getOperUserInfoById(String id) {
return operUserDao.selectOperUserInfoById(id);
}
}

37
epmet-user/epmet-user-server/src/main/resources/mapper/OperUserDao.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OperUserDao">
<resultMap type="com.epmet.entity.OperUserEntity" id="operUserMap">
<result property="id" column="id"/>
<result property="realName" column="real_name"/>
<result property="password" column="password"/>
<result property="headUrl" column="head_url"/>
<result property="gender" column="gender"/>
<result property="email" column="email"/>
<result property="phone" column="phone"/>
<result property="wxOpenId" column="WX_OPEN_ID"/>
<result property="deptId" column="dept_id"/>
<result property="superAdmin" column="super_admin"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectOperUserInfoById" resultType="com.epmet.dto.OperUserDTO" parameterType="java.lang.String">
SELECT
*
FROM
oper_user
WHERE
id = #{id}
</select>
</mapper>
Loading…
Cancel
Save