From 7aaa6700b3cc082ff2b75628dfb239f67870a1b5 Mon Sep 17 00:00:00 2001
From: weihongyang <1075331873@qq.com>
Date: Mon, 20 Jun 2022 16:26:51 +0800
Subject: [PATCH] commit init
---
.gitignore | 25 ++
pom.xml | 227 ++++++++++++++++++
ym-admin/pom.xml | 44 ++++
.../admin/Expression/SGExpressionRoot.java | 28 +++
.../cnbm/admin/annotation/LogOperation.java | 16 ++
.../cnbm/admin/aspect/LogOperationAspect.java | 105 ++++++++
.../com/cnbm/admin/config/CorsConfig.java | 30 +++
.../com/cnbm/admin/config/SecurityConfig.java | 74 ++++++
.../admin/controller/LoginController.java | 43 ++++
.../admin/controller/SysDeptController.java | 90 +++++++
.../controller/SysDictDataController.java | 102 ++++++++
.../controller/SysDictTypeController.java | 112 +++++++++
.../controller/SysLogErrorController.java | 61 +++++
.../controller/SysLogOperationController.java | 62 +++++
.../admin/controller/SysMenuController.java | 136 +++++++++++
.../admin/controller/SysParamsController.java | 116 +++++++++
.../admin/controller/SysRoleController.java | 125 ++++++++++
.../admin/controller/SysUserController.java | 163 +++++++++++++
.../java/com/cnbm/admin/dao/LoginDao.java | 14 ++
.../java/com/cnbm/admin/dao/SysDeptDao.java | 33 +++
.../com/cnbm/admin/dao/SysDictDataDao.java | 22 ++
.../com/cnbm/admin/dao/SysDictTypeDao.java | 23 ++
.../com/cnbm/admin/dao/SysLogErrorDao.java | 15 ++
.../cnbm/admin/dao/SysLogOperationDao.java | 15 ++
.../java/com/cnbm/admin/dao/SysMenuDao.java | 52 ++++
.../java/com/cnbm/admin/dao/SysParamsDao.java | 37 +++
.../java/com/cnbm/admin/dao/SysRoleDao.java | 16 ++
.../cnbm/admin/dao/SysRoleDataScopeDao.java | 32 +++
.../com/cnbm/admin/dao/SysRoleMenuDao.java | 34 +++
.../com/cnbm/admin/dao/SysRoleUserDao.java | 36 +++
.../java/com/cnbm/admin/dao/SysUserDao.java | 36 +++
.../main/java/com/cnbm/admin/dao/UserDao.java | 14 ++
.../java/com/cnbm/admin/dto/PasswordDTO.java | 28 +++
.../java/com/cnbm/admin/dto/SysDeptDTO.java | 102 ++++++++
.../com/cnbm/admin/dto/SysDictDataDTO.java | 58 +++++
.../com/cnbm/admin/dto/SysDictTypeDTO.java | 55 +++++
.../com/cnbm/admin/dto/SysLogErrorDTO.java | 37 +++
.../cnbm/admin/dto/SysLogOperationDTO.java | 53 ++++
.../java/com/cnbm/admin/dto/SysMenuDTO.java | 148 ++++++++++++
.../java/com/cnbm/admin/dto/SysParamsDTO.java | 51 ++++
.../java/com/cnbm/admin/dto/SysRoleDTO.java | 50 ++++
.../java/com/cnbm/admin/dto/SysUserDTO.java | 84 +++++++
.../java/com/cnbm/admin/entity/DictData.java | 17 ++
.../java/com/cnbm/admin/entity/DictType.java | 20 ++
.../java/com/cnbm/admin/entity/LoginUser.java | 83 +++++++
.../com/cnbm/admin/entity/SysDeptEntity.java | 55 +++++
.../cnbm/admin/entity/SysDictDataEntity.java | 52 ++++
.../cnbm/admin/entity/SysDictTypeEntity.java | 48 ++++
.../cnbm/admin/entity/SysLogErrorEntity.java | 44 ++++
.../admin/entity/SysLogOperationEntity.java | 55 +++++
.../com/cnbm/admin/entity/SysMenuEntity.java | 67 ++++++
.../cnbm/admin/entity/SysParamsEntity.java | 50 ++++
.../admin/entity/SysRoleDataScopeEntity.java | 28 +++
.../com/cnbm/admin/entity/SysRoleEntity.java | 46 ++++
.../cnbm/admin/entity/SysRoleMenuEntity.java | 27 +++
.../cnbm/admin/entity/SysRoleUserEntity.java | 29 +++
.../com/cnbm/admin/entity/SysUserEntity.java | 80 ++++++
.../com/cnbm/admin/enums/MenuTypeEnum.java | 27 +++
.../cnbm/admin/enums/OperationStatusEnum.java | 27 +++
.../com/cnbm/admin/enums/SuperAdminEnum.java | 21 ++
.../admin/exception/RenExceptionHandler.java | 87 +++++++
.../cnbm/admin/execl/SysLogErrorExcel.java | 28 +++
.../admin/execl/SysLogOperationExcel.java | 36 +++
.../com/cnbm/admin/execl/SysParamsExcel.java | 20 ++
.../com/cnbm/admin/execl/SysUserExcel.java | 34 +++
.../filter/JwtAuthenticationTokenFilter.java | 65 +++++
.../handler/AccessDeniedHandlerImpl.java | 30 +++
.../handler/AuthenticationEntryPointImpl.java | 30 +++
.../com/cnbm/admin/params/LoginParam.java | 36 +++
.../com/cnbm/admin/redis/SysParamsRedis.java | 36 +++
.../cnbm/admin/service/CaptchaService.java | 9 +
.../com/cnbm/admin/service/LoginService.java | 16 ++
.../cnbm/admin/service/SysDeptService.java | 32 +++
.../admin/service/SysDictDataService.java | 27 +++
.../admin/service/SysDictTypeService.java | 34 +++
.../admin/service/SysLogErrorService.java | 24 ++
.../admin/service/SysLogOperationService.java | 23 ++
.../cnbm/admin/service/SysMenuService.java | 48 ++++
.../cnbm/admin/service/SysParamsService.java | 50 ++++
.../service/SysRoleDataScopeService.java | 32 +++
.../admin/service/SysRoleMenuService.java | 38 +++
.../cnbm/admin/service/SysRoleService.java | 30 +++
.../admin/service/SysRoleUserService.java | 39 +++
.../cnbm/admin/service/SysUserService.java | 49 ++++
.../admin/service/impl/LoginServiceImpl.java | 51 ++++
.../service/impl/SysDeptServiceImpl.java | 165 +++++++++++++
.../service/impl/SysDictDataServiceImpl.java | 80 ++++++
.../service/impl/SysDictTypeServiceImpl.java | 98 ++++++++
.../service/impl/SysLogErrorServiceImpl.java | 55 +++++
.../impl/SysLogOperationServiceImpl.java | 60 +++++
.../service/impl/SysMenuServiceImpl.java | 136 +++++++++++
.../service/impl/SysParamsServiceImpl.java | 133 ++++++++++
.../impl/SysRoleDataScopeServiceImpl.java | 53 ++++
.../service/impl/SysRoleMenuServiceImpl.java | 60 +++++
.../service/impl/SysRoleServiceImpl.java | 132 ++++++++++
.../service/impl/SysRoleUserServiceImpl.java | 56 +++++
.../service/impl/SysUserServiceImpl.java | 154 ++++++++++++
.../service/impl/UserDetailsServiceImpl.java | 57 +++++
.../java/com/cnbm/admin/utils/JwtUtil.java | 115 +++++++++
.../com/cnbm/admin/utils/PasswordUtils.java | 43 ++++
.../com/cnbm/admin/utils/ResponseResult.java | 64 +++++
.../java/com/cnbm/admin/utils/WebUtils.java | 34 +++
.../src/main/resources/mapper/LoginDao.xml | 6 +
.../src/main/resources/mapper/SysDeptDao.xml | 32 +++
.../main/resources/mapper/SysDictDataDao.xml | 10 +
.../main/resources/mapper/SysDictTypeDao.xml | 10 +
.../main/resources/mapper/SysLogErrorDao.xml | 6 +
.../resources/mapper/SysLogOperationDao.xml | 6 +
.../src/main/resources/mapper/SysMenuDao.xml | 46 ++++
.../main/resources/mapper/SysParamsDao.xml | 23 ++
.../src/main/resources/mapper/SysRoleDao.xml | 7 +
.../resources/mapper/SysRoleDataScopeDao.xml | 22 ++
.../main/resources/mapper/SysRoleMenuDao.xml | 20 ++
.../main/resources/mapper/SysRoleUserDao.xml | 24 ++
.../src/main/resources/mapper/SysUserDao.xml | 50 ++++
ym-barcode/pom.xml | 27 +++
.../listener/GlobalKeyListenerExample.java | 91 +++++++
ym-basic/pom.xml | 19 ++
ym-common/pom.xml | 19 ++
.../com/cnbm/common/aspect/RedisAspect.java | 41 ++++
.../com/cnbm/common/constant/Constant.java | 119 +++++++++
.../cnbm/common/convert/DateConverter.java | 71 ++++++
.../java/com/cnbm/common/dao/BaseDao.java | 12 +
.../com/cnbm/common/entity/BaseEntity.java | 33 +++
.../com/cnbm/common/exception/ErrorCode.java | 34 +++
.../cnbm/common/exception/ExceptionUtils.java | 45 ++++
.../cnbm/common/exception/RenException.java | 65 +++++
.../java/com/cnbm/common/page/PageData.java | 35 +++
.../com/cnbm/common/redis/RedisConfig.java | 49 ++++
.../java/com/cnbm/common/redis/RedisKeys.java | 58 +++++
.../com/cnbm/common/redis/RedisUtils.java | 118 +++++++++
.../com/cnbm/common/service/BaseService.java | 108 +++++++++
.../com/cnbm/common/service/CrudService.java | 27 +++
.../common/service/impl/BaseServiceImpl.java | 212 ++++++++++++++++
.../common/service/impl/CrudServiceImpl.java | 72 ++++++
.../com/cnbm/common/utils/ConvertUtils.java | 52 ++++
.../java/com/cnbm/common/utils/DateUtils.java | 174 ++++++++++++++
.../com/cnbm/common/utils/ExcelUtils.java | 70 ++++++
.../cnbm/common/utils/HttpContextUtils.java | 54 +++++
.../java/com/cnbm/common/utils/IpUtils.java | 49 ++++
.../java/com/cnbm/common/utils/JsonUtils.java | 67 ++++++
.../com/cnbm/common/utils/MessageUtils.java | 24 ++
.../java/com/cnbm/common/utils/Result.java | 89 +++++++
.../cnbm/common/utils/SpringContextUtils.java | 47 ++++
.../java/com/cnbm/common/utils/TreeNode.java | 50 ++++
.../java/com/cnbm/common/utils/TreeUtils.java | 69 ++++++
.../cnbm/common/validator/AssertUtils.java | 88 +++++++
.../cnbm/common/validator/ValidatorUtils.java | 47 ++++
.../cnbm/common/validator/group/AddGroup.java | 9 +
.../common/validator/group/DefaultGroup.java | 9 +
.../cnbm/common/validator/group/Group.java | 12 +
.../common/validator/group/UpdateGroup.java | 9 +
.../main/resources/i18n/messages.properties | 26 ++
.../main/resources/i18n/validation.properties | 67 ++++++
ym-gateway/pom.xml | 42 ++++
.../main/java/com/cnbm/AdminApplication.java | 17 ++
.../src/main/resources/application-dev.yml | 40 +++
ym-gateway/src/main/resources/application.yml | 75 ++++++
ym-gateway/src/main/resources/banner.txt | 11 +
ym-generator/pom.xml | 70 ++++++
.../cnbm/generator/build/CodeGenerator.java | 148 ++++++++++++
.../com/cnbm/generator/config/DataConfig.java | 16 ++
.../engine/EnhanceVelocityTemplateEngine.java | 55 +++++
.../src/main/resources/templates/DTO.java.vm | 32 +++
.../main/resources/templates/Excel.java.vm | 24 ++
.../resources/templates/controller.java.vm | 116 +++++++++
.../main/resources/templates/entity.java.vm | 120 +++++++++
.../main/resources/templates/mapper.java.vm | 16 ++
.../main/resources/templates/mapper.xml.vm | 39 +++
.../main/resources/templates/service.java.vm | 15 ++
.../resources/templates/serviceImpl.java.vm | 34 +++
171 files changed, 9178 insertions(+)
create mode 100644 .gitignore
create mode 100644 pom.xml
create mode 100644 ym-admin/pom.xml
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/Expression/SGExpressionRoot.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/annotation/LogOperation.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/aspect/LogOperationAspect.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/config/CorsConfig.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/LoginController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysDeptController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/LoginDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysDeptDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysDictDataDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysDictTypeDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysLogErrorDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysLogOperationDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysMenuDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysParamsDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDataScopeDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleMenuDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleUserDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/SysUserDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dao/UserDao.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/PasswordDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysDeptDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysDictDataDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysDictTypeDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysLogErrorDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysLogOperationDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysMenuDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysParamsDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysRoleDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/dto/SysUserDTO.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/DictData.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/DictType.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysDeptEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysDictDataEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysDictTypeEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysLogErrorEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysLogOperationEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysMenuEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysParamsEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleDataScopeEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleMenuEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleUserEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/entity/SysUserEntity.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/enums/MenuTypeEnum.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/enums/OperationStatusEnum.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/enums/SuperAdminEnum.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/exception/RenExceptionHandler.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/execl/SysLogErrorExcel.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/execl/SysLogOperationExcel.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/execl/SysParamsExcel.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/execl/SysUserExcel.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/filter/JwtAuthenticationTokenFilter.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/handler/AccessDeniedHandlerImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/handler/AuthenticationEntryPointImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/params/LoginParam.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/redis/SysParamsRedis.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/CaptchaService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/LoginService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysDeptService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysDictDataService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysDictTypeService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysLogErrorService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysLogOperationService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysMenuService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysParamsService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysRoleDataScopeService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysRoleMenuService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysRoleService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysRoleUserService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/SysUserService.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDeptServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictDataServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictTypeServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogErrorServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogOperationServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysMenuServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysParamsServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleDataScopeServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleMenuServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleUserServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/SysUserServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/service/impl/UserDetailsServiceImpl.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/utils/JwtUtil.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/utils/PasswordUtils.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/utils/ResponseResult.java
create mode 100644 ym-admin/src/main/java/com/cnbm/admin/utils/WebUtils.java
create mode 100644 ym-admin/src/main/resources/mapper/LoginDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysDeptDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysDictDataDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysDictTypeDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysLogErrorDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysLogOperationDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysMenuDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysParamsDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysRoleDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysRoleDataScopeDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysRoleMenuDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysRoleUserDao.xml
create mode 100644 ym-admin/src/main/resources/mapper/SysUserDao.xml
create mode 100644 ym-barcode/pom.xml
create mode 100644 ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java
create mode 100644 ym-basic/pom.xml
create mode 100644 ym-common/pom.xml
create mode 100644 ym-common/src/main/java/com/cnbm/common/aspect/RedisAspect.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/constant/Constant.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/convert/DateConverter.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/dao/BaseDao.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/entity/BaseEntity.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/exception/ErrorCode.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/exception/ExceptionUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/exception/RenException.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/page/PageData.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/redis/RedisConfig.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/redis/RedisKeys.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/redis/RedisUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/service/BaseService.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/service/CrudService.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/service/impl/BaseServiceImpl.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/service/impl/CrudServiceImpl.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/ConvertUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/DateUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/ExcelUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/HttpContextUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/IpUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/JsonUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/MessageUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/Result.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/SpringContextUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/TreeNode.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/utils/TreeUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/validator/AssertUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/validator/ValidatorUtils.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/validator/group/AddGroup.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/validator/group/DefaultGroup.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/validator/group/Group.java
create mode 100644 ym-common/src/main/java/com/cnbm/common/validator/group/UpdateGroup.java
create mode 100644 ym-common/src/main/resources/i18n/messages.properties
create mode 100644 ym-common/src/main/resources/i18n/validation.properties
create mode 100644 ym-gateway/pom.xml
create mode 100644 ym-gateway/src/main/java/com/cnbm/AdminApplication.java
create mode 100644 ym-gateway/src/main/resources/application-dev.yml
create mode 100644 ym-gateway/src/main/resources/application.yml
create mode 100644 ym-gateway/src/main/resources/banner.txt
create mode 100644 ym-generator/pom.xml
create mode 100644 ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java
create mode 100644 ym-generator/src/main/java/com/cnbm/generator/config/DataConfig.java
create mode 100644 ym-generator/src/main/java/com/cnbm/generator/engine/EnhanceVelocityTemplateEngine.java
create mode 100644 ym-generator/src/main/resources/templates/DTO.java.vm
create mode 100644 ym-generator/src/main/resources/templates/Excel.java.vm
create mode 100644 ym-generator/src/main/resources/templates/controller.java.vm
create mode 100644 ym-generator/src/main/resources/templates/entity.java.vm
create mode 100644 ym-generator/src/main/resources/templates/mapper.java.vm
create mode 100644 ym-generator/src/main/resources/templates/mapper.xml.vm
create mode 100644 ym-generator/src/main/resources/templates/service.java.vm
create mode 100644 ym-generator/src/main/resources/templates/serviceImpl.java.vm
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..631d03f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,25 @@
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+target
+
+# Package Files #
+*.jar
+*.war
+*.ear
+*.zip
+*.tar.gz
+*.rar
+*.iml
+.idea
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..5cb407c
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,227 @@
+
+
+ 4.0.0
+
+ com.cnbm
+ ym-pass
+ 1.0-SNAPSHOT
+
+ ym-common
+ ym-admin
+ ym-generator
+ ym-gateway
+ ym-barcode
+ ym-basic
+
+ pom
+
+ ym-pass
+ 轻工业自动化研究所springboot框架
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.7.0
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ 4.13.2
+ 4.2.2
+
+ 3.5.1
+ 4.0
+ 11.2.0.3
+ 3.12.0
+ 1.4
+ 2.11.0
+ 1.15
+ 31.0-jre
+ 2.10.14
+ 5.7.22
+ 2.9.0
+ 1.14.3
+ 2.0.2
+ 1.18.24
+ 1.1.1
+ 4.4.0
+
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+ org.springframework
+ spring-context-support
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ redis.clients
+ jedis
+ ${jedis.version}
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ com.oracle
+ ojdbc6
+ ${oracle.version}
+
+
+
+ com.microsoft.sqlserver
+ sqljdbc4
+ ${sqlserver.version}
+
+
+
+ org.postgresql
+ postgresql
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jdbc
+
+
+
+ cn.afterturn
+ easypoi-base
+ ${easypoi.version}
+
+
+ cn.afterturn
+ easypoi-web
+ ${easypoi.version}
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ ${mybatisplus.version}
+
+
+ com.baomidou
+ mybatis-plus-generator
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons.lang.version}
+
+
+ commons-fileupload
+ commons-fileupload
+ ${commons.fileupload.version}
+
+
+ commons-io
+ commons-io
+ ${commons.io.version}
+
+
+ commons-codec
+ commons-codec
+ ${commons.codec.version}
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+ joda-time
+ joda-time
+ ${joda.time.version}
+
+
+ com.google.code.gson
+ gson
+ ${gson.version}
+
+
+ cn.hutool
+ hutool-all
+ ${hutool.version}
+
+
+ org.jsoup
+ jsoup
+ ${jsoup.version}
+
+
+ com.github.xiaoymin
+ knife4j-spring-boot-starter
+ ${knife4j.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+
+
+
+
+ public
+ aliyun nexus
+ https://maven.aliyun.com/repository/public/
+
+ true
+
+
+
+
+
+ public
+ aliyun nexus
+ https://maven.aliyun.com/repository/public/
+
+ true
+
+
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/ym-admin/pom.xml b/ym-admin/pom.xml
new file mode 100644
index 0000000..c937493
--- /dev/null
+++ b/ym-admin/pom.xml
@@ -0,0 +1,44 @@
+
+
+
+ ym-pass
+ com.cnbm
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ ym-admin
+ jar
+
+
+ 2.3.2
+ 1.9.0
+ 1.6.2
+ 4.1.0
+ 7.2.27
+ 2.8.3
+ 3.2.2
+ 5.4.4
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.9.0
+
+
+ com.cnbm
+ ym-common
+ 1.0-SNAPSHOT
+
+
+
+
+
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/Expression/SGExpressionRoot.java b/ym-admin/src/main/java/com/cnbm/admin/Expression/SGExpressionRoot.java
new file mode 100644
index 0000000..2ebde41
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/Expression/SGExpressionRoot.java
@@ -0,0 +1,28 @@
+package com.cnbm.admin.Expression;
+
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.entity.SysMenuEntity;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/13 8:29 AM
+ * @Version 1.0
+ */
+@Component("ex")
+public class SGExpressionRoot {
+
+ public boolean hasAuthority(String authority){
+ //获取当前用户的权限
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ List permissions = loginUser.getPermissions();
+ //判断用户权限集合中是否存在authority
+ return permissions.contains(authority);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/annotation/LogOperation.java b/ym-admin/src/main/java/com/cnbm/admin/annotation/LogOperation.java
new file mode 100644
index 0000000..e4a7e31
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/annotation/LogOperation.java
@@ -0,0 +1,16 @@
+package com.cnbm.admin.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:40 AM
+ * @Version 1.0
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface LogOperation {
+
+ String value() default "";
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/aspect/LogOperationAspect.java b/ym-admin/src/main/java/com/cnbm/admin/aspect/LogOperationAspect.java
new file mode 100644
index 0000000..619c43f
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/aspect/LogOperationAspect.java
@@ -0,0 +1,105 @@
+package com.cnbm.admin.aspect;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.entity.SysLogOperationEntity;
+import com.cnbm.admin.enums.OperationStatusEnum;
+import com.cnbm.admin.service.SysLogOperationService;
+import com.cnbm.common.utils.HttpContextUtils;
+import com.cnbm.common.utils.IpUtils;
+import com.cnbm.common.utils.JsonUtils;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:41 AM
+ * @Version 1.0
+ */
+@Aspect
+@Component
+public class LogOperationAspect {
+
+ @Autowired
+ private SysLogOperationService sysLogOperationService;
+
+ @Pointcut("@annotation(com.cnbm.admin.annotation.LogOperation)")
+ public void logPointCut() {
+
+ }
+
+ @Around("logPointCut()")
+ public Object around(ProceedingJoinPoint point) throws Throwable {
+ long beginTime = System.currentTimeMillis();
+ try {
+ //执行方法
+ Object result = point.proceed();
+
+ //执行时长(毫秒)
+ long time = System.currentTimeMillis() - beginTime;
+ //保存日志
+ saveLog(point, time, OperationStatusEnum.SUCCESS.value());
+
+ return result;
+ }catch(Exception e) {
+ //执行时长(毫秒)
+ long time = System.currentTimeMillis() - beginTime;
+ //保存日志
+ saveLog(point, time, OperationStatusEnum.FAIL.value());
+
+ throw e;
+ }
+ }
+
+ private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) throws Exception {
+ MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+ Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
+ LogOperation annotation = method.getAnnotation(LogOperation.class);
+
+ SysLogOperationEntity log = new SysLogOperationEntity();
+ if(annotation != null){
+ //注解上的描述
+ log.setOperation(annotation.value());
+ }
+
+ //登录用户信息
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ if(loginUser != null){
+ log.setCreatorName(loginUser.getUsername());
+ }
+
+ log.setStatus(status);
+ log.setRequestTime((int)time);
+
+ //请求相关信息
+ HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
+ log.setIp(IpUtils.getIpAddr(request));
+ log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
+ log.setRequestUri(request.getRequestURI());
+ log.setRequestMethod(request.getMethod());
+
+ //请求参数
+ Object[] args = joinPoint.getArgs();
+ try{
+ String params = JsonUtils.toJsonString(args[0]);
+ log.setRequestParams(params);
+ }catch (Exception e){
+
+ }
+
+ //保存到DB
+ sysLogOperationService.save(log);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/config/CorsConfig.java b/ym-admin/src/main/java/com/cnbm/admin/config/CorsConfig.java
new file mode 100644
index 0000000..55e40e5
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/config/CorsConfig.java
@@ -0,0 +1,30 @@
+package com.cnbm.admin.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 10:47 AM
+ * @Version 1.0
+ */
+@Configuration
+public class CorsConfig implements WebMvcConfigurer {
+
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ // 设置允许跨域的路径
+ registry.addMapping("/**")
+ // 设置允许跨域请求的域名
+ .allowedOriginPatterns("*")
+ // 是否允许cookie
+ .allowCredentials(true)
+ // 设置允许的请求方式
+ .allowedMethods("GET", "POST", "DELETE", "PUT")
+ // 设置允许的header属性
+ .allowedHeaders("*")
+ // 跨域允许时间
+ .maxAge(3600);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java b/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java
new file mode 100644
index 0000000..3c66bed
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java
@@ -0,0 +1,74 @@
+package com.cnbm.admin.config;
+
+import com.cnbm.admin.filter.JwtAuthenticationTokenFilter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.security.web.access.AccessDeniedHandler;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 1:51 PM
+ * @Version 1.0
+ */
+@Configuration
+@EnableGlobalMethodSecurity(prePostEnabled = true)
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ //创建BCryptPasswordEncoder注入容器
+ @Bean
+ public PasswordEncoder passwordEncoder(){
+ return new BCryptPasswordEncoder();
+ }
+ @Autowired
+ private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;
+
+
+ @Autowired
+ private AuthenticationEntryPoint authenticationEntryPoint;
+
+ @Autowired
+ private AccessDeniedHandler accessDeniedHandler;
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http
+ //关闭csrf
+ .csrf().disable()
+ //不通过Session获取SecurityContext
+ .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
+ .and()
+ .authorizeRequests()
+ // 对于登录接口 允许匿名访问
+ .antMatchers("/login").anonymous()
+// .antMatchers("/testCors").hasAuthority("system:dept:list222")
+ // 除上面外的所有请求全部需要鉴权认证
+ .anyRequest().authenticated();
+
+ //添加过滤器
+ http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
+
+ //配置异常处理器
+ http.exceptionHandling()
+ //配置认证失败处理器
+ .authenticationEntryPoint(authenticationEntryPoint)
+ .accessDeniedHandler(accessDeniedHandler);
+
+ //允许跨域
+ http.cors();
+ }
+
+ @Bean
+ @Override
+ public AuthenticationManager authenticationManagerBean() throws Exception {
+ return super.authenticationManagerBean();
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/LoginController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/LoginController.java
new file mode 100644
index 0000000..39e020b
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/LoginController.java
@@ -0,0 +1,43 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.params.LoginParam;
+import com.cnbm.admin.service.LoginService;
+import com.cnbm.admin.utils.ResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/7 3:55 PM
+ * @Version 1.0
+ */
+@RestController
+@Api(tags="登录管理")
+@Log4j2
+public class LoginController {
+
+ @Autowired
+ private LoginService loginService;
+
+ @RequestMapping("/hello")
+ @PreAuthorize("@ex.hasAuthority('sys:user:page')")
+ public String hello(){
+ log.info("hello");
+ return "hello";
+ }
+
+ @PostMapping("/login")
+ @ApiOperation(value = "登录")
+ public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) {
+ return loginService.login(request,loginParam);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDeptController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDeptController.java
new file mode 100644
index 0000000..89c8bd8
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDeptController.java
@@ -0,0 +1,90 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysDeptDTO;
+import com.cnbm.admin.service.SysDeptService;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:40 PM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/sys/dept")
+@Api(tags="部门管理")
+public class SysDeptController {
+ @Autowired
+ private SysDeptService sysDeptService;
+
+ @GetMapping("list")
+ @ApiOperation("列表")
+ @PreAuthorize("@ex.hasAuthority('sys:dept:list')")
+ public Result> list(){
+ List list = sysDeptService.list(new HashMap<>(1));
+
+ return new Result>().ok(list);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:dept:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysDeptDTO data = sysDeptService.get(id);
+
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:dept:save')")
+ public Result save(@RequestBody SysDeptDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+
+ sysDeptService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:dept:update')")
+ public Result update(@RequestBody SysDeptDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+
+ sysDeptService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping("{id}")
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:dept:delete')")
+ public Result delete(@PathVariable("id") Long id){
+ //效验数据
+ AssertUtils.isNull(id, "id");
+
+ sysDeptService.delete(id);
+
+ return new Result();
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java
new file mode 100644
index 0000000..3f799cd
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java
@@ -0,0 +1,102 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysDictDataDTO;
+import com.cnbm.admin.service.SysDictDataService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:55 AM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("sys/dict/data")
+@Api(tags="字典数据")
+public class SysDictDataController {
+ @Autowired
+ private SysDictDataService sysDictDataService;
+
+ @GetMapping("page")
+ @ApiOperation("字典数据")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = "dictLabel", value = "字典标签", paramType = "query", dataType="String"),
+ @ApiImplicitParam(name = "dictValue", value = "字典值", paramType = "query", dataType="String")
+ })
+ @PreAuthorize("@ex.hasAuthority('sys:dept:page')")
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ //字典类型
+ PageData page = sysDictDataService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysDictDataDTO data = sysDictDataService.get(id);
+
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:save')")
+ public Result save(@RequestBody SysDictDataDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, DefaultGroup.class);
+
+ sysDictDataService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:update')")
+ public Result update(@RequestBody SysDictDataDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+
+ sysDictDataService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:delete')")
+ public Result delete(@RequestBody Long[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+
+ sysDictDataService.delete(ids);
+
+ return new Result();
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java
new file mode 100644
index 0000000..222fcff
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java
@@ -0,0 +1,112 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysDictTypeDTO;
+import com.cnbm.admin.entity.DictType;
+import com.cnbm.admin.service.SysDictTypeService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:55 AM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("sys/dict/type")
+@Api(tags="字典类型")
+public class SysDictTypeController {
+ @Autowired
+ private SysDictTypeService sysDictTypeService;
+
+ @GetMapping("page")
+ @ApiOperation("字典类型")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = "dictType", value = "字典类型", paramType = "query", dataType="String"),
+ @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataType="String")
+ })
+ @PreAuthorize("@ex.hasAuthority('sys:dict:page')")
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ //字典类型
+ PageData page = sysDictTypeService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysDictTypeDTO data = sysDictTypeService.get(id);
+
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:save')")
+ public Result save(@RequestBody SysDictTypeDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, DefaultGroup.class);
+
+ sysDictTypeService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:update')")
+ public Result update(@RequestBody SysDictTypeDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+
+ sysDictTypeService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:dict:delete')")
+ public Result delete(@RequestBody Long[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+
+ sysDictTypeService.delete(ids);
+
+ return new Result();
+ }
+
+ @GetMapping("all")
+ @ApiOperation("所有字典数据")
+ public Result> all(){
+ List list = sysDictTypeService.getAllList();
+
+ return new Result>().ok(list);
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java
new file mode 100644
index 0000000..6aef1ec
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java
@@ -0,0 +1,61 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysLogErrorDTO;
+import com.cnbm.admin.execl.SysLogErrorExcel;
+import com.cnbm.admin.service.SysLogErrorService;
+import com.cnbm.common.utils.ExcelUtils;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:06 PM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("sys/log/error")
+@Api(tags="异常日志")
+public class SysLogErrorController {
+ @Autowired
+ private SysLogErrorService sysLogErrorService;
+
+ @GetMapping("page")
+ @ApiOperation("分页")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
+ })
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ PageData page = sysLogErrorService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("export")
+ @ApiOperation("导出")
+ @LogOperation("导出")
+ public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = sysLogErrorService.list(params);
+
+ ExcelUtils.exportExcelToTarget(response, null, list, SysLogErrorExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java
new file mode 100644
index 0000000..6034d18
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java
@@ -0,0 +1,62 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysLogOperationDTO;
+import com.cnbm.admin.execl.SysLogOperationExcel;
+import com.cnbm.admin.service.SysLogOperationService;
+import com.cnbm.common.utils.ExcelUtils;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:51 AM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("sys/log/operation")
+@Api(tags="操作日志")
+public class SysLogOperationController {
+ @Autowired
+ private SysLogOperationService sysLogOperationService;
+
+ @GetMapping("page")
+ @ApiOperation("分页")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功", paramType = "query", dataType="int")
+ })
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ PageData page = sysLogOperationService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("export")
+ @ApiOperation("导出")
+ @LogOperation("导出")
+ public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = sysLogOperationService.list(params);
+
+ ExcelUtils.exportExcelToTarget(response, null, list, SysLogOperationExcel.class);
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java
new file mode 100644
index 0000000..dcea161
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java
@@ -0,0 +1,136 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysMenuDTO;
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.admin.enums.MenuTypeEnum;
+import com.cnbm.admin.service.SysMenuService;
+import com.cnbm.common.exception.ErrorCode;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.DefaultGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:32 PM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/sys/menu")
+@Api(tags="菜单管理")
+public class SysMenuController {
+ @Autowired
+ private SysMenuService sysMenuService;
+
+
+ @GetMapping("nav")
+ @ApiOperation("导航")
+ public Result> nav(){
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ SysUserEntity user = loginUser.getSysUserEntity();
+ List list = sysMenuService.getUserMenuList(user, MenuTypeEnum.MENU.value());
+
+ return new Result>().ok(list);
+ }
+
+ @GetMapping("permissions")
+ @ApiOperation("权限标识")
+ public Result> permissions(){
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ SysUserEntity user = loginUser.getSysUserEntity();
+ Set set = sysMenuService.getUserPermissions(user);
+ return new Result>().ok(set);
+ }
+
+ @GetMapping("list")
+ @ApiOperation("列表")
+ @ApiImplicitParam(name = "type", value = "菜单类型 0:菜单 1:按钮 null:全部", paramType = "query", dataType="int")
+ @PreAuthorize("@ex.hasAuthority('sys:menu:list')")
+ public Result> list(Integer type){
+ List list = sysMenuService.getAllMenuList(type);
+
+ return new Result>().ok(list);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:menu:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysMenuDTO data = sysMenuService.get(id);
+
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:menu:save')")
+ public Result save(@RequestBody SysMenuDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, DefaultGroup.class);
+
+ sysMenuService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:menu:update')")
+ public Result update(@RequestBody SysMenuDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, DefaultGroup.class);
+
+ sysMenuService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping("{id}")
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:menu:delete')")
+ public Result delete(@PathVariable("id") Long id){
+ //效验数据
+ AssertUtils.isNull(id, "id");
+
+ //判断是否有子菜单或按钮
+ List list = sysMenuService.getListPid(id);
+ if(list.size() > 0){
+ return new Result().error(ErrorCode.SUB_MENU_EXIST);
+ }
+
+ sysMenuService.delete(id);
+
+ return new Result();
+ }
+
+ @GetMapping("select")
+ @ApiOperation("角色菜单权限")
+ @PreAuthorize("@ex.hasAuthority('sys:menu:select')")
+ public Result> select(){
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ SysUserEntity user = loginUser.getSysUserEntity();
+ List list = sysMenuService.getUserMenuList(user, null);
+
+ return new Result>().ok(list);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java
new file mode 100644
index 0000000..cfa9adb
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java
@@ -0,0 +1,116 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysParamsDTO;
+import com.cnbm.admin.execl.SysParamsExcel;
+import com.cnbm.admin.service.SysParamsService;
+import com.cnbm.common.utils.ExcelUtils;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+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 weihongyang
+ * @Date 2022/6/12 10:20 AM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("sys/params")
+@Api(tags="参数管理")
+public class SysParamsController {
+ @Autowired
+ private SysParamsService sysParamsService;
+
+ @GetMapping("page")
+ @ApiOperation("分页")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String")
+ })
+ @PreAuthorize("@ex.hasAuthority('sys:params:page')")
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ PageData page = sysParamsService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:params:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysParamsDTO data = sysParamsService.get(id);
+
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:params:save')")
+ public Result save(@RequestBody SysParamsDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+
+ sysParamsService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:params:update')")
+ public Result update(@RequestBody SysParamsDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+
+ sysParamsService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:params:delete')")
+ public Result delete(@RequestBody Long[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+
+ sysParamsService.delete(ids);
+
+ return new Result();
+ }
+
+ @GetMapping("export")
+ @ApiOperation("导出")
+ @LogOperation("导出")
+ @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String")
+ @PreAuthorize("@ex.hasAuthority('sys:params:export')")
+ public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = sysParamsService.list(params);
+
+ ExcelUtils.exportExcelToTarget(response, null, list, SysParamsExcel.class);
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java
new file mode 100644
index 0000000..5e87715
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java
@@ -0,0 +1,125 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.SysRoleDTO;
+import com.cnbm.admin.service.SysRoleDataScopeService;
+import com.cnbm.admin.service.SysRoleMenuService;
+import com.cnbm.admin.service.SysRoleService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:04 AM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/sys/role")
+@Api(tags="角色管理")
+public class SysRoleController {
+ @Autowired
+ private SysRoleService sysRoleService;
+ @Autowired
+ private SysRoleMenuService sysRoleMenuService;
+ @Autowired
+ private SysRoleDataScopeService sysRoleDataScopeService;
+
+ @GetMapping("page")
+ @ApiOperation("分页")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataType="String")
+ })
+ @PreAuthorize("@ex.hasAuthority('sys:role:page')")
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ PageData page = sysRoleService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("list")
+ @ApiOperation("列表")
+ @PreAuthorize("@ex.hasAuthority('sys:role:list')")
+ public Result> list(){
+ List data = sysRoleService.list(new HashMap<>(1));
+
+ return new Result>().ok(data);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:role:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysRoleDTO data = sysRoleService.get(id);
+
+ //查询角色对应的菜单
+ List menuIdList = sysRoleMenuService.getMenuIdList(id);
+ data.setMenuIdList(menuIdList);
+
+ //查询角色对应的数据权限
+ List deptIdList = sysRoleDataScopeService.getDeptIdList(id);
+ data.setDeptIdList(deptIdList);
+
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:role:save')")
+ public Result save(@RequestBody SysRoleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+
+ sysRoleService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:role:update')")
+ public Result update(@RequestBody SysRoleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+
+ sysRoleService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:role:delete')")
+ public Result delete(@RequestBody Long[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+
+ sysRoleService.delete(ids);
+
+ return new Result();
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java
new file mode 100644
index 0000000..8bf9bc1
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java
@@ -0,0 +1,163 @@
+package com.cnbm.admin.controller;
+
+import com.cnbm.admin.annotation.LogOperation;
+import com.cnbm.admin.dto.PasswordDTO;
+import com.cnbm.admin.dto.SysUserDTO;
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.admin.execl.SysUserExcel;
+import com.cnbm.admin.service.SysRoleUserService;
+import com.cnbm.admin.service.SysUserService;
+import com.cnbm.common.utils.ExcelUtils;
+import com.cnbm.admin.utils.PasswordUtils;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.exception.ErrorCode;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.utils.ConvertUtils;
+import com.cnbm.common.utils.Result;
+import com.cnbm.common.validator.AssertUtils;
+import com.cnbm.common.validator.ValidatorUtils;
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:23 PM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/sys/user")
+@Api(tags="用户管理")
+public class SysUserController {
+ @Autowired
+ private SysUserService sysUserService;
+ @Autowired
+ private SysRoleUserService sysRoleUserService;
+
+ @GetMapping("page")
+ @ApiOperation("分页")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
+ @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
+ @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String"),
+ @ApiImplicitParam(name = "gender", value = "性别", paramType = "query", dataType="String"),
+ @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType="String")
+ })
+ @PreAuthorize("@ex.hasAuthority('sys:user:page')")
+ public Result> page(@ApiIgnore @RequestParam Map params){
+ PageData page = sysUserService.page(params);
+
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ @ApiOperation("信息")
+ @PreAuthorize("@ex.hasAuthority('sys:user:info')")
+ public Result get(@PathVariable("id") Long id){
+ SysUserDTO data = sysUserService.get(id);
+
+ //用户角色列表
+ List roleIdList = sysRoleUserService.getRoleIdList(id);
+ data.setRoleIdList(roleIdList);
+
+ return new Result().ok(data);
+ }
+
+ @GetMapping("info")
+ @ApiOperation("登录用户信息")
+ public Result info(){
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ SysUserDTO data = ConvertUtils.sourceToTarget(loginUser.getSysUserEntity(), SysUserDTO.class);
+ return new Result().ok(data);
+ }
+
+ @PutMapping("password")
+ @ApiOperation("修改密码")
+ @LogOperation("修改密码")
+ public Result password(@RequestBody PasswordDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto);
+
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ SysUserEntity user = loginUser.getSysUserEntity();
+
+ //原密码不正确
+ if(!PasswordUtils.matches(dto.getPassword(), user.getPassword())){
+ return new Result().error(ErrorCode.PASSWORD_ERROR);
+ }
+
+ sysUserService.updatePassword(user.getId(), dto.getNewPassword());
+
+ return new Result();
+ }
+
+ @PostMapping
+ @ApiOperation("保存")
+ @LogOperation("保存")
+ @PreAuthorize("@ex.hasAuthority('sys:user:save')")
+ public Result save(@RequestBody SysUserDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+
+ sysUserService.save(dto);
+
+ return new Result();
+ }
+
+ @PutMapping
+ @ApiOperation("修改")
+ @LogOperation("修改")
+ @PreAuthorize("@ex.hasAuthority('sys:user:update')")
+ public Result update(@RequestBody SysUserDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+
+ sysUserService.update(dto);
+
+ return new Result();
+ }
+
+ @DeleteMapping
+ @ApiOperation("删除")
+ @LogOperation("删除")
+ @PreAuthorize("@ex.hasAuthority('sys:user:delete')")
+ public Result delete(@RequestBody Long[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+
+ sysUserService.deleteBatchIds(Arrays.asList(ids));
+
+ return new Result();
+ }
+
+ @GetMapping("export")
+ @ApiOperation("导出")
+ @LogOperation("导出")
+ @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String")
+ @PreAuthorize("@ex.hasAuthority('sys:user:export')")
+ public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = sysUserService.list(params);
+
+ ExcelUtils.exportExcelToTarget(response, null, list, SysUserExcel.class);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/LoginDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/LoginDao.java
new file mode 100644
index 0000000..94ea897
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/LoginDao.java
@@ -0,0 +1,14 @@
+package com.cnbm.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cnbm.admin.entity.SysUserEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 9:20 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface LoginDao extends BaseMapper {
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysDeptDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysDeptDao.java
new file mode 100644
index 0000000..a325fe9
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysDeptDao.java
@@ -0,0 +1,33 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysDeptEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:40 PM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysDeptDao extends BaseDao {
+
+ List getList(Map params);
+
+ SysDeptEntity getById(Long id);
+
+ /**
+ * 获取所有部门的id、pid列表
+ */
+ List getIdAndPidList();
+
+ /**
+ * 根据部门ID,获取所有子部门ID列表
+ * @param id 部门ID
+ */
+ List getSubDeptIdList(String id);
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysDictDataDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysDictDataDao.java
new file mode 100644
index 0000000..d1b207d
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysDictDataDao.java
@@ -0,0 +1,22 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.DictData;
+import com.cnbm.admin.entity.SysDictDataEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:56 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysDictDataDao extends BaseDao {
+
+ /**
+ * 字典数据列表
+ */
+ List getDictDataList();
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysDictTypeDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysDictTypeDao.java
new file mode 100644
index 0000000..5aa0d9e
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysDictTypeDao.java
@@ -0,0 +1,23 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.DictType;
+import com.cnbm.admin.entity.SysDictTypeEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:56 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysDictTypeDao extends BaseDao {
+
+ /**
+ * 字典类型列表
+ */
+ List getDictTypeList();
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysLogErrorDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysLogErrorDao.java
new file mode 100644
index 0000000..81a6a54
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysLogErrorDao.java
@@ -0,0 +1,15 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysLogErrorEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:07 PM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysLogErrorDao extends BaseDao {
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysLogOperationDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysLogOperationDao.java
new file mode 100644
index 0000000..c5879d6
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysLogOperationDao.java
@@ -0,0 +1,15 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysLogOperationEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:54 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysLogOperationDao extends BaseDao {
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysMenuDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysMenuDao.java
new file mode 100644
index 0000000..ea264bf
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysMenuDao.java
@@ -0,0 +1,52 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysMenuEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:33 PM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysMenuDao extends BaseDao {
+
+ SysMenuEntity getById(@Param("id") Long id);
+
+ /**
+ * 查询所有菜单列表
+ *
+ * @param type 菜单类型
+ */
+ List getMenuList(@Param("type") Integer type);
+
+ /**
+ * 查询用户菜单列表
+ *
+ * @param userId 用户ID
+ * @param type 菜单类型
+ */
+ List getUserMenuList(@Param("userId") Long userId, @Param("type") Integer type);
+
+ /**
+ * 查询用户权限列表
+ * @param userId 用户ID
+ */
+ List getUserPermissionsList(Long userId);
+
+ /**
+ * 查询所有权限列表
+ */
+ List getPermissionsList();
+
+ /**
+ * 根据父菜单,查询子菜单
+ * @param pid 父菜单ID
+ */
+ List getListPid(Long pid);
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysParamsDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysParamsDao.java
new file mode 100644
index 0000000..1b0e290
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysParamsDao.java
@@ -0,0 +1,37 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysParamsEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:21 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysParamsDao extends BaseDao {
+ /**
+ * 根据参数编码,查询value
+ * @param paramCode 参数编码
+ * @return 参数值
+ */
+ String getValueByCode(String paramCode);
+
+ /**
+ * 获取参数编码列表
+ * @param ids ids
+ * @return 返回参数编码列表
+ */
+ List getParamCodeList(Long[] ids);
+
+ /**
+ * 根据参数编码,更新value
+ * @param paramCode 参数编码
+ * @param paramValue 参数值
+ */
+ int updateValueByCode(@Param("paramCode") String paramCode, @Param("paramValue") String paramValue);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDao.java
new file mode 100644
index 0000000..463d4bf
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDao.java
@@ -0,0 +1,16 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysRoleEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:05 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysRoleDao extends BaseDao {
+
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDataScopeDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDataScopeDao.java
new file mode 100644
index 0000000..62639b7
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleDataScopeDao.java
@@ -0,0 +1,32 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysRoleDataScopeEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:15 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysRoleDataScopeDao extends BaseDao {
+
+ /**
+ * 根据角色ID,获取部门ID列表
+ */
+ List getDeptIdList(Long roleId);
+
+ /**
+ * 获取用户的部门数据权限列表
+ */
+ List getDataScopeList(Long userId);
+
+ /**
+ * 根据角色id,删除角色数据权限关系
+ * @param roleIds 角色ids
+ */
+ void deleteByRoleIds(Long[] roleIds);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleMenuDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleMenuDao.java
new file mode 100644
index 0000000..c9aedd7
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleMenuDao.java
@@ -0,0 +1,34 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysRoleMenuEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:15 PM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysRoleMenuDao extends BaseDao {
+
+ /**
+ * 根据角色ID,获取菜单ID列表
+ */
+ List getMenuIdList(Long roleId);
+
+ /**
+ * 根据角色id,删除角色菜单关系
+ * @param roleIds 角色ids
+ */
+ void deleteByRoleIds(Long[] roleIds);
+
+ /**
+ * 根据菜单id,删除角色菜单关系
+ * @param menuId 菜单id
+ */
+ void deleteByMenuId(Long menuId);
+}
+
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleUserDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleUserDao.java
new file mode 100644
index 0000000..a45d1e2
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysRoleUserDao.java
@@ -0,0 +1,36 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysRoleUserEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:35 PM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysRoleUserDao extends BaseDao {
+
+ /**
+ * 根据角色ids,删除角色用户关系
+ * @param roleIds 角色ids
+ */
+ void deleteByRoleIds(Long[] roleIds);
+
+ /**
+ * 根据用户id,删除角色用户关系
+ * @param userIds 用户ids
+ */
+ void deleteByUserIds(Long[] userIds);
+
+ /**
+ * 角色ID列表
+ * @param userId 用户ID
+ *
+ * @return
+ */
+ List getRoleIdList(Long userId);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/SysUserDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/SysUserDao.java
new file mode 100644
index 0000000..9b43a8f
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/SysUserDao.java
@@ -0,0 +1,36 @@
+package com.cnbm.admin.dao;
+
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:27 PM
+ * @Version 1.0
+ */
+@Mapper
+public interface SysUserDao extends BaseDao {
+
+ List getList(Map params);
+
+ SysUserEntity getById(Long id);
+
+ SysUserEntity getByUsername(String username);
+
+ int updatePassword(@Param("id") Long id, @Param("newPassword") String newPassword);
+
+ /**
+ * 根据部门ID,查询用户数
+ */
+ int getCountByDeptId(Long deptId);
+
+ /**
+ * 根据部门ID,查询用户ID列表
+ */
+ List getUserIdListByDeptId(List deptIdList);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dao/UserDao.java b/ym-admin/src/main/java/com/cnbm/admin/dao/UserDao.java
new file mode 100644
index 0000000..608f18d
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dao/UserDao.java
@@ -0,0 +1,14 @@
+package com.cnbm.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cnbm.admin.entity.SysUserEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/9 8:57 AM
+ * @Version 1.0
+ */
+@Mapper
+public interface UserDao extends BaseMapper {
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/PasswordDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/PasswordDTO.java
new file mode 100644
index 0000000..49951df
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/PasswordDTO.java
@@ -0,0 +1,28 @@
+package com.cnbm.admin.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:59 PM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "修改密码")
+public class PasswordDTO implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "原密码")
+ @NotBlank(message="{sysuser.password.require}")
+ private String password;
+
+ @ApiModelProperty(value = "新密码")
+ @NotBlank(message="{sysuser.password.require}")
+ private String newPassword;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysDeptDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysDeptDTO.java
new file mode 100644
index 0000000..699c065
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysDeptDTO.java
@@ -0,0 +1,102 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.utils.TreeNode;
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+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;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:39 PM
+ * @Version 1.0
+ */
+@ApiModel(value = "部门管理")
+public class SysDeptDTO extends TreeNode 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="{sysdept.pid.require}", groups = DefaultGroup.class)
+ private Long pid;
+
+ @ApiModelProperty(value = "部门名称")
+ @NotBlank(message="{sysdept.name.require}", groups = DefaultGroup.class)
+ private String name;
+
+ @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 String parentName;
+
+ @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 getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getSort() {
+ return sort;
+ }
+
+ public void setSort(Integer sort) {
+ this.sort = sort;
+ }
+
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+ public String getParentName() {
+ return parentName;
+ }
+
+ public void setParentName(String parentName) {
+ this.parentName = parentName;
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysDictDataDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysDictDataDTO.java
new file mode 100644
index 0000000..998b055
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysDictDataDTO.java
@@ -0,0 +1,58 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+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;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:57 AM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "字典数据")
+public class SysDictDataDTO 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="{sysdict.type.require}", groups = DefaultGroup.class)
+ private Long dictTypeId;
+
+ @ApiModelProperty(value = "字典标签")
+ @NotBlank(message="{sysdict.label.require}", groups = DefaultGroup.class)
+ private String dictLabel;
+
+ @ApiModelProperty(value = "字典值")
+ private String dictValue;
+
+ @ApiModelProperty(value = "备注")
+ private String remark;
+
+ @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 = "更新时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date updateDate;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysDictTypeDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysDictTypeDTO.java
new file mode 100644
index 0000000..2492798
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysDictTypeDTO.java
@@ -0,0 +1,55 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+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;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:57 AM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "字典类型")
+public class SysDictTypeDTO 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 = "字典类型")
+ @NotBlank(message="{sysdict.type.require}", groups = DefaultGroup.class)
+ private String dictType;
+
+ @ApiModelProperty(value = "字典名称")
+ @NotBlank(message="{sysdict.name.require}", groups = DefaultGroup.class)
+ private String dictName;
+
+ @ApiModelProperty(value = "备注")
+ private String remark;
+
+ @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 = "更新时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date updateDate;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysLogErrorDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysLogErrorDTO.java
new file mode 100644
index 0000000..729b5d7
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysLogErrorDTO.java
@@ -0,0 +1,37 @@
+package com.cnbm.admin.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:07 PM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "异常日志")
+public class SysLogErrorDTO implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "id")
+ private Long id;
+ @ApiModelProperty(value = "请求URI")
+ private String requestUri;
+ @ApiModelProperty(value = "请求方式")
+ private String requestMethod;
+ @ApiModelProperty(value = "请求参数")
+ private String requestParams;
+ @ApiModelProperty(value = "用户代理")
+ private String userAgent;
+ @ApiModelProperty(value = "操作IP")
+ private String ip;
+ @ApiModelProperty(value = "异常信息")
+ private String errorInfo;
+ @ApiModelProperty(value = "创建时间")
+ private Date createDate;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysLogOperationDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysLogOperationDTO.java
new file mode 100644
index 0000000..3bdc9f6
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysLogOperationDTO.java
@@ -0,0 +1,53 @@
+package com.cnbm.admin.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:53 AM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "操作日志")
+public class SysLogOperationDTO implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "id")
+ private Long id;
+
+ @ApiModelProperty(value = "用户操作")
+ private String operation;
+
+ @ApiModelProperty(value = "请求URI")
+ private String requestUri;
+
+ @ApiModelProperty(value = "请求方式")
+ private String requestMethod;
+
+ @ApiModelProperty(value = "请求参数")
+ private String requestParams;
+
+ @ApiModelProperty(value = "请求时长(毫秒)")
+ private Integer requestTime;
+
+ @ApiModelProperty(value = "用户代理")
+ private String userAgent;
+
+ @ApiModelProperty(value = "操作IP")
+ private String ip;
+
+ @ApiModelProperty(value = "状态 0:失败 1:成功")
+ private Integer status;
+
+ @ApiModelProperty(value = "用户名")
+ private String creatorName;
+
+ @ApiModelProperty(value = "创建时间")
+ private Date createDate;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysMenuDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysMenuDTO.java
new file mode 100644
index 0000000..fcc41c2
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysMenuDTO.java
@@ -0,0 +1,148 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.utils.TreeNode;
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.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;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:33 PM
+ * @Version 1.0
+ */
+@ApiModel(value = "菜单管理")
+public class SysMenuDTO extends TreeNode 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:user:list,sys:user: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 String parentName;
+
+ @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 getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public Integer getType() {
+ return type;
+ }
+
+ public void setType(Integer type) {
+ this.type = type;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ public String getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(String permissions) {
+ this.permissions = permissions;
+ }
+
+ public Integer getSort() {
+ return sort;
+ }
+
+ public void setSort(Integer sort) {
+ this.sort = sort;
+ }
+
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+ public String getParentName() {
+ return parentName;
+ }
+
+ public void setParentName(String parentName) {
+ this.parentName = parentName;
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysParamsDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysParamsDTO.java
new file mode 100644
index 0000000..46c2245
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysParamsDTO.java
@@ -0,0 +1,51 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Null;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:21 AM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "参数管理")
+public class SysParamsDTO 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 = "参数编码")
+ @NotBlank(message="{sysparams.paramcode.require}", groups = DefaultGroup.class)
+ private String paramCode;
+
+ @ApiModelProperty(value = "参数值")
+ @NotBlank(message="{sysparams.paramvalue.require}", groups = DefaultGroup.class)
+ private String paramValue;
+
+ @ApiModelProperty(value = "备注")
+ private String remark;
+
+ @ApiModelProperty(value = "创建时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date createDate;
+
+ @ApiModelProperty(value = "更新时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date updateDate;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysRoleDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysRoleDTO.java
new file mode 100644
index 0000000..e69f7a5
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysRoleDTO.java
@@ -0,0 +1,50 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+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 weihongyang
+ * @Date 2022/6/12 10:06 AM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "角色管理")
+public class SysRoleDTO 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 = "角色名称")
+ @NotBlank(message="{sysrole.name.require}", groups = DefaultGroup.class)
+ private String name;
+
+ @ApiModelProperty(value = "备注")
+ private String remark;
+
+ @ApiModelProperty(value = "创建时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date createDate;
+
+ @ApiModelProperty(value = "菜单ID列表")
+ private List menuIdList;
+
+ @ApiModelProperty(value = "部门ID列表")
+ private List deptIdList;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/dto/SysUserDTO.java b/ym-admin/src/main/java/com/cnbm/admin/dto/SysUserDTO.java
new file mode 100644
index 0000000..14f1a99
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/dto/SysUserDTO.java
@@ -0,0 +1,84 @@
+package com.cnbm.admin.dto;
+
+import com.cnbm.common.validator.group.AddGroup;
+import com.cnbm.common.validator.group.DefaultGroup;
+import com.cnbm.common.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.hibernate.validator.constraints.Range;
+
+import javax.validation.constraints.Email;
+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 weihongyang
+ * @Date 2022/6/10 1:26 PM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "用户管理")
+public class SysUserDTO 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 = "用户名", required = true)
+ @NotBlank(message="{sysuser.username.require}", groups = DefaultGroup.class)
+ private String username;
+
+ @ApiModelProperty(value = "密码")
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ @NotBlank(message="{sysuser.password.require}", groups = AddGroup.class)
+ private String password;
+
+ @ApiModelProperty(value = "姓名", required = true)
+ @NotBlank(message="{sysuser.realname.require}", groups = DefaultGroup.class)
+ private String realName;
+
+ @ApiModelProperty(value = "头像")
+ private String headUrl;
+
+ @ApiModelProperty(value = "性别 0:男 1:女 2:保密", required = true)
+ @Range(min=0, max=2, message = "{sysuser.gender.range}", groups = DefaultGroup.class)
+ private Integer gender;
+
+ @ApiModelProperty(value = "邮箱")
+ @Email(message="{sysuser.email.error}", groups = DefaultGroup.class)
+ private String email;
+
+ @ApiModelProperty(value = "手机号")
+ private String mobile;
+
+ @ApiModelProperty(value = "部门ID", required = true)
+ @NotNull(message="{sysuser.deptId.require}", groups = DefaultGroup.class)
+ private Long deptId;
+
+ @ApiModelProperty(value = "状态 0:停用 1:正常", required = true)
+ @Range(min=0, max=1, message = "{sysuser.status.range}", groups = DefaultGroup.class)
+ private Integer status;
+
+ @ApiModelProperty(value = "创建时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date createDate;
+
+ @ApiModelProperty(value = "超级管理员 0:否 1:是")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Integer superAdmin;
+
+ @ApiModelProperty(value = "角色ID列表")
+ private List roleIdList;
+
+ @ApiModelProperty(value = "部门名称")
+ private String deptName;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/DictData.java b/ym-admin/src/main/java/com/cnbm/admin/entity/DictData.java
new file mode 100644
index 0000000..e629104
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/DictData.java
@@ -0,0 +1,17 @@
+package com.cnbm.admin.entity;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 11:01 AM
+ * @Version 1.0
+ */
+@Data
+public class DictData {
+ @JsonIgnore
+ private Long dictTypeId;
+ private String dictLabel;
+ private String dictValue;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/DictType.java b/ym-admin/src/main/java/com/cnbm/admin/entity/DictType.java
new file mode 100644
index 0000000..37ddd23
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/DictType.java
@@ -0,0 +1,20 @@
+package com.cnbm.admin.entity;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 11:00 AM
+ * @Version 1.0
+ */
+@Data
+public class DictType {
+ @JsonIgnore
+ private Long id;
+ private String dictType;
+ private List dataList = new ArrayList<>();
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java b/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java
new file mode 100644
index 0000000..6729ecd
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java
@@ -0,0 +1,83 @@
+package com.cnbm.admin.entity;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 1:56 PM
+ * @Version 1.0
+ */
+@Data
+@NoArgsConstructor
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LoginUser implements UserDetails {
+
+ private SysUserEntity sysUserEntity;
+
+ private List permissions;
+
+ public LoginUser(SysUserEntity sysUserEntity, List permissions) {
+ this.sysUserEntity = sysUserEntity;
+ this.permissions = permissions;
+ }
+
+ @JsonIgnore
+ private List authorities;
+ @Override
+ public Collection extends GrantedAuthority> getAuthorities() {
+ if(authorities!=null){
+ return authorities;
+ }
+ //把permissions中String类型的权限信息封装成SimpleGrantedAuthority对象
+// authorities = new ArrayList<>();
+// for (String permission : permissions) {
+// SimpleGrantedAuthority authority = new SimpleGrantedAuthority(permission);
+// authorities.add(authority);
+// }
+ authorities = permissions.stream()
+ .map(SimpleGrantedAuthority::new)
+ .collect(Collectors.toList());
+ return authorities;
+ }
+
+ @Override
+ public String getPassword() {
+ return sysUserEntity.getPassword();
+ }
+
+ @Override
+ public String getUsername() {
+ return sysUserEntity.getUsername();
+ }
+
+ @Override
+ public boolean isAccountNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isAccountNonLocked() {
+ return true;
+ }
+
+ @Override
+ public boolean isCredentialsNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
+
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysDeptEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysDeptEntity.java
new file mode 100644
index 0000000..436cbbf
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysDeptEntity.java
@@ -0,0 +1,55 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:39 PM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_dept")
+public class SysDeptEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 上级ID
+ */
+ private Long pid;
+ /**
+ * 所有上级ID,用逗号分开
+ */
+ private String pids;
+ /**
+ * 部门名称
+ */
+ private String name;
+ /**
+ * 排序
+ */
+ private Integer sort;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+ /**
+ * 上级部门名称
+ */
+ @TableField(exist = false)
+ private String parentName;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysDictDataEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysDictDataEntity.java
new file mode 100644
index 0000000..2726cce
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysDictDataEntity.java
@@ -0,0 +1,52 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:57 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_dict_data")
+public class SysDictDataEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+ /**
+ * 字典类型ID
+ */
+ private Long dictTypeId;
+ /**
+ * 字典标签
+ */
+ private String dictLabel;
+ /**
+ * 字典值
+ */
+ private String dictValue;
+ /**
+ * 备注
+ */
+ private String remark;
+ /**
+ * 排序
+ */
+ private Integer sort;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysDictTypeEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysDictTypeEntity.java
new file mode 100644
index 0000000..103054e
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysDictTypeEntity.java
@@ -0,0 +1,48 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:58 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_dict_type")
+public class SysDictTypeEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+ /**
+ * 字典类型
+ */
+ private String dictType;
+ /**
+ * 字典名称
+ */
+ private String dictName;
+ /**
+ * 备注
+ */
+ private String remark;
+ /**
+ * 排序
+ */
+ private Integer sort;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysLogErrorEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysLogErrorEntity.java
new file mode 100644
index 0000000..f2cbc59
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysLogErrorEntity.java
@@ -0,0 +1,44 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:08 PM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_log_error")
+public class SysLogErrorEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 请求URI
+ */
+ private String requestUri;
+ /**
+ * 请求方式
+ */
+ private String requestMethod;
+ /**
+ * 请求参数
+ */
+ private String requestParams;
+ /**
+ * 用户代理
+ */
+ private String userAgent;
+ /**
+ * 操作IP
+ */
+ private String ip;
+ /**
+ * 异常信息
+ */
+ private String errorInfo;
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysLogOperationEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysLogOperationEntity.java
new file mode 100644
index 0000000..98cd9dc
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysLogOperationEntity.java
@@ -0,0 +1,55 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:49 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_log_operation")
+public class SysLogOperationEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 用户操作
+ */
+ private String operation;
+ /**
+ * 请求URI
+ */
+ private String requestUri;
+ /**
+ * 请求方式
+ */
+ private String requestMethod;
+ /**
+ * 请求参数
+ */
+ private String requestParams;
+ /**
+ * 请求时长(毫秒)
+ */
+ private Integer requestTime;
+ /**
+ * 用户代理
+ */
+ private String userAgent;
+ /**
+ * 操作IP
+ */
+ private String ip;
+ /**
+ * 状态 0:失败 1:成功
+ */
+ private Integer status;
+ /**
+ * 用户名
+ */
+ private String creatorName;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysMenuEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysMenuEntity.java
new file mode 100644
index 0000000..3843d0a
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysMenuEntity.java
@@ -0,0 +1,67 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:28 PM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_menu")
+public class SysMenuEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 父菜单ID,一级菜单为0
+ */
+ private Long pid;
+ /**
+ * 菜单名称
+ */
+ private String name;
+ /**
+ * 菜单URL
+ */
+ private String url;
+ /**
+ * 授权(多个用逗号分隔,如:sys:user:list,sys:user:save)
+ */
+ private String permissions;
+ /**
+ * 类型 0:菜单 1:按钮
+ */
+ private Integer type;
+ /**
+ * 菜单图标
+ */
+ private String icon;
+ /**
+ * 排序
+ */
+ private Integer sort;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+ /**
+ * 上级菜单名称
+ */
+ @TableField(exist = false)
+ private String parentName;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysParamsEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysParamsEntity.java
new file mode 100644
index 0000000..67aafbc
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysParamsEntity.java
@@ -0,0 +1,50 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:22 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_params")
+public class SysParamsEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 参数编码
+ */
+ private String paramCode;
+ /**
+ * 参数值
+ */
+ private String paramValue;
+ /**
+ * 类型 0:系统参数 1:非系统参数
+ */
+ private Integer paramType;
+ /**
+ * 备注
+ */
+ private String remark;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleDataScopeEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleDataScopeEntity.java
new file mode 100644
index 0000000..7e73287
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleDataScopeEntity.java
@@ -0,0 +1,28 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:14 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role_data_scope")
+public class SysRoleDataScopeEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色ID
+ */
+ private Long roleId;
+ /**
+ * 部门ID
+ */
+ private Long deptId;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleEntity.java
new file mode 100644
index 0000000..b96a570
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleEntity.java
@@ -0,0 +1,46 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:06 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role")
+public class SysRoleEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色名称
+ */
+ private String name;
+ /**
+ * 备注
+ */
+ private String remark;
+ /**
+ * 部门ID
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleMenuEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleMenuEntity.java
new file mode 100644
index 0000000..caf8b8b
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleMenuEntity.java
@@ -0,0 +1,27 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:16 PM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role_menu")
+public class SysRoleMenuEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+ /**
+ * 角色ID
+ */
+ private Long roleId;
+ /**
+ * 菜单ID
+ */
+ private Long menuId;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleUserEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleUserEntity.java
new file mode 100644
index 0000000..fd748f8
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysRoleUserEntity.java
@@ -0,0 +1,29 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:34 PM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role_user")
+public class SysRoleUserEntity extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色ID
+ */
+ private Long roleId;
+ /**
+ * 用户ID
+ */
+ private Long userId;
+
+}
+
diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/SysUserEntity.java b/ym-admin/src/main/java/com/cnbm/admin/entity/SysUserEntity.java
new file mode 100644
index 0000000..22d9eef
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/entity/SysUserEntity.java
@@ -0,0 +1,80 @@
+package com.cnbm.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cnbm.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 9:19 AM
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_user")
+public class SysUserEntity extends BaseEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 用户名
+ */
+ private String username;
+ /**
+ * 密码
+ */
+ private String password;
+ /**
+ * 姓名
+ */
+ private String realName;
+ /**
+ * 头像
+ */
+ private String headUrl;
+ /**
+ * 性别 0:男 1:女 2:保密
+ */
+ private Integer gender;
+ /**
+ * 邮箱
+ */
+ private String email;
+ /**
+ * 手机号
+ */
+ private String mobile;
+ /**
+ * 部门ID
+ */
+ private Long deptId;
+ /**
+ * 超级管理员 0:否 1:是
+ */
+ private Integer superAdmin;
+ /**
+ * 状态 0:停用 1:正常
+ */
+ private Integer status;
+ /**
+ * 更新者
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updater;
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Date updateDate;
+ /**
+ * 部门名称
+ */
+ @TableField(exist=false)
+ private String deptName;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/enums/MenuTypeEnum.java b/ym-admin/src/main/java/com/cnbm/admin/enums/MenuTypeEnum.java
new file mode 100644
index 0000000..2851fd5
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/enums/MenuTypeEnum.java
@@ -0,0 +1,27 @@
+package com.cnbm.admin.enums;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 3:01 PM
+ * @Version 1.0
+ */
+public enum MenuTypeEnum {
+ /**
+ * 菜单
+ */
+ MENU(0),
+ /**
+ * 按钮
+ */
+ BUTTON(1);
+
+ private int value;
+
+ MenuTypeEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/enums/OperationStatusEnum.java b/ym-admin/src/main/java/com/cnbm/admin/enums/OperationStatusEnum.java
new file mode 100644
index 0000000..032fc80
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/enums/OperationStatusEnum.java
@@ -0,0 +1,27 @@
+package com.cnbm.admin.enums;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 10:10 AM
+ * @Version 1.0
+ */
+public enum OperationStatusEnum {
+ /**
+ * 失败
+ */
+ FAIL(0),
+ /**
+ * 成功
+ */
+ SUCCESS(1);
+
+ private int value;
+
+ OperationStatusEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/enums/SuperAdminEnum.java b/ym-admin/src/main/java/com/cnbm/admin/enums/SuperAdminEnum.java
new file mode 100644
index 0000000..bde5082
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/enums/SuperAdminEnum.java
@@ -0,0 +1,21 @@
+package com.cnbm.admin.enums;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:02 PM
+ * @Version 1.0
+ */
+public enum SuperAdminEnum {
+ YES(1),
+ NO(0);
+
+ private int value;
+
+ SuperAdminEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/exception/RenExceptionHandler.java b/ym-admin/src/main/java/com/cnbm/admin/exception/RenExceptionHandler.java
new file mode 100644
index 0000000..3c2b5d8
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/exception/RenExceptionHandler.java
@@ -0,0 +1,87 @@
+package com.cnbm.admin.exception;
+
+import cn.hutool.core.map.MapUtil;
+import com.cnbm.admin.entity.SysLogErrorEntity;
+import com.cnbm.admin.service.SysLogErrorService;
+import com.cnbm.common.exception.ErrorCode;
+import com.cnbm.common.exception.ExceptionUtils;
+import com.cnbm.common.exception.RenException;
+import com.cnbm.common.utils.HttpContextUtils;
+import com.cnbm.common.utils.IpUtils;
+import com.cnbm.common.utils.JsonUtils;
+import com.cnbm.common.utils.Result;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:05 PM
+ * @Version 1.0
+ */
+//@RestControllerAdvice
+//public class RenExceptionHandler {
+// private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
+//
+// @Autowired
+// private SysLogErrorService sysLogErrorService;
+//
+// /**
+// * 处理自定义异常
+// */
+// @ExceptionHandler(RenException.class)
+// public Result handleRenException(RenException ex){
+// Result result = new Result();
+// result.error(ex.getCode(), ex.getMsg());
+//
+// return result;
+// }
+//
+// @ExceptionHandler(DuplicateKeyException.class)
+// public Result handleDuplicateKeyException(DuplicateKeyException ex){
+// Result result = new Result();
+// result.error(ErrorCode.DB_RECORD_EXISTS);
+//
+// return result;
+// }
+//
+// @ExceptionHandler(Exception.class)
+// public Result handleException(Exception ex){
+// logger.error(ex.getMessage(), ex);
+//
+// saveLog(ex);
+//
+// return new Result().error();
+// }
+//
+// /**
+// * 保存异常日志
+// */
+// private void saveLog(Exception ex){
+// SysLogErrorEntity log = new SysLogErrorEntity();
+//
+// //请求相关信息
+// HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
+// log.setIp(IpUtils.getIpAddr(request));
+// log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
+// log.setRequestUri(request.getRequestURI());
+// log.setRequestMethod(request.getMethod());
+// Map params = HttpContextUtils.getParameterMap(request);
+// if(MapUtil.isNotEmpty(params)){
+// log.setRequestParams(JsonUtils.toJsonString(params));
+// }
+//
+// //异常信息
+// log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex));
+//
+// //保存
+// sysLogErrorService.save(log);
+// }
+//}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/execl/SysLogErrorExcel.java b/ym-admin/src/main/java/com/cnbm/admin/execl/SysLogErrorExcel.java
new file mode 100644
index 0000000..4cfbb17
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/execl/SysLogErrorExcel.java
@@ -0,0 +1,28 @@
+package com.cnbm.admin.execl;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:14 PM
+ * @Version 1.0
+ */
+@Data
+public class SysLogErrorExcel {
+ @Excel(name = "请求URI")
+ private String requestUri;
+ @Excel(name = "请求方式")
+ private String requestMethod;
+ @Excel(name = "请求参数")
+ private String requestParams;
+ @Excel(name = "User-Agent")
+ private String userAgent;
+ @Excel(name = "操作IP")
+ private String ip;
+ @Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
+ private Date createDate;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/execl/SysLogOperationExcel.java b/ym-admin/src/main/java/com/cnbm/admin/execl/SysLogOperationExcel.java
new file mode 100644
index 0000000..2431fd0
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/execl/SysLogOperationExcel.java
@@ -0,0 +1,36 @@
+package com.cnbm.admin.execl;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 10:06 AM
+ * @Version 1.0
+ */
+@Data
+public class SysLogOperationExcel {
+ @Excel(name = "用户操作")
+ private String operation;
+ @Excel(name = "请求URI")
+ private String requestUri;
+ @Excel(name = "请求方式")
+ private String requestMethod;
+ @Excel(name = "请求参数")
+ private String requestParams;
+ @Excel(name = "请求时长(毫秒)")
+ private Integer requestTime;
+ @Excel(name = "User-Agent")
+ private String userAgent;
+ @Excel(name = "操作IP")
+ private String ip;
+ @Excel(name = "状态", replace = {"失败_0", "成功_1"})
+ private Integer status;
+ @Excel(name = "用户名")
+ private String creatorName;
+ @Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
+ private Date createDate;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/execl/SysParamsExcel.java b/ym-admin/src/main/java/com/cnbm/admin/execl/SysParamsExcel.java
new file mode 100644
index 0000000..19e250e
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/execl/SysParamsExcel.java
@@ -0,0 +1,20 @@
+package com.cnbm.admin.execl;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:26 AM
+ * @Version 1.0
+ */
+@Data
+public class SysParamsExcel {
+ @Excel(name = "参数编码")
+ private String paramCode;
+ @Excel(name = "参数值")
+ private String paramValue;
+ @Excel(name = "备注")
+ private String remark;
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/execl/SysUserExcel.java b/ym-admin/src/main/java/com/cnbm/admin/execl/SysUserExcel.java
new file mode 100644
index 0000000..36aa0e1
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/execl/SysUserExcel.java
@@ -0,0 +1,34 @@
+package com.cnbm.admin.execl;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:25 PM
+ * @Version 1.0
+ */
+@Data
+public class SysUserExcel {
+ @Excel(name = "用户名")
+ private String username;
+ @Excel(name = "姓名")
+ private String realName;
+ @Excel(name = "性别", replace = {"男_0", "女_1", "保密_2"})
+ private Integer gender;
+ @Excel(name = "邮箱")
+ private String email;
+ @Excel(name = "手机号")
+ private String mobile;
+ @Excel(name = "部门名称")
+ private String deptName;
+ @Excel(name = "状态", replace = {"停用_0", "正常_1"})
+ private Integer status;
+ @Excel(name = "备注")
+ private String remark;
+ @Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
+ private Date createDate;
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/filter/JwtAuthenticationTokenFilter.java b/ym-admin/src/main/java/com/cnbm/admin/filter/JwtAuthenticationTokenFilter.java
new file mode 100644
index 0000000..3730eb8
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/filter/JwtAuthenticationTokenFilter.java
@@ -0,0 +1,65 @@
+package com.cnbm.admin.filter;
+
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.utils.JwtUtil;
+import io.jsonwebtoken.Claims;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 1:51 PM
+ * @Version 1.0
+ */
+@Component
+public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
+
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
+ //获取token
+// String token = request.getHeader("Authorization");
+ String token = request.getHeader("token");
+ if (!StringUtils.hasText(token)) {
+ //放行
+ filterChain.doFilter(request, response);
+ return;
+ }
+ //解析token
+ String userid;
+ try {
+ Claims claims = JwtUtil.parseJWT(token);
+ userid = claims.getSubject();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("token非法");
+ }
+ //从redis中获取用户信息
+ String redisKey = "login:" + userid;
+ LoginUser loginUser = (LoginUser) redisTemplate.opsForValue().get(redisKey);
+ if(Objects.isNull(loginUser)){
+ throw new RuntimeException("用户未登录");
+ }
+ //存入SecurityContextHolder
+ //TODO 获取权限信息封装到Authentication中
+ UsernamePasswordAuthenticationToken authenticationToken =
+ new UsernamePasswordAuthenticationToken(loginUser,null,loginUser.getAuthorities());
+ SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+ //放行
+ filterChain.doFilter(request, response);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/handler/AccessDeniedHandlerImpl.java b/ym-admin/src/main/java/com/cnbm/admin/handler/AccessDeniedHandlerImpl.java
new file mode 100644
index 0000000..45d58b0
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/handler/AccessDeniedHandlerImpl.java
@@ -0,0 +1,30 @@
+package com.cnbm.admin.handler;
+
+import com.cnbm.admin.utils.ResponseResult;
+import com.cnbm.admin.utils.WebUtils;
+import com.cnbm.common.utils.JsonUtils;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.web.access.AccessDeniedHandler;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/9 11:55 AM
+ * @Version 1.0
+ */
+@Component
+public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
+ @Override
+ public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
+ ResponseResult result = new ResponseResult(HttpStatus.FORBIDDEN.value(),"您的权限不足");
+ String json = JsonUtils.toJsonString(result);
+ //处理异常
+ WebUtils.renderString(response,json);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/handler/AuthenticationEntryPointImpl.java b/ym-admin/src/main/java/com/cnbm/admin/handler/AuthenticationEntryPointImpl.java
new file mode 100644
index 0000000..e982cae
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/handler/AuthenticationEntryPointImpl.java
@@ -0,0 +1,30 @@
+package com.cnbm.admin.handler;
+
+import com.cnbm.admin.utils.ResponseResult;
+import com.cnbm.admin.utils.WebUtils;
+import com.cnbm.common.utils.JsonUtils;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/9 1:27 PM
+ * @Version 1.0
+ */
+@Component
+public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
+ @Override
+ public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
+ ResponseResult result = new ResponseResult(HttpStatus.UNAUTHORIZED.value(),"用户认证失败请查询登录");
+ String json = JsonUtils.toJsonString(result);
+ //处理异常
+ WebUtils.renderString(response,json);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/params/LoginParam.java b/ym-admin/src/main/java/com/cnbm/admin/params/LoginParam.java
new file mode 100644
index 0000000..9f6ad5f
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/params/LoginParam.java
@@ -0,0 +1,36 @@
+package com.cnbm.admin.params;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 9:29 AM
+ * @Version 1.0
+ */
+@Data
+@ApiModel(value = "登录表单")
+public class LoginParam implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "用户名", required = true)
+ @NotBlank(message="用户名不能为空")
+ private String username;
+
+ @ApiModelProperty(value = "密码" , required = true)
+ @NotBlank(message="密码不能为空")
+ private String password;
+
+ @ApiModelProperty(value = "验证码" , required = true)
+ @NotBlank(message="验证码不能为空")
+ private String captcha;
+
+ @ApiModelProperty(value = "唯一标识" , required = true)
+ @NotBlank(message="uuid不能为空")
+ private String uuid;
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/redis/SysParamsRedis.java b/ym-admin/src/main/java/com/cnbm/admin/redis/SysParamsRedis.java
new file mode 100644
index 0000000..8914741
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/redis/SysParamsRedis.java
@@ -0,0 +1,36 @@
+package com.cnbm.admin.redis;
+
+import com.cnbm.common.redis.RedisKeys;
+import com.cnbm.common.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:48 AM
+ * @Version 1.0
+ */
+@Component
+public class SysParamsRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] paramCodes) {
+ String key = RedisKeys.getSysParamsKey();
+ redisUtils.hDel(key, paramCodes);
+ }
+
+ public void set(String paramCode, String paramValue){
+ if(paramValue == null){
+ return ;
+ }
+ String key = RedisKeys.getSysParamsKey();
+ redisUtils.hSet(key, paramCode, paramValue);
+ }
+
+ public String get(String paramCode){
+ String key = RedisKeys.getSysParamsKey();
+ return (String)redisUtils.hGet(key, paramCode);
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/CaptchaService.java b/ym-admin/src/main/java/com/cnbm/admin/service/CaptchaService.java
new file mode 100644
index 0000000..5415ece
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/CaptchaService.java
@@ -0,0 +1,9 @@
+package com.cnbm.admin.service;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 8:55 AM
+ * @Version 1.0
+ */
+public interface CaptchaService {
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/LoginService.java b/ym-admin/src/main/java/com/cnbm/admin/service/LoginService.java
new file mode 100644
index 0000000..2dfce88
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/LoginService.java
@@ -0,0 +1,16 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.params.LoginParam;
+import com.cnbm.admin.utils.ResponseResult;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 9:17 AM
+ * @Version 1.0
+ */
+public interface LoginService {
+
+ ResponseResult login(HttpServletRequest request, LoginParam loginParam);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysDeptService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysDeptService.java
new file mode 100644
index 0000000..9021e99
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysDeptService.java
@@ -0,0 +1,32 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysDeptDTO;
+import com.cnbm.admin.entity.SysDeptEntity;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:38 PM
+ * @Version 1.0
+ */
+public interface SysDeptService extends BaseService {
+
+ List list(Map params);
+
+ SysDeptDTO get(Long id);
+
+ void save(SysDeptDTO dto);
+
+ void update(SysDeptDTO dto);
+
+ void delete(Long id);
+
+ /**
+ * 根据部门ID,获取本部门及子部门ID列表
+ * @param id 部门ID
+ */
+ List getSubDeptIdList(Long id);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysDictDataService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysDictDataService.java
new file mode 100644
index 0000000..d0fb717
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysDictDataService.java
@@ -0,0 +1,27 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysDictDataDTO;
+import com.cnbm.admin.entity.SysDictDataEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:58 AM
+ * @Version 1.0
+ */
+public interface SysDictDataService extends BaseService {
+
+ PageData page(Map params);
+
+ SysDictDataDTO get(Long id);
+
+ void save(SysDictDataDTO dto);
+
+ void update(SysDictDataDTO dto);
+
+ void delete(Long[] ids);
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysDictTypeService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysDictTypeService.java
new file mode 100644
index 0000000..d2c329f
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysDictTypeService.java
@@ -0,0 +1,34 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysDictTypeDTO;
+import com.cnbm.admin.entity.DictType;
+import com.cnbm.admin.entity.SysDictTypeEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:58 AM
+ * @Version 1.0
+ */
+public interface SysDictTypeService extends BaseService {
+
+ PageData page(Map params);
+
+ SysDictTypeDTO get(Long id);
+
+ void save(SysDictTypeDTO dto);
+
+ void update(SysDictTypeDTO dto);
+
+ void delete(Long[] ids);
+
+ /**
+ * 获取所有字典
+ */
+ List getAllList();
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysLogErrorService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysLogErrorService.java
new file mode 100644
index 0000000..f4f9647
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysLogErrorService.java
@@ -0,0 +1,24 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysLogErrorDTO;
+import com.cnbm.admin.entity.SysLogErrorEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:08 PM
+ * @Version 1.0
+ */
+public interface SysLogErrorService extends BaseService {
+
+ PageData page(Map params);
+
+ List list(Map params);
+
+ void save(SysLogErrorEntity entity);
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysLogOperationService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysLogOperationService.java
new file mode 100644
index 0000000..c228281
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysLogOperationService.java
@@ -0,0 +1,23 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysLogOperationDTO;
+import com.cnbm.admin.entity.SysLogOperationEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:52 AM
+ * @Version 1.0
+ */
+public interface SysLogOperationService extends BaseService {
+
+ PageData page(Map params);
+
+ List list(Map params);
+
+ void save(SysLogOperationEntity entity);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysMenuService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysMenuService.java
new file mode 100644
index 0000000..5c32120
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysMenuService.java
@@ -0,0 +1,48 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysMenuDTO;
+import com.cnbm.admin.entity.SysMenuEntity;
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:34 PM
+ * @Version 1.0
+ */
+public interface SysMenuService extends BaseService {
+
+ SysMenuDTO get(Long id);
+
+ void save(SysMenuDTO dto);
+
+ void update(SysMenuDTO dto);
+
+ void delete(Long id);
+
+ /**
+ * 菜单列表
+ *
+ * @param type 菜单类型
+ */
+ List getAllMenuList(Integer type);
+
+ /**
+ * 用户菜单列表
+ *
+ * @param user 用户
+ * @param type 菜单类型
+ */
+ List getUserMenuList(SysUserEntity user, Integer type);
+
+ /**
+ * 根据父菜单,查询子菜单
+ * @param pid 父菜单ID
+ */
+ List getListPid(Long pid);
+
+ Set getUserPermissions(SysUserEntity user);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysParamsService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysParamsService.java
new file mode 100644
index 0000000..bbc247c
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysParamsService.java
@@ -0,0 +1,50 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysParamsDTO;
+import com.cnbm.admin.entity.SysParamsEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:23 AM
+ * @Version 1.0
+ */
+public interface SysParamsService extends BaseService {
+
+ PageData page(Map params);
+
+ List list(Map params);
+
+ SysParamsDTO get(Long id);
+
+ void save(SysParamsDTO dto);
+
+ void update(SysParamsDTO dto);
+
+ void delete(Long[] ids);
+
+ /**
+ * 根据参数编码,获取参数的value值
+ *
+ * @param paramCode 参数编码
+ */
+ String getValue(String paramCode);
+
+ /**
+ * 根据参数编码,获取value的Object对象
+ * @param paramCode 参数编码
+ * @param clazz Object对象
+ */
+ T getValueObject(String paramCode, Class clazz);
+
+ /**
+ * 根据参数编码,更新value
+ * @param paramCode 参数编码
+ * @param paramValue 参数值
+ */
+ int updateValueByCode(String paramCode, String paramValue);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleDataScopeService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleDataScopeService.java
new file mode 100644
index 0000000..d980065
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleDataScopeService.java
@@ -0,0 +1,32 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.entity.SysRoleDataScopeEntity;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:13 AM
+ * @Version 1.0
+ */
+public interface SysRoleDataScopeService extends BaseService {
+
+ /**
+ * 根据角色ID,获取部门ID列表
+ */
+ List getDeptIdList(Long roleId);
+
+ /**
+ * 保存或修改
+ * @param roleId 角色ID
+ * @param deptIdList 部门ID列表
+ */
+ void saveOrUpdate(Long roleId, List deptIdList);
+
+ /**
+ * 根据角色id,删除角色数据权限关系
+ * @param roleId 角色ids
+ */
+ void deleteByRoleIds(Long[] roleId);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleMenuService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleMenuService.java
new file mode 100644
index 0000000..cc7c5c0
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleMenuService.java
@@ -0,0 +1,38 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.entity.SysRoleMenuEntity;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 3:02 PM
+ * @Version 1.0
+ */
+public interface SysRoleMenuService extends BaseService {
+
+ /**
+ * 根据角色ID,获取菜单ID列表
+ */
+ List getMenuIdList(Long roleId);
+
+ /**
+ * 保存或修改
+ * @param roleId 角色ID
+ * @param menuIdList 菜单ID列表
+ */
+ void saveOrUpdate(Long roleId, List menuIdList);
+
+ /**
+ * 根据角色id,删除角色菜单关系
+ * @param roleIds 角色ids
+ */
+ void deleteByRoleIds(Long[] roleIds);
+
+ /**
+ * 根据菜单id,删除角色菜单关系
+ * @param menuId 菜单id
+ */
+ void deleteByMenuId(Long menuId);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleService.java
new file mode 100644
index 0000000..0969dad
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleService.java
@@ -0,0 +1,30 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysRoleDTO;
+import com.cnbm.admin.entity.SysRoleEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:07 AM
+ * @Version 1.0
+ */
+public interface SysRoleService extends BaseService {
+
+ PageData page(Map params);
+
+ List list(Map params);
+
+ SysRoleDTO get(Long id);
+
+ void save(SysRoleDTO dto);
+
+ void update(SysRoleDTO dto);
+
+ void delete(Long[] ids);
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleUserService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleUserService.java
new file mode 100644
index 0000000..e6c2c85
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysRoleUserService.java
@@ -0,0 +1,39 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.entity.SysRoleUserEntity;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:33 PM
+ * @Version 1.0
+ */
+public interface SysRoleUserService extends BaseService {
+
+ /**
+ * 保存或修改
+ * @param userId 用户ID
+ * @param roleIdList 角色ID列表
+ */
+ void saveOrUpdate(Long userId, List roleIdList);
+
+ /**
+ * 根据角色ids,删除角色用户关系
+ * @param roleIds 角色ids
+ */
+ void deleteByRoleIds(Long[] roleIds);
+
+ /**
+ * 根据用户id,删除角色用户关系
+ * @param userIds 用户ids
+ */
+ void deleteByUserIds(Long[] userIds);
+
+ /**
+ * 角色ID列表
+ * @param userId 用户ID
+ */
+ List getRoleIdList(Long userId);
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/SysUserService.java b/ym-admin/src/main/java/com/cnbm/admin/service/SysUserService.java
new file mode 100644
index 0000000..cb0ec28
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/SysUserService.java
@@ -0,0 +1,49 @@
+package com.cnbm.admin.service;
+
+import com.cnbm.admin.dto.SysUserDTO;
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.BaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:24 PM
+ * @Version 1.0
+ */
+public interface SysUserService extends BaseService {
+
+ PageData page(Map params);
+
+ List list(Map params);
+
+ SysUserDTO get(Long id);
+
+ SysUserDTO getByUsername(String username);
+
+ void save(SysUserDTO dto);
+
+ void update(SysUserDTO dto);
+
+ void delete(Long[] ids);
+
+ /**
+ * 修改密码
+ * @param id 用户ID
+ * @param newPassword 新密码
+ */
+ void updatePassword(Long id, String newPassword);
+
+ /**
+ * 根据部门ID,查询用户数
+ */
+ int getCountByDeptId(Long deptId);
+
+ /**
+ * 根据部门ID,查询用户Id列表
+ */
+ List getUserIdListByDeptId(List deptIdList);
+
+}
\ No newline at end of file
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java
new file mode 100644
index 0000000..8425e2e
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java
@@ -0,0 +1,51 @@
+package com.cnbm.admin.service.impl;
+
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.params.LoginParam;
+import com.cnbm.admin.utils.JwtUtil;
+import com.cnbm.admin.service.LoginService;
+import com.cnbm.admin.utils.ResponseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/8 9:17 AM
+ * @Version 1.0
+ */
+@Service
+public class LoginServiceImpl implements LoginService {
+
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ @Autowired
+ private AuthenticationManager authenticationManager;
+
+ @Override
+ public ResponseResult login(HttpServletRequest request, LoginParam loginParam) {
+ UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginParam.getUsername(),loginParam.getPassword());
+ Authentication authenticate = authenticationManager.authenticate(authenticationToken);
+ if (Objects.isNull(authenticate)) {
+ throw new RuntimeException("登录失败");
+ }
+ //如果认证通过了,使用userid生成一个jwt jwt存入ResponseResult返回
+ LoginUser loginUser = (LoginUser) authenticate.getPrincipal();
+ String userid = loginUser.getSysUserEntity().getId().toString();
+ String jwt = JwtUtil.createJWT(userid);
+ Map map = new HashMap<>();
+ map.put("token",jwt);
+ //把完整的用户信息存入redis userid作为key
+ redisTemplate.opsForValue().set("login:"+userid,loginUser);
+ return new ResponseResult(200,"登录成功",map);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDeptServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDeptServiceImpl.java
new file mode 100644
index 0000000..0e85c02
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDeptServiceImpl.java
@@ -0,0 +1,165 @@
+package com.cnbm.admin.service.impl;
+
+import com.cnbm.admin.dao.SysDeptDao;
+import com.cnbm.admin.dao.SysUserDao;
+import com.cnbm.admin.dto.SysDeptDTO;
+import com.cnbm.admin.entity.LoginUser;
+import com.cnbm.admin.entity.SysDeptEntity;
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.admin.enums.SuperAdminEnum;
+import com.cnbm.admin.service.SysDeptService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.exception.ErrorCode;
+import com.cnbm.common.exception.RenException;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+import com.cnbm.common.utils.TreeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 1:38 PM
+ * @Version 1.0
+ */
+@Service
+public class SysDeptServiceImpl extends BaseServiceImpl implements SysDeptService {
+ @Autowired
+ private SysUserDao sysUserDao;
+
+ @Override
+ public List list(Map params) {
+ //普通管理员,只能查询所属部门及子部门的数据
+ UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+ SysUserEntity user = loginUser.getSysUserEntity();
+ if(user.getSuperAdmin() == SuperAdminEnum.NO.value()) {
+ params.put("deptIdList", getSubDeptIdList(user.getDeptId()));
+ }
+
+ //查询部门列表
+ List entityList = baseDao.getList(params);
+
+ List dtoList = ConvertUtils.sourceToTarget(entityList, SysDeptDTO.class);
+
+ return TreeUtils.build(dtoList);
+ }
+
+ @Override
+ public SysDeptDTO get(Long id) {
+ //超级管理员,部门ID为null
+ if(id == null){
+ return null;
+ }
+
+ SysDeptEntity entity = baseDao.getById(id);
+
+ return ConvertUtils.sourceToTarget(entity, SysDeptDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysDeptDTO dto) {
+ SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class);
+
+ entity.setPids(getPidList(entity.getPid()));
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SysDeptDTO dto) {
+ SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class);
+
+ //上级部门不能为自身
+ if(entity.getId().equals(entity.getPid())){
+ throw new RenException(ErrorCode.SUPERIOR_DEPT_ERROR);
+ }
+
+ //上级部门不能为下级部门
+ List subDeptList = getSubDeptIdList(entity.getId());
+ if(subDeptList.contains(entity.getPid())){
+ throw new RenException(ErrorCode.SUPERIOR_DEPT_ERROR);
+ }
+
+ entity.setPids(getPidList(entity.getPid()));
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long id) {
+ //判断是否有子部门
+ List subList = getSubDeptIdList(id);
+ if(subList.size() > 1){
+ throw new RenException(ErrorCode.DEPT_SUB_DELETE_ERROR);
+ }
+
+ //判断部门下面是否有用户
+ int count = sysUserDao.getCountByDeptId(id);
+ if(count > 0){
+ throw new RenException(ErrorCode.DEPT_USER_DELETE_ERROR);
+ }
+
+ //删除
+ baseDao.deleteById(id);
+ }
+
+ @Override
+ public List getSubDeptIdList(Long id) {
+ List deptIdList = baseDao.getSubDeptIdList("%" + id + "%");
+ deptIdList.add(id);
+
+ return deptIdList;
+ }
+
+ /**
+ * 获取所有上级部门ID
+ * @param pid 上级ID
+ */
+ private String getPidList(Long pid){
+ //顶级部门,无上级部门
+ if(Constant.DEPT_ROOT.equals(pid)){
+ return Constant.DEPT_ROOT + "";
+ }
+
+ //所有部门的id、pid列表
+ List deptList = baseDao.getIdAndPidList();
+
+ //list转map
+ Map map = new HashMap<>(deptList.size());
+ for(SysDeptEntity entity : deptList){
+ map.put(entity.getId(), entity);
+ }
+
+ //递归查询所有上级部门ID列表
+ List pidList = new ArrayList<>();
+ getPidTree(pid, map, pidList);
+
+ return StringUtils.join(pidList, ",");
+ }
+
+ private void getPidTree(Long pid, Map map, List pidList) {
+ //顶级部门,无上级部门
+ if(Constant.DEPT_ROOT.equals(pid)){
+ return ;
+ }
+
+ //上级部门存在
+ SysDeptEntity parent = map.get(pid);
+ if(parent != null){
+ getPidTree(parent.getPid(), map, pidList);
+ }
+
+ pidList.add(pid);
+ }
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictDataServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictDataServiceImpl.java
new file mode 100644
index 0000000..f3b62ae
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictDataServiceImpl.java
@@ -0,0 +1,80 @@
+package com.cnbm.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.cnbm.admin.dao.SysDictDataDao;
+import com.cnbm.admin.dto.SysDictDataDTO;
+import com.cnbm.admin.entity.SysDictDataEntity;
+import com.cnbm.admin.service.SysDictDataService;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:59 AM
+ * @Version 1.0
+ */
+@Service
+public class SysDictDataServiceImpl extends BaseServiceImpl implements SysDictDataService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, "sort", true),
+ getWrapper(params)
+ );
+
+ return getPageData(page, SysDictDataDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String dictTypeId = (String) params.get("dictTypeId");
+ String dictLabel = (String) params.get("dictLabel");
+ String dictValue = (String) params.get("dictValue");
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq("dict_type_id", dictTypeId);
+ wrapper.like(StringUtils.isNotBlank(dictLabel), "dict_label", dictLabel);
+ wrapper.like(StringUtils.isNotBlank(dictValue), "dict_value", dictValue);
+
+ return wrapper;
+ }
+
+ @Override
+ public SysDictDataDTO get(Long id) {
+ SysDictDataEntity entity = baseDao.selectById(id);
+
+ return ConvertUtils.sourceToTarget(entity, SysDictDataDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysDictDataDTO dto) {
+ SysDictDataEntity entity = ConvertUtils.sourceToTarget(dto, SysDictDataEntity.class);
+
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SysDictDataDTO dto) {
+ SysDictDataEntity entity = ConvertUtils.sourceToTarget(dto, SysDictDataEntity.class);
+
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long[] ids) {
+ //删除
+ deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictTypeServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictTypeServiceImpl.java
new file mode 100644
index 0000000..110d858
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysDictTypeServiceImpl.java
@@ -0,0 +1,98 @@
+package com.cnbm.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.cnbm.admin.dao.SysDictDataDao;
+import com.cnbm.admin.dao.SysDictTypeDao;
+import com.cnbm.admin.dto.SysDictTypeDTO;
+import com.cnbm.admin.entity.DictData;
+import com.cnbm.admin.entity.DictType;
+import com.cnbm.admin.entity.SysDictTypeEntity;
+import com.cnbm.admin.service.SysDictTypeService;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+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 weihongyang
+ * @Date 2022/6/12 10:59 AM
+ * @Version 1.0
+ */
+@Service
+public class SysDictTypeServiceImpl extends BaseServiceImpl implements SysDictTypeService {
+ @Autowired
+ private SysDictDataDao sysDictDataDao;
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, "sort", true),
+ getWrapper(params)
+ );
+
+ return getPageData(page, SysDictTypeDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String dictType = (String) params.get("dictType");
+ String dictName = (String) params.get("dictName");
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.like(StringUtils.isNotBlank(dictType), "dict_type", dictType);
+ wrapper.like(StringUtils.isNotBlank(dictName), "dict_name", dictName);
+
+ return wrapper;
+ }
+
+ @Override
+ public SysDictTypeDTO get(Long id) {
+ SysDictTypeEntity entity = baseDao.selectById(id);
+
+ return ConvertUtils.sourceToTarget(entity, SysDictTypeDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysDictTypeDTO dto) {
+ SysDictTypeEntity entity = ConvertUtils.sourceToTarget(dto, SysDictTypeEntity.class);
+
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SysDictTypeDTO dto) {
+ SysDictTypeEntity entity = ConvertUtils.sourceToTarget(dto, SysDictTypeEntity.class);
+
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long[] ids) {
+ //删除
+ deleteBatchIds(Arrays.asList(ids));
+ }
+
+ @Override
+ public List getAllList() {
+ List typeList = baseDao.getDictTypeList();
+ List dataList = sysDictDataDao.getDictDataList();
+ for(DictType type : typeList){
+ for(DictData data : dataList){
+ if(type.getId().equals(data.getDictTypeId())){
+ type.getDataList().add(data);
+ }
+ }
+ }
+ return typeList;
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogErrorServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogErrorServiceImpl.java
new file mode 100644
index 0000000..80cee15
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogErrorServiceImpl.java
@@ -0,0 +1,55 @@
+package com.cnbm.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.cnbm.admin.dao.SysLogErrorDao;
+import com.cnbm.admin.dto.SysLogErrorDTO;
+import com.cnbm.admin.entity.SysLogErrorEntity;
+import com.cnbm.admin.service.SysLogErrorService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 2:09 PM
+ * @Version 1.0
+ */
+@Service
+public class SysLogErrorServiceImpl extends BaseServiceImpl implements SysLogErrorService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, Constant.CREATE_DATE, false),
+ getWrapper(params)
+ );
+
+ return getPageData(page, SysLogErrorDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, SysLogErrorDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ QueryWrapper wrapper = new QueryWrapper<>();
+ return wrapper;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysLogErrorEntity entity) {
+ insert(entity);
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogOperationServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogOperationServiceImpl.java
new file mode 100644
index 0000000..0059927
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysLogOperationServiceImpl.java
@@ -0,0 +1,60 @@
+package com.cnbm.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.cnbm.admin.dao.SysLogOperationDao;
+import com.cnbm.admin.dto.SysLogOperationDTO;
+import com.cnbm.admin.entity.SysLogOperationEntity;
+import com.cnbm.admin.service.SysLogOperationService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/10 9:52 AM
+ * @Version 1.0
+ */
+@Service
+public class SysLogOperationServiceImpl extends BaseServiceImpl implements SysLogOperationService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, Constant.CREATE_DATE, false),
+ getWrapper(params)
+ );
+
+ return getPageData(page, SysLogOperationDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, SysLogOperationDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String status = (String) params.get("status");
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(status), "status", status);
+
+ return wrapper;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysLogOperationEntity entity) {
+ insert(entity);
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysMenuServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysMenuServiceImpl.java
new file mode 100644
index 0000000..b07c7f7
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysMenuServiceImpl.java
@@ -0,0 +1,136 @@
+package com.cnbm.admin.service.impl;
+
+import com.cnbm.admin.dao.SysMenuDao;
+import com.cnbm.admin.dto.SysMenuDTO;
+import com.cnbm.admin.entity.SysMenuEntity;
+import com.cnbm.admin.entity.SysUserEntity;
+import com.cnbm.admin.enums.SuperAdminEnum;
+import com.cnbm.admin.service.SysMenuService;
+import com.cnbm.admin.service.SysRoleMenuService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.exception.ErrorCode;
+import com.cnbm.common.exception.RenException;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+import com.cnbm.common.utils.TreeUtils;
+import lombok.extern.log4j.Log4j2;
+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 weihongyang
+ * @Date 2022/6/10 2:35 PM
+ * @Version 1.0
+ */
+@Service
+@Log4j2
+public class SysMenuServiceImpl extends BaseServiceImpl implements SysMenuService {
+ @Autowired
+ private SysRoleMenuService sysRoleMenuService;
+
+ @Autowired
+ private SysMenuDao sysMenuDao;
+
+ @Override
+ public SysMenuDTO get(Long id) {
+ SysMenuEntity entity = baseDao.getById(id);
+
+ SysMenuDTO dto = ConvertUtils.sourceToTarget(entity, SysMenuDTO.class);
+
+ return dto;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysMenuDTO dto) {
+ SysMenuEntity entity = ConvertUtils.sourceToTarget(dto, SysMenuEntity.class);
+
+ //保存菜单
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SysMenuDTO dto) {
+ SysMenuEntity entity = ConvertUtils.sourceToTarget(dto, SysMenuEntity.class);
+
+ //上级菜单不能为自身
+ if(entity.getId().equals(entity.getPid())){
+ throw new RenException(ErrorCode.SUPERIOR_MENU_ERROR);
+ }
+
+ //更新菜单
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long id) {
+ //删除菜单
+ deleteById(id);
+
+ //删除角色菜单关系
+ sysRoleMenuService.deleteByMenuId(id);
+ }
+
+ @Override
+ public List getAllMenuList(Integer type) {
+ List menuList = baseDao.getMenuList(type);
+
+ List dtoList = ConvertUtils.sourceToTarget(menuList, SysMenuDTO.class);
+
+ return TreeUtils.build(dtoList, Constant.MENU_ROOT);
+ }
+
+ @Override
+ public List getUserMenuList(SysUserEntity user, Integer type) {
+ List menuList = new ArrayList<>();
+
+
+
+ //系统管理员,拥有最高权限
+ if(!Objects.isNull(user.getSuperAdmin()) && user.getSuperAdmin() == SuperAdminEnum.YES.value()){
+ menuList = baseDao.getMenuList(type);
+ }else {
+ menuList = baseDao.getUserMenuList(user.getId(), type);
+ }
+
+ List dtoList = ConvertUtils.sourceToTarget(menuList, SysMenuDTO.class);
+
+ return TreeUtils.build(dtoList);
+ }
+
+ @Override
+ public List getListPid(Long pid) {
+ List menuList = baseDao.getListPid(pid);
+
+ return ConvertUtils.sourceToTarget(menuList, SysMenuDTO.class);
+ }
+
+ @Override
+ public Set getUserPermissions(SysUserEntity user) {
+ //系统管理员,拥有最高权限
+ List permissionsList;
+ if(user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
+ permissionsList = sysMenuDao.getPermissionsList();
+ }else{
+ permissionsList = sysMenuDao.getUserPermissionsList(user.getId());
+ }
+
+ //用户权限列表
+ Set permsSet = new HashSet<>();
+ for(String permissions : permissionsList){
+ if(StringUtils.isBlank(permissions)){
+ continue;
+ }
+ permsSet.addAll(Arrays.asList(permissions.trim().split(",")));
+ }
+
+ return permsSet;
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysParamsServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysParamsServiceImpl.java
new file mode 100644
index 0000000..de99d16
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysParamsServiceImpl.java
@@ -0,0 +1,133 @@
+package com.cnbm.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.cnbm.admin.dao.SysParamsDao;
+import com.cnbm.admin.dto.SysParamsDTO;
+import com.cnbm.admin.entity.SysParamsEntity;
+import com.cnbm.admin.redis.SysParamsRedis;
+import com.cnbm.admin.service.SysParamsService;
+import com.cnbm.common.constant.Constant;
+import com.cnbm.common.exception.ErrorCode;
+import com.cnbm.common.exception.RenException;
+import com.cnbm.common.page.PageData;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import com.cnbm.common.utils.ConvertUtils;
+import com.cnbm.common.utils.JsonUtils;
+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 weihongyang
+ * @Date 2022/6/12 10:24 AM
+ * @Version 1.0
+ */
+@Service
+public class SysParamsServiceImpl extends BaseServiceImpl implements SysParamsService {
+ @Autowired
+ private SysParamsRedis sysParamsRedis;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, Constant.CREATE_DATE, false),
+ getWrapper(params)
+ );
+
+ return getPageData(page, SysParamsDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, SysParamsDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String paramCode = (String) params.get("paramCode");
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq("param_type", 1);
+ wrapper.like(StringUtils.isNotBlank(paramCode), "param_code", paramCode);
+
+ return wrapper;
+ }
+
+ @Override
+ public SysParamsDTO get(Long id) {
+ SysParamsEntity entity = baseDao.selectById(id);
+
+ return ConvertUtils.sourceToTarget(entity, SysParamsDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(SysParamsDTO dto) {
+ SysParamsEntity entity = ConvertUtils.sourceToTarget(dto, SysParamsEntity.class);
+ insert(entity);
+
+ sysParamsRedis.set(entity.getParamCode(), entity.getParamValue());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SysParamsDTO dto) {
+ SysParamsEntity entity = ConvertUtils.sourceToTarget(dto, SysParamsEntity.class);
+ updateById(entity);
+
+ sysParamsRedis.set(entity.getParamCode(), entity.getParamValue());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long[] ids) {
+ //删除Redis数据
+ List paramCodeList = baseDao.getParamCodeList(ids);
+ String[] paramCodes = paramCodeList.toArray(new String[paramCodeList.size()]);
+ sysParamsRedis.delete(paramCodes);
+
+ //删除
+ deleteBatchIds(Arrays.asList(ids));
+ }
+
+ @Override
+ public String getValue(String paramCode) {
+ String paramValue = sysParamsRedis.get(paramCode);
+ if(paramValue == null){
+ paramValue = baseDao.getValueByCode(paramCode);
+
+ sysParamsRedis.set(paramCode, paramValue);
+ }
+ return paramValue;
+ }
+
+ @Override
+ public T getValueObject(String paramCode, Class clazz) {
+ String paramValue = getValue(paramCode);
+ if(StringUtils.isNotBlank(paramValue)){
+ return JsonUtils.parseObject(paramValue, clazz);
+ }
+
+ try {
+ return clazz.newInstance();
+ } catch (Exception e) {
+ throw new RenException(ErrorCode.PARAMS_GET_ERROR);
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int updateValueByCode(String paramCode, String paramValue) {
+ int count = baseDao.updateValueByCode(paramCode, paramValue);
+ sysParamsRedis.set(paramCode, paramValue);
+ return count;
+ }
+
+}
diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleDataScopeServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleDataScopeServiceImpl.java
new file mode 100644
index 0000000..1c7c21f
--- /dev/null
+++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/SysRoleDataScopeServiceImpl.java
@@ -0,0 +1,53 @@
+package com.cnbm.admin.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.cnbm.admin.dao.SysRoleDataScopeDao;
+import com.cnbm.admin.entity.SysRoleDataScopeEntity;
+import com.cnbm.admin.service.SysRoleDataScopeService;
+import com.cnbm.common.service.impl.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @Author weihongyang
+ * @Date 2022/6/12 10:13 AM
+ * @Version 1.0
+ */
+@Service
+public class SysRoleDataScopeServiceImpl extends BaseServiceImpl
+ implements SysRoleDataScopeService {
+
+ @Override
+ public List getDeptIdList(Long roleId) {
+ return baseDao.getDeptIdList(roleId);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void saveOrUpdate(Long roleId, List