|
@@ -47,7 +47,7 @@ public class AdminRoleLogic {
|
|
|
.eq(StringUtils.isNotBlank(adminCompanyId), AdminRole::getCompanyId, adminCompanyId)
|
|
|
.eq(Objects.nonNull(type), AdminRole::getType, type)
|
|
|
.in(CollectionUtils.isNotEmpty(companyIds), AdminRole::getCompanyId, companyIds)
|
|
|
- .eq(userType > 0, AdminRole::getType, userType)
|
|
|
+ .ge(userType > 0, AdminRole::getType, userType)
|
|
|
.orderByAsc(AdminRole::getType)
|
|
|
.page(new Page<>(pageNo, pageSize));
|
|
|
}
|
|
@@ -76,6 +76,17 @@ public class AdminRoleLogic {
|
|
|
throw new RemoteServiceException("适用机构参数异常");
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isBlank(adminRole.getName())) {
|
|
|
+ throw new RemoteServiceException("角色名称不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (adminRoleService.lambdaQuery()
|
|
|
+ .eq(AdminRole::getCompanyId, adminRole.getCompanyId())
|
|
|
+ .eq(AdminRole::getName, StringUtils.trim(adminRole.getName()))
|
|
|
+ .count() > 0) {
|
|
|
+ throw new RemoteServiceException("同商户的角色名称已重复");
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(adminRole.getParentRoleId())) {
|
|
|
final AdminRole parentRole = adminRoleService.getById(adminRole.getParentRoleId());
|
|
|
adminRole.setParentRoleName(parentRole.getName());
|
|
@@ -96,6 +107,18 @@ public class AdminRoleLogic {
|
|
|
public void update(AdminRole adminRole) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
|
|
|
+ if (StringUtils.isBlank(adminRole.getName())) {
|
|
|
+ throw new RemoteServiceException("角色名称不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (adminRoleService.lambdaQuery()
|
|
|
+ .eq(AdminRole::getCompanyId, adminRole.getCompanyId())
|
|
|
+ .eq(AdminRole::getName, StringUtils.trim(adminRole.getName()))
|
|
|
+ .ne(AdminRole::getAdminRoleId, adminRole.getAdminRoleId())
|
|
|
+ .count() > 0) {
|
|
|
+ throw new RemoteServiceException("同商户的角色名称已重复");
|
|
|
+ }
|
|
|
+
|
|
|
final AdminRole oldData = adminRoleService.getById(adminRole.getAdminRoleId());
|
|
|
// 父级角色id不为空查询父级角色名填充
|
|
|
if (StringUtils.isNotBlank(adminRole.getParentRoleId())) {
|