From 871448c627e4cec430465cbcdec81e5ead34a19f Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Wed, 27 Mar 2024 00:25:57 +0800 Subject: [PATCH] yh --- .gitignore | 1 + .../admin/api/controller/system/DeptController.java | 6 +++++- waynboot-admin-api/src/main/resources/application.yml | 4 +++- .../src/main/resources/logback-spring.xml | 2 +- .../wayn/common/core/service/system/IUserService.java | 3 +++ .../core/service/system/impl/UserServiceImpl.java | 6 ++++++ waynboot-common/src/main/resources/application-dev.yml | 10 +++++----- .../wayn/mobile/api/controller/LoginController.java | 6 +++--- waynboot-mobile-api/src/main/resources/application.yml | 2 +- .../src/main/resources/logback-spring.xml | 2 +- 10 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 3e9d3b7..0118647 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ target/ /nbdist/ /.nb-gradle/ build/ +logs/ ### VS Code ### .vscode/ diff --git a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/system/DeptController.java b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/system/DeptController.java index 0ef8ad0..36fdb11 100644 --- a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/system/DeptController.java +++ b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/system/DeptController.java @@ -3,6 +3,7 @@ package com.wayn.admin.api.controller.system; import com.wayn.common.constant.SysConstants; import com.wayn.common.core.domain.system.Dept; import com.wayn.common.core.service.system.IDeptService; +import com.wayn.common.core.service.system.IUserService; import com.wayn.common.enums.ReturnCodeEnum; import com.wayn.common.util.R; import com.wayn.common.util.security.SecurityUtils; @@ -27,6 +28,9 @@ public class DeptController { private IDeptService iDeptService; + private IUserService iUserService; + + @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list") public R list(Dept dept) { @@ -89,7 +93,7 @@ public class DeptController { if (iDeptService.hasChildByDeptId(deptId)) { return R.error(ReturnCodeEnum.DEPT_HAS_SUB_DEPT_ERROR); } - if (iDeptService.checkDeptExistUser(deptId)) { + if (iUserService.checkDeptExistUser(deptId)) { return R.error(ReturnCodeEnum.DEPT_HAS_USER_ERROR); } return R.result(iDeptService.removeById(deptId)); diff --git a/waynboot-admin-api/src/main/resources/application.yml b/waynboot-admin-api/src/main/resources/application.yml index a4c2d93..d84d8d5 100644 --- a/waynboot-admin-api/src/main/resources/application.yml +++ b/waynboot-admin-api/src/main/resources/application.yml @@ -41,7 +41,7 @@ logging: com.wayn: info org.springframework: info file: - name: ${LOG_PATH_PREFIX:E:/home}/${spring.application.name}/info.log + name: ./logs/${spring.application.name}/info.log management: endpoints: @@ -66,6 +66,8 @@ mybatis-plus: typeAliasesPackage: com.wayn.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志 # wayn配置 wayn: diff --git a/waynboot-admin-api/src/main/resources/logback-spring.xml b/waynboot-admin-api/src/main/resources/logback-spring.xml index 9a2aa3e..225744e 100644 --- a/waynboot-admin-api/src/main/resources/logback-spring.xml +++ b/waynboot-admin-api/src/main/resources/logback-spring.xml @@ -2,7 +2,7 @@ - + diff --git a/waynboot-common/src/main/java/com/wayn/common/core/service/system/IUserService.java b/waynboot-common/src/main/java/com/wayn/common/core/service/system/IUserService.java index d8ddf72..abc3356 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/service/system/IUserService.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/service/system/IUserService.java @@ -52,6 +52,9 @@ public interface IUserService extends IService { */ String checkEmailUnique(User user); + + boolean checkDeptExistUser(Long deptId); + /** * 保存用户和关联的角色信息 * diff --git a/waynboot-common/src/main/java/com/wayn/common/core/service/system/impl/UserServiceImpl.java b/waynboot-common/src/main/java/com/wayn/common/core/service/system/impl/UserServiceImpl.java index 5681f1a..49e1852 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/service/system/impl/UserServiceImpl.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/service/system/impl/UserServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.wayn.common.constant.SysConstants; +import com.wayn.common.core.domain.system.Dept; import com.wayn.common.core.domain.system.Role; import com.wayn.common.core.domain.system.User; import com.wayn.common.core.domain.system.UserRole; @@ -80,6 +81,11 @@ public class UserServiceImpl extends ServiceImpl implements IU return SysConstants.UNIQUE; } + @Override + public boolean checkDeptExistUser(Long deptId) { + return count(Wrappers.lambdaQuery(User.class).eq(User::getDeptId, deptId)) > 0; + } + @Override public boolean insertUserAndRole(User user) { save(user); diff --git a/waynboot-common/src/main/resources/application-dev.yml b/waynboot-common/src/main/resources/application-dev.yml index db0ab77..e6a305e 100644 --- a/waynboot-common/src/main/resources/application-dev.yml +++ b/waynboot-common/src/main/resources/application-dev.yml @@ -4,9 +4,9 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # 主库数据源 master: - jdbc-url: jdbc:mysql://127.0.0.1:3306/wayn_shop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: 123456 + jdbc-url: jdbc:mysql://124.223.222.61:3306/shop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: elf1990 + password: XtN1YiaqP4BxC9MEe pool-name: hikariCP minimum-idle: 100 maximum-pool-size: 200 @@ -51,10 +51,10 @@ spring: es: config: - host: 127.0.0.1 + host: 124.223.222.61 port: 9200 username: elastic - password: 123456 + password: XtN1YiaqP4BxC9MEe scheme: http shards: 3 replicas: 2 diff --git a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java index f6a234a..095aa9b 100644 --- a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java +++ b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java @@ -95,9 +95,9 @@ public class LoginController { return R.error(ReturnCodeEnum.USER_REGISTER_MOBILE_ERROR); } // 判断用户输入邮箱验证码是否正确 - if (registryObj.getEmailCode() == null || !redisEmailCode.equals(registryObj.getEmailCode().trim().toLowerCase())) { - return R.error(ReturnCodeEnum.USER_EMAIL_CODE_ERROR); - } +// if (registryObj.getEmailCode() == null || !redisEmailCode.equals(registryObj.getEmailCode().trim().toLowerCase())) { +// return R.error(ReturnCodeEnum.USER_EMAIL_CODE_ERROR); +// } // 删除验证码 redisCache.deleteObject(registryObj.getCaptchaKey()); redisCache.deleteObject(registryObj.getEmailKey()); diff --git a/waynboot-mobile-api/src/main/resources/application.yml b/waynboot-mobile-api/src/main/resources/application.yml index aedf31e..3615c71 100644 --- a/waynboot-mobile-api/src/main/resources/application.yml +++ b/waynboot-mobile-api/src/main/resources/application.yml @@ -36,7 +36,7 @@ token: # 日志配置 logging: file: - name: ${LOG_PATH_PREFIX:E:/home/logs}/${spring.application.name}/info.log + name: ./logs/${spring.application.name}/info.log # mybatis plus 配置 mybatis-plus: diff --git a/waynboot-mobile-api/src/main/resources/logback-spring.xml b/waynboot-mobile-api/src/main/resources/logback-spring.xml index 9a2aa3e..225744e 100644 --- a/waynboot-mobile-api/src/main/resources/logback-spring.xml +++ b/waynboot-mobile-api/src/main/resources/logback-spring.xml @@ -2,7 +2,7 @@ - +