diff --git a/README.md b/README.md
index 54b785f5..d9a0ec6b 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,9 @@
## 文档视频
-[文档视频 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
+[ 配套文档 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
+
+[ 配套视频 bilibili.com/video/BV12t411B7e9](https://www.bilibili.com/video/BV12t411B7e9)
[PIGX 在线体验 pigx.pig4cloud.com](http://pigx.pig4cloud.com)
@@ -23,7 +25,7 @@
## 微信群 [禁广告]
-![1628762721](https://minio.pigx.vip/oss/1628762721.png)
+![](https://minio.pigx.vip/oss/1628762721.png)
## 快速开始
@@ -35,7 +37,7 @@
| Spring Cloud | 2020.0.4 |
| Spring Cloud Alibaba | 2021.1 |
| Spring Security OAuth2 | 2.3.6 |
-| Mybatis Plus | 3.4.3.5 |
+| Mybatis Plus | 3.4.3.4 |
| hutool | 5.7.15 |
| Avue | 2.6.18 |
diff --git a/db/pig_codegen.sql b/db/pig_codegen.sql
index 4205d1c2..6602d108 100644
--- a/db/pig_codegen.sql
+++ b/db/pig_codegen.sql
@@ -13,11 +13,10 @@ DROP TABLE IF EXISTS `gen_datasource_conf`;
CREATE TABLE `gen_datasource_conf` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据源名称',
- `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'jdbc-url',
+ `url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'jdbc-url',
`username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名',
`password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '密码',
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
- `driver_class_name` varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据驱动名称',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
@@ -54,4 +53,4 @@ CREATE TABLE `gen_form_conf` (
BEGIN;
COMMIT;
-SET FOREIGN_KEY_CHECKS = 1;
\ No newline at end of file
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/pig-auth/pom.xml b/pig-auth/pom.xml
index 762edf98..e952133d 100755
--- a/pig-auth/pom.xml
+++ b/pig-auth/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig
- 3.4.0
+ 3.4.1
pig-auth
diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/config/AuthorizationServerConfig.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/config/AuthorizationServerConfig.java
index 1ddee299..a57ed1d6 100755
--- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/config/AuthorizationServerConfig.java
+++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/config/AuthorizationServerConfig.java
@@ -21,6 +21,7 @@ import com.pig4cloud.pig.common.security.component.PigWebResponseExceptionTransl
import com.pig4cloud.pig.common.security.grant.ResourceOwnerCustomeAppTokenGranter;
import com.pig4cloud.pig.common.security.service.PigClientDetailsService;
import com.pig4cloud.pig.common.security.service.PigCustomTokenServices;
+import com.pig4cloud.pig.common.security.service.PigUser;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.context.annotation.Bean;
@@ -101,6 +102,17 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
return (accessToken, authentication) -> {
final Map additionalInfo = new HashMap<>(4);
additionalInfo.put(SecurityConstants.DETAILS_LICENSE, SecurityConstants.PROJECT_LICENSE);
+ String clientId = authentication.getOAuth2Request().getClientId();
+ additionalInfo.put(SecurityConstants.CLIENT_ID, clientId);
+
+ // 客户端模式不返回具体用户信息
+ if (SecurityConstants.CLIENT_CREDENTIALS.equals(authentication.getOAuth2Request().getGrantType())) {
+ ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
+ return accessToken;
+ }
+
+ PigUser pigUser = (PigUser) authentication.getUserAuthentication().getPrincipal();
+ additionalInfo.put(SecurityConstants.DETAILS_USER, pigUser);
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
return accessToken;
};
diff --git a/pig-common/pig-common-bom/pom.xml b/pig-common/pig-common-bom/pom.xml
index 5312c154..7c352a32 100644
--- a/pig-common/pig-common-bom/pom.xml
+++ b/pig-common/pig-common-bom/pom.xml
@@ -6,7 +6,7 @@
com.pig4cloud
pig-common-bom
- 3.4.0
+ 3.4.1
pom
pig-common-bom
@@ -15,7 +15,7 @@
${project.version}
- 2.5.5
+ 2.5.6
UTF-8
2.1.8.RELEASE
1.8
diff --git a/pig-common/pig-common-core/pom.xml b/pig-common/pig-common-core/pom.xml
index 4bb31f2a..f2b527ac 100755
--- a/pig-common/pig-common-core/pom.xml
+++ b/pig-common/pig-common-core/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-core
diff --git a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RedisTemplateConfiguration.java b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RedisTemplateConfiguration.java
index 10cb84dd..eb77f0ba 100755
--- a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RedisTemplateConfiguration.java
+++ b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RedisTemplateConfiguration.java
@@ -23,8 +23,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
-import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.data.redis.serializer.RedisSerializer;
/**
* @author lengleng
@@ -38,10 +37,10 @@ public class RedisTemplateConfiguration {
@Bean
public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
RedisTemplate redisTemplate = new RedisTemplate<>();
- redisTemplate.setKeySerializer(new StringRedisSerializer());
- redisTemplate.setHashKeySerializer(new StringRedisSerializer());
- redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
- redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer());
+ redisTemplate.setKeySerializer(RedisSerializer.string());
+ redisTemplate.setHashKeySerializer(RedisSerializer.string());
+ redisTemplate.setValueSerializer(RedisSerializer.java());
+ redisTemplate.setHashValueSerializer(RedisSerializer.java());
redisTemplate.setConnectionFactory(factory);
return redisTemplate;
}
diff --git a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java
index 3bffc353..6423318a 100755
--- a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java
+++ b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java
@@ -95,30 +95,15 @@ public interface SecurityConstants {
String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";
/**
- * 用户ID字段
+ * 用户信息
*/
- String DETAILS_USER_ID = "user_id";
-
- /**
- * 用户名字段
- */
- String DETAILS_USERNAME = "username";
-
- /**
- * 用户部门字段
- */
- String DETAILS_DEPT_ID = "dept_id";
+ String DETAILS_USER = "user_info";
/**
* 协议字段
*/
String DETAILS_LICENSE = "license";
- /**
- * 用户数据权限信息
- */
- String DETAILS_USER_DATA_SCOPE = "user_data_scope";
-
/**
* 验证码有效期,默认 60秒
*/
@@ -129,4 +114,14 @@ public interface SecurityConstants {
*/
String CODE_SIZE = "6";
+ /**
+ * 客户端模式
+ */
+ String CLIENT_CREDENTIALS = "client_credentials";
+
+ /**
+ * 客户端ID
+ */
+ String CLIENT_ID = "clientId";
+
}
diff --git a/pig-common/pig-common-datasource/pom.xml b/pig-common/pig-common-datasource/pom.xml
index 7bf9f85d..5e23fde2 100644
--- a/pig-common/pig-common-datasource/pom.xml
+++ b/pig-common/pig-common-datasource/pom.xml
@@ -21,7 +21,7 @@
pig-common
com.pig4cloud
- 3.4.0
+ 3.4.1
4.0.0
diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java
index 7724cd91..9f8e81a8 100644
--- a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java
+++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java
@@ -61,9 +61,7 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
String username = rs.getString(DataSourceConstants.DS_USER_NAME);
String password = rs.getString(DataSourceConstants.DS_USER_PWD);
String url = rs.getString(DataSourceConstants.DS_JDBC_URL);
- String driverClassName = rs.getString(DataSourceConstants.DS_DRIVER_CLASS_NAME);
DataSourceProperty property = new DataSourceProperty();
- property.setDriverClassName(driverClassName);
property.setUsername(username);
property.setLazy(true);
property.setPassword(stringEncryptor.decrypt(password));
@@ -77,7 +75,6 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
property.setPassword(properties.getPassword());
property.setUrl(properties.getUrl());
property.setLazy(true);
- property.setDriverClassName(property.getDriverClassName());
map.put(DataSourceConstants.DS_MASTER, property);
return map;
}
diff --git a/pig-common/pig-common-feign/pom.xml b/pig-common/pig-common-feign/pom.xml
index 54446f1f..81a4cae9 100755
--- a/pig-common/pig-common-feign/pom.xml
+++ b/pig-common/pig-common-feign/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
4.0.0
diff --git a/pig-common/pig-common-job/pom.xml b/pig-common/pig-common-job/pom.xml
index 9e4effd9..26ba8394 100755
--- a/pig-common/pig-common-job/pom.xml
+++ b/pig-common/pig-common-job/pom.xml
@@ -23,7 +23,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-job
diff --git a/pig-common/pig-common-log/pom.xml b/pig-common/pig-common-log/pom.xml
index a5808e86..c12e81b6 100755
--- a/pig-common/pig-common-log/pom.xml
+++ b/pig-common/pig-common-log/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-log
diff --git a/pig-common/pig-common-mybatis/pom.xml b/pig-common/pig-common-mybatis/pom.xml
index 13c68b12..6752f6c3 100755
--- a/pig-common/pig-common-mybatis/pom.xml
+++ b/pig-common/pig-common-mybatis/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-mybatis
diff --git a/pig-common/pig-common-security/pom.xml b/pig-common/pig-common-security/pom.xml
index cfa1d1a1..944ef6c5 100755
--- a/pig-common/pig-common-security/pom.xml
+++ b/pig-common/pig-common-security/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-security
diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigRedisTokenStore.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigRedisTokenStore.java
index b0bfffd1..947aae61 100644
--- a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigRedisTokenStore.java
+++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigRedisTokenStore.java
@@ -93,7 +93,7 @@ public class PigRedisTokenStore implements TokenStore {
}
private byte[] serializeKey(String object) {
- return serialize(object);
+ return serialize(prefix + object);
}
private OAuth2AccessToken deserializeAccessToken(byte[] bytes) {
diff --git a/pig-common/pig-common-swagger/pom.xml b/pig-common/pig-common-swagger/pom.xml
index 420b4047..3c510b00 100644
--- a/pig-common/pig-common-swagger/pom.xml
+++ b/pig-common/pig-common-swagger/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-swagger
diff --git a/pig-common/pig-common-test/pom.xml b/pig-common/pig-common-test/pom.xml
index dcd30061..f57d6c9c 100755
--- a/pig-common/pig-common-test/pom.xml
+++ b/pig-common/pig-common-test/pom.xml
@@ -6,7 +6,7 @@
com.pig4cloud
pig-common
- 3.4.0
+ 3.4.1
pig-common-test
diff --git a/pig-common/pom.xml b/pig-common/pom.xml
index 5d117eb1..1260f587 100755
--- a/pig-common/pom.xml
+++ b/pig-common/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig
- 3.4.0
+ 3.4.1
pig-common
diff --git a/pig-gateway/pom.xml b/pig-gateway/pom.xml
index 0690d7e0..218b426a 100755
--- a/pig-gateway/pom.xml
+++ b/pig-gateway/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig
- 3.4.0
+ 3.4.1
pig-gateway
diff --git a/pig-register/pom.xml b/pig-register/pom.xml
index 9582a5e1..d6ab5d2b 100755
--- a/pig-register/pom.xml
+++ b/pig-register/pom.xml
@@ -18,7 +18,7 @@
com.pig4cloud
pig
- 3.4.0
+ 3.4.1
pig-register
diff --git a/pig-upms/pig-upms-api/pom.xml b/pig-upms/pig-upms-api/pom.xml
index 9c3ec04f..e0c91948 100755
--- a/pig-upms/pig-upms-api/pom.xml
+++ b/pig-upms/pig-upms-api/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-upms
- 3.4.0
+ 3.4.1
pig-upms-api
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java
index 929fa708..8b518f84 100755
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java
@@ -53,8 +53,8 @@ public interface RemoteUserService {
* @param from 调用标志
* @return R
*/
- @GetMapping("/app/info/{mobile}")
- R infoByMobile(@PathVariable("mobile") String mobile, @RequestHeader(SecurityConstants.FROM) String from);
+ @GetMapping("/app/info/{phone}")
+ R infoByMobile(@PathVariable("phone") String phone, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 根据部门id,查询对应的用户 id 集合
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/fallback/RemoteUserServiceFallbackImpl.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/fallback/RemoteUserServiceFallbackImpl.java
index 4e70ccc5..0110ac8f 100755
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/fallback/RemoteUserServiceFallbackImpl.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/fallback/RemoteUserServiceFallbackImpl.java
@@ -56,8 +56,8 @@ public class RemoteUserServiceFallbackImpl implements RemoteUserService {
* @return R
*/
@Override
- public R infoByMobile(String mobile, String from) {
- log.error("feign 查询用户信息失败手机号码:{}", mobile, cause);
+ public R infoByMobile(String phone, String from) {
+ log.error("feign 查询用户信息失败手机号码:{}", phone, cause);
return null;
}
diff --git a/pig-upms/pig-upms-biz/pom.xml b/pig-upms/pig-upms-biz/pom.xml
index ad4ca62e..98648f38 100644
--- a/pig-upms/pig-upms-biz/pom.xml
+++ b/pig-upms/pig-upms-biz/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig-upms
- 3.4.0
+ 3.4.1
pig-upms-biz
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java
index f550948b..e1f005c6 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java
@@ -39,11 +39,11 @@ public class AppController {
* @return 用户信息
*/
@Inner
- @GetMapping("/info/{mobile}")
- public R infoByMobile(@PathVariable String mobile) {
- SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getPhone, mobile));
+ @GetMapping("/info/{phone}")
+ public R infoByMobile(@PathVariable String phone) {
+ SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getPhone, phone));
if (user == null) {
- return R.failed(String.format("用户信息为空 %s", mobile));
+ return R.failed(String.format("用户信息为空 %s", phone));
}
return R.ok(userService.getUserInfo(user));
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java
index f3ff602f..eda0cc43 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java
@@ -16,8 +16,6 @@
package com.pig4cloud.pig.admin.controller;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
import com.pig4cloud.pig.admin.api.entity.SysMenu;
import com.pig4cloud.pig.admin.service.SysMenuService;
import com.pig4cloud.pig.common.core.util.R;
@@ -29,6 +27,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
+import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;
@@ -52,9 +51,9 @@ public class MenuController {
@GetMapping
public R getUserMenu(Integer parentId) {
// 获取符合条件的菜单
- Set sysMenuList = sysMenuService
- .findMenuByRoleId(CollUtil.join(SecurityUtils.getRoles(), StrUtil.COMMA));
- return R.ok(sysMenuService.filterMenu(sysMenuList, parentId));
+ Set menuSet = SecurityUtils.getRoles().stream().map(sysMenuService::findMenuByRoleId)
+ .flatMap(Collection::stream).collect(Collectors.toSet());
+ return R.ok(sysMenuService.filterMenu(menuSet, parentId));
}
/**
@@ -75,8 +74,8 @@ public class MenuController {
*/
@GetMapping("/tree/{roleId}")
public R getRoleTree(@PathVariable Integer roleId) {
- return R.ok(sysMenuService.findMenuByRoleId(String.valueOf(roleId)).stream().map(SysMenu::getMenuId)
- .collect(Collectors.toList()));
+ return R.ok(
+ sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).collect(Collectors.toList()));
}
/**
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java
index 370c1609..dead8ee1 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java
@@ -47,7 +47,7 @@ public class OauthClientDetailsController {
/**
* 通过ID查询
- * @param id clientId
+ * @param clientId 客户端id
* @return SysOauthClientDetails
*/
@GetMapping("/{clientId}")
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java
index 0ace12b4..3d45e9d5 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java
@@ -38,6 +38,6 @@ public interface SysMenuMapper extends BaseMapper {
* @param roleId 角色ID
* @return
*/
- Set listMenusByRoleId(String roleIds);
+ Set listMenusByRoleId(Integer roleIds);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppServiceImpl.java
index 2c044471..87fdf283 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppServiceImpl.java
@@ -50,29 +50,28 @@ public class AppServiceImpl implements AppService {
/**
* 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端
- * @param mobile mobile
+ * @param phone 手机号
* @return code
*/
@Override
- public R sendSmsCode(String mobile) {
- List userList = userMapper
- .selectList(Wrappers.query().lambda().eq(SysUser::getPhone, mobile));
+ public R sendSmsCode(String phone) {
+ List userList = userMapper.selectList(Wrappers.query().lambda().eq(SysUser::getPhone, phone));
if (CollUtil.isEmpty(userList)) {
- log.info("手机号未注册:{}", mobile);
+ log.info("手机号未注册:{}", phone);
return R.ok(Boolean.FALSE, "手机号未注册");
}
- Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + mobile);
+ Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + phone);
if (codeObj != null) {
- log.info("手机号验证码未过期:{},{}", mobile, codeObj);
+ log.info("手机号验证码未过期:{},{}", phone, codeObj);
return R.ok(Boolean.FALSE, "验证码发送过频繁");
}
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
- log.info("手机号生成验证码成功:{},{}", mobile, code);
- redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + mobile, code, SecurityConstants.CODE_TIME,
+ log.info("手机号生成验证码成功:{},{}", phone, code);
+ redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + phone, code, SecurityConstants.CODE_TIME,
TimeUnit.SECONDS);
return R.ok(Boolean.TRUE, code);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java
index 2ecfa9f1..ecea1fca 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java
@@ -35,10 +35,10 @@ public interface SysMenuService extends IService {
/**
* 通过角色编号查询URL 权限
- * @param roleIds 角色ID
+ * @param roleId 角色ID
* @return 菜单列表
*/
- Set findMenuByRoleId(String roleIds);
+ Set findMenuByRoleId(Integer roleId);
/**
* 级联删除菜单
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java
index 23775d43..bdbcb8bb 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java
@@ -61,9 +61,9 @@ public class SysMenuServiceImpl extends ServiceImpl impl
private final SysRoleMenuMapper sysRoleMenuMapper;
@Override
- @Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleIds + '_menu'", unless = "#result == null")
- public Set findMenuByRoleId(String roleIds) {
- return baseMapper.listMenusByRoleId(roleIds);
+ @Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")
+ public Set findMenuByRoleId(Integer roleId) {
+ return baseMapper.listMenusByRoleId(roleId);
}
/**
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java
index b7116aac..3864f033 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java
@@ -25,11 +25,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pig.admin.api.dto.UserDTO;
import com.pig4cloud.pig.admin.api.dto.UserInfo;
-import com.pig4cloud.pig.admin.api.entity.SysDept;
-import com.pig4cloud.pig.admin.api.entity.SysMenu;
-import com.pig4cloud.pig.admin.api.entity.SysRole;
-import com.pig4cloud.pig.admin.api.entity.SysUser;
-import com.pig4cloud.pig.admin.api.entity.SysUserRole;
+import com.pig4cloud.pig.admin.api.entity.*;
import com.pig4cloud.pig.admin.api.vo.UserExcelVO;
import com.pig4cloud.pig.admin.api.vo.UserVO;
import com.pig4cloud.pig.admin.mapper.SysDeptMapper;
@@ -55,10 +51,7 @@ import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import java.time.LocalDateTime;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -118,10 +111,9 @@ public class SysUserServiceImpl extends ServiceImpl impl
List roleIds = roleList.stream().map(SysRole::getRoleId).collect(Collectors.toList());
userInfo.setRoles(ArrayUtil.toArray(roleIds, Integer.class));
// 设置权限列表(menu.permission)
- Set permissions = sysMenuService.findMenuByRoleId(CollUtil.join(roleIds, StrUtil.COMMA)).stream()
- .filter(m -> MenuTypeEnum.BUTTON.getType().equals(m.getType()))
- .filter(m -> StrUtil.isNotBlank(m.getPermission())).map(SysMenu::getPermission)
- .collect(Collectors.toSet());
+ Set permissions = roleIds.stream().map(sysMenuService::findMenuByRoleId).flatMap(Collection::stream)
+ .filter(m -> MenuTypeEnum.BUTTON.getType().equals(m.getType())).map(SysMenu::getPermission)
+ .filter(StrUtil::isNotBlank).collect(Collectors.toSet());
userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class));
return userInfo;
diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml
index 1aa98825..6e4d6d24 100644
--- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml
+++ b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml
@@ -43,7 +43,7 @@
LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
WHERE
sys_menu.del_flag = 0
- AND sys_role_menu.role_id IN (#{roleIds})
+ AND sys_role_menu.role_id = #{roleId}
ORDER BY
sys_menu.sort DESC
diff --git a/pig-upms/pom.xml b/pig-upms/pom.xml
index ac60c482..f83d532e 100755
--- a/pig-upms/pom.xml
+++ b/pig-upms/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig
- 3.4.0
+ 3.4.1
pig-upms
diff --git a/pig-visual/pig-codegen/pom.xml b/pig-visual/pig-codegen/pom.xml
index c07a6a9d..02a3e61b 100755
--- a/pig-visual/pig-codegen/pom.xml
+++ b/pig-visual/pig-codegen/pom.xml
@@ -22,7 +22,7 @@
com.pig4cloud
pig-visual
- 3.4.0
+ 3.4.1
pig-codegen
diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java
index 96769ad2..8185b28a 100755
--- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java
+++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java
@@ -59,11 +59,6 @@ public class GenDatasourceConf extends BaseEntity {
*/
private String password;
- /**
- * 驱动类型
- */
- private String driverClassName;
-
/**
* 删除标记
*/
diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java
index 2886cb05..f9c1a99c 100755
--- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java
+++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java
@@ -119,7 +119,6 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl
com.pig4cloud
pig-visual
- 3.4.0
+ 3.4.1
pig-monitor
diff --git a/pig-visual/pig-sentinel-dashboard/pom.xml b/pig-visual/pig-sentinel-dashboard/pom.xml
index c8e97f08..d2afc724 100755
--- a/pig-visual/pig-sentinel-dashboard/pom.xml
+++ b/pig-visual/pig-sentinel-dashboard/pom.xml
@@ -6,7 +6,7 @@
com.pig4cloud
pig-visual
- 3.4.0
+ 3.4.1
pig-sentinel-dashboard
diff --git a/pig-visual/pig-xxl-job-admin/pom.xml b/pig-visual/pig-xxl-job-admin/pom.xml
index 2bcab3dc..1cd5cd2b 100644
--- a/pig-visual/pig-xxl-job-admin/pom.xml
+++ b/pig-visual/pig-xxl-job-admin/pom.xml
@@ -4,7 +4,7 @@
com.pig4cloud
pig-visual
- 3.4.0
+ 3.4.1
pig-xxl-job-admin
diff --git a/pig-visual/pom.xml b/pig-visual/pom.xml
index 105d387a..7bcc6f10 100755
--- a/pig-visual/pom.xml
+++ b/pig-visual/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloud
pig
- 3.4.0
+ 3.4.1
pig-visual
diff --git a/pom.xml b/pom.xml
index 64f3167a..d9ecd0ca 100755
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
com.pig4cloud
pig
${project.artifactId}
- 3.4.0
+ 3.4.1
pom
https://www.pig4cloud.com
@@ -33,8 +33,8 @@
UTF-8
1.8
1.8
- 2.5.2
- 5.7.15
+ 2.5.4
+ 5.7.16
3.4.1
2.2.1
1.7