From c1ca5f7dc5b60b004ec643faa348125a62205e81 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sat, 4 Jul 2020 17:13:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=99=BB=E9=99=86=E6=8E=A5=E5=8F=A3=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 2 +- .../rpc/admin/dto/AdminVerifyPasswordDTO.java | 3 ++- .../systemservice/rpc/admin/vo/AdminVO.java | 4 +++- .../dal/mysql/dataobject/package-info.java | 1 - .../{AccountRoleDO.java => AdminRoleDO.java} | 10 +++++----- .../dataobject/permission/ResourceDO.java | 4 ++-- .../mysql/dataobject/permission/RoleDO.java | 6 +++--- .../dataobject/permission/RoleResourceDO.java | 2 +- .../mapper/permission/AccountRoleMapper.java | 18 +++++++++--------- .../service/admin/AdminService.java | 2 +- 10 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/package-info.java rename system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/{AccountRoleDO.java => AdminRoleDO.java} (70%) diff --git a/management-web-app/src/main/resources/application.yml b/management-web-app/src/main/resources/application.yml index 48d8f39e3..66b4691d4 100644 --- a/management-web-app/src/main/resources/application.yml +++ b/management-web-app/src/main/resources/application.yml @@ -16,7 +16,7 @@ spring: dubbo: # Spring Cloud Alibaba Dubbo 专属配置 cloud: - subscribed-services: 'user-service, system-service' # 设置订阅的应用列表,默认为 * 订阅所有应用 + subscribed-services: 'system-service' # 设置订阅的应用列表,默认为 * 订阅所有应用 # Dubbo 服务消费者的配置 consumer: timeout: 10000 diff --git a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/dto/AdminVerifyPasswordDTO.java b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/dto/AdminVerifyPasswordDTO.java index 22ffd2904..e02cef59d 100644 --- a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/dto/AdminVerifyPasswordDTO.java +++ b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/dto/AdminVerifyPasswordDTO.java @@ -6,13 +6,14 @@ import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Pattern; +import java.io.Serializable; /** * 管理员校验密码 DTO */ @Data @Accessors(chain = true) -public class AdminVerifyPasswordDTO { +public class AdminVerifyPasswordDTO implements Serializable { /** * 用户名 diff --git a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/vo/AdminVO.java b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/vo/AdminVO.java index 66e67317b..c33f45ac2 100644 --- a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/vo/AdminVO.java +++ b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/rpc/admin/vo/AdminVO.java @@ -4,12 +4,14 @@ import cn.iocoder.mall.systemservice.enums.admin.AdminStatusEnum; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; + /** * 管理员 DO */ @Data @Accessors(chain = true) -public class AdminVO { +public class AdminVO implements Serializable { /** * 管理员编号 diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/package-info.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/package-info.java deleted file mode 100644 index d1cbe1201..000000000 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.mall.systemservice.dal.mysql.dataobject; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AccountRoleDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java similarity index 70% rename from system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AccountRoleDO.java rename to system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java index b857203bb..e5bf7e1d4 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AccountRoleDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java @@ -1,20 +1,20 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; -import cn.iocoder.mall.system.biz.dataobject.account.AccountDO; +import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** - * {@link AccountDO} 和 {@link RoleDO} 的关联表 + * {@link AdminDO} 和 {@link RoleDO} 的关联表 */ @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -@TableName("account_role") -public class AccountRoleDO extends DeletableDO { +@TableName("permission_admin_role") +public class AdminRoleDO extends DeletableDO { /** * 编号 @@ -23,7 +23,7 @@ public class AccountRoleDO extends DeletableDO { /** * 账号编号 * - * 关联 {@link AccountDO#getId()} + * 关联 {@link AdminDO#getId()} */ private Integer accountId; /** diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java index d63dae83f..1edb89189 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; -import cn.iocoder.mall.system.biz.enums.authorization.ResourceTypeEnum; +import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -13,7 +13,7 @@ import lombok.experimental.Accessors; @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -@TableName(value = "resource") +@TableName(value = "permission_resource") public class ResourceDO extends DeletableDO { /** diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java index aedd1dd5b..610633628 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java @@ -1,8 +1,8 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; -import cn.iocoder.mall.system.biz.enums.authorization.RoleCodeEnum; -import cn.iocoder.mall.system.biz.enums.authorization.RoleTypeEnum; +import cn.iocoder.mall.systemservice.enums.permission.RoleCodeEnum; +import cn.iocoder.mall.systemservice.enums.permission.RoleTypeEnum; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,7 +14,7 @@ import lombok.experimental.Accessors; @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -@TableName("role") +@TableName("permission_role") public class RoleDO extends DeletableDO { /** diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java index 26165a4ba..5381cb45e 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java @@ -12,7 +12,7 @@ import lombok.experimental.Accessors; @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -@TableName("role_resource") +@TableName("permission_role_resource") public class RoleResourceDO extends DeletableDO { /** diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/AccountRoleMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/AccountRoleMapper.java index 2b74ae77a..15f72bcec 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/AccountRoleMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/AccountRoleMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission; -import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.AccountRoleDO; +import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.AdminRoleDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; @@ -10,22 +10,22 @@ import java.util.Collection; import java.util.List; @Repository -public interface AccountRoleMapper extends BaseMapper { +public interface AccountRoleMapper extends BaseMapper { - default List selectByAccountId(Integer accountId) { - return selectList(new QueryWrapper().eq("account_id", accountId)); + default List selectByAccountId(Integer accountId) { + return selectList(new QueryWrapper().eq("account_id", accountId)); } - default List selectListByAccountIds(Collection accountIds) { - return selectList(new QueryWrapper().in("account_id", accountIds)); + default List selectListByAccountIds(Collection accountIds) { + return selectList(new QueryWrapper().in("account_id", accountIds)); } default int deleteByAccountId(Integer accountId) { - return delete(new QueryWrapper().eq("account_id", accountId)); + return delete(new QueryWrapper().eq("account_id", accountId)); } default int deleteByRoleId(Integer roleId) { - return delete(new QueryWrapper().eq("role_id", roleId)); + return delete(new QueryWrapper().eq("role_id", roleId)); } /** @@ -33,6 +33,6 @@ public interface AccountRoleMapper extends BaseMapper { * * @param accountRoleDOs 数组 */ - int insertList(@Param("accountRoleDOs") List accountRoleDOs); + int insertList(@Param("accountRoleDOs") List accountRoleDOs); } diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java index 0a7791a41..483a647f1 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java @@ -24,7 +24,7 @@ public class AdminService { } // 校验密码是否正确 String encodedPassword = DigestUtils.bcrypt(password, adminDO.getPasswordSalt()); - if (encodedPassword.equals(adminDO.getPassword())) { + if (!encodedPassword.equals(adminDO.getPassword())) { // TODO 需要补充密码错误上限 throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.ADMIN_PASSWORD_ERROR); }