2
0

feat: 忘记密码

This commit is contained in:
caiyuchao
2025-02-13 11:22:16 +08:00
parent 076fa284aa
commit d0c9eb320a
20 changed files with 218 additions and 16 deletions

View File

@@ -87,7 +87,7 @@ INSERT INTO `config_info` VALUES (50, 'wfc-payment-test.yml', 'DEFAULT_GROUP', '
INSERT INTO `config_info` VALUES (51, 'sentinel-wfc-gateway-test', 'DEFAULT_GROUP', '[\r\n {\r\n \"resource\": \"wfc-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"wfc-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"wfc-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"wfc-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]', 'a8b3ec396dd09d5f2ba494cc80a7afa0', '2024-12-28 19:28:44', '2024-12-28 19:28:44', NULL, '172.19.0.1', '', 'wfc-test', '限流策略', NULL, NULL, 'json', NULL, '');
INSERT INTO `config_info` VALUES (61, 'application-prod.yml', 'DEFAULT_GROUP', 'spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n # 资源信息\n #messages:\n # 国际化资源文件路径\n #basename: i18n/messages\n \n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: false\n httpclient:\n enabled: true\n disable-ssl-validation: true\n client:\n config:\n default:\n connectTimeout: 60000\n readTimeout: 60000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n \n\n \n', '35d3cd36aeef1b24d4fdb9f73e0fb2c6', '2024-12-13 11:52:34', '2025-02-08 09:39:47', NULL, '172.20.0.1', '', 'wfc-prod', '通用配置', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (62, 'wfc-gateway-prod.yml', 'DEFAULT_GROUP', 'spring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: wfc-auth\n uri: lb://wfc-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: wfc-gen\n uri: lb://wfc-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: wfc-job\n uri: lb://wfc-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: wfc-system\n uri: lb://wfc-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 用户模块\n - id: wfc-user\n uri: lb://wfc-user\n predicates:\n - Path=/u/**\n filters:\n - StripPrefix=1 \n # 文件服务\n - id: wfc-file\n uri: lb://wfc-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n # payment\n - id: wfc-payment\n uri: lb://wfc-payment\n predicates:\n - Path=/payment/**\n filters:\n - StripPrefix=1 \n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n mailEnabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /auth/checkRepeat\n - /*/v2/api-docs\n - /csrf\n - /u/email/code\n - /payment/aliPay/callback\n - /payment/wxPay/callback\n', '097c37e699095201baa494d9576fb0b2', '2024-12-13 11:52:34', '2025-02-07 11:26:31', NULL, '192.168.88.14', '', 'wfc-prod', 'wfc-gateway production', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (62, 'wfc-gateway-prod.yml', 'DEFAULT_GROUP', 'spring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: wfc-auth\n uri: lb://wfc-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: wfc-gen\n uri: lb://wfc-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: wfc-job\n uri: lb://wfc-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: wfc-system\n uri: lb://wfc-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 用户模块\n - id: wfc-user\n uri: lb://wfc-user\n predicates:\n - Path=/u/**\n filters:\n - StripPrefix=1 \n # 文件服务\n - id: wfc-file\n uri: lb://wfc-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n # payment\n - id: wfc-payment\n uri: lb://wfc-payment\n predicates:\n - Path=/payment/**\n filters:\n - StripPrefix=1 \n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n mailEnabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /auth/checkRepeat\n - /*/v2/api-docs\n - /csrf\n - /u/email/code\n - /sys/email/code\n - /payment/aliPay/callback\n - /payment/wxPay/callback\n - /u/user/profile/forgotPwd\n - /sys/user/profile/forgotPwd', '7c2ff7c096ccba897a41dbb18e979fec', '2024-12-13 11:52:34', '2025-02-13 03:14:41', NULL, '192.168.2.158', '', 'wfc-prod', 'wfc-gateway production', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (63, 'wfc-auth-prod.yml', 'DEFAULT_GROUP', 'spring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n', 'c3f5481240e7581cc397f5c7918fd785', '2024-12-13 11:52:34', '2024-12-13 11:53:35', NULL, '192.168.2.116', '', 'wfc-prod', '认证中心', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (64, 'wfc-monitor-prod.yml', 'DEFAULT_GROUP', '# spring\nspring:\n security:\n user:\n name: wfc\n password: 123456\n boot:\n admin:\n ui:\n title: visual monitor\n', 'c8f896d284d5328aab16baeb81a3685c', '2024-12-13 11:52:34', '2024-12-13 11:54:04', NULL, '192.168.2.116', '', 'wfc-prod', '监控中心', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (65, 'wfc-system-prod.yml', 'DEFAULT_GROUP', '# spring配置\nspring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://wfc-mysql:3306/wfc_system_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: org.wfc.system\n # 配置mapper的扫描找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By wfc\n licenseUrl: https://wfc.vip', 'a355587121f711511c9010a4a8c0d797', '2024-12-13 11:52:34', '2024-12-13 11:54:49', NULL, '192.168.2.116', '', 'wfc-prod', '系统模块', '', '', 'yaml', '', '');

View File

@@ -12,6 +12,16 @@ public interface GlobalConstants {
*/
String GLOBAL_REDIS_KEY = "global:";
/**
* 客户模块 redis key
*/
String SYSTEM = "sys:";
/**
* 用户模块 redis key
*/
String USER = "u:";
/**
* 验证码 redis key
*/

View File

@@ -28,6 +28,7 @@ user.register.success=Register successful
user.register.save.error=The registered username already exists
user.register.phone.save.error=The registered phone already exists
user.register.email.save.error=The registered email already exists
user.register.email.not.exist.error=The registered email does not exist
user.register.error=Register failed, please contact system administrator
user.notfound=Please login again
user.forcelogout=The administrator is forced to exitplease login again

View File

@@ -28,6 +28,7 @@ user.register.success=注册成功
user.register.save.error=注册账号已存在
user.register.phone.save.error=注册手机已存在
user.register.email.save.error=注册邮箱已存在
user.register.email.not.exist.error=注册邮箱不存在
user.register.error=注册失败,请联系系统管理人员
user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录

View File

@@ -179,7 +179,7 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
{
throw new VerificationCodeException("email.code.not.blankk");
}
String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + GlobalConstants.USER + StringUtils.nvl(uuid, "");
String captcha = redisService.getCacheObject(verifyKey);
if (captcha == null)
{

View File

@@ -62,7 +62,7 @@ alipay:
aliPayCertPath: \u652F\u4ED8\u5B9D\u516C\u94A5\u8BC1\u4E66
aliPayRootCertPath: \u652F\u4ED8\u5B9D\u6839\u8BC1\u4E66
serverUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
domain: http://192.168.9.50
domain: http://192.168.6.222
testDomain: http://129.204.171.210:8085
wxpay:

View File

@@ -45,13 +45,13 @@ public class SysEmailController extends BaseController {
if (!mailProperties.getEnabled()) {
return R.fail(MessageUtils.message("user.email.not.enable"));
}
String key = GlobalConstants.CAPTCHA_CODE_KEY + email;
String key = GlobalConstants.CAPTCHA_CODE_KEY + GlobalConstants.SYSTEM + email;
String code = RandomUtil.randomNumbers(4);
redisService.setCacheObject(key, code, Constants.MAIL_CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
try {
MailUtils.sendText(email, "Registration verification code", "Your verification code is: " + code + ", The validity period is " + Constants.MAIL_CAPTCHA_EXPIRATION + " minutes, please fill in as soon as possible.");
MailUtils.sendText(email, "Your WANFI verification code", "Hi\nYour verification code is:\n" + code + "\nThis code will expire in " + Constants.MAIL_CAPTCHA_EXPIRATION + " minutes.\nFor your security, don't share it with anyone.");
} catch (Exception e) {
log.error("Verification code sending exception => {}", e.getMessage());
log.error("email verification code send failed => {}", e.getMessage());
return R.fail(e.getMessage());
}
return R.ok();

View File

@@ -1,6 +1,6 @@
package org.wfc.system.controller;
import java.util.Arrays;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -10,8 +10,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.wfc.common.core.constant.GlobalConstants;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.exception.CaptchaException;
import org.wfc.common.core.exception.VerificationCodeException;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.file.FileTypeUtils;
@@ -20,13 +23,17 @@ import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.redis.service.RedisService;
import org.wfc.common.security.service.TokenService;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.system.api.RemoteFileService;
import org.wfc.system.api.domain.SysFile;
import org.wfc.system.api.domain.SysUser;
import org.wfc.system.domain.bo.SysUserForgotPwdBo;
import org.wfc.system.service.ISysUserService;
import java.util.Arrays;
/**
* 个人信息 业务处理
*
@@ -45,6 +52,9 @@ public class SysProfileController extends BaseController
@Autowired
private RemoteFileService remoteFileService;
@Autowired
private RedisService redisService;
/**
* 个人信息
*/
@@ -123,6 +133,51 @@ public class SysProfileController extends BaseController
return error(MessageUtils.message("system.modify.password.failed.contact.administrator"));
}
/**
* 忘记密码
*/
@PutMapping("/forgotPwd")
public AjaxResult forgotPwd(@RequestBody SysUserForgotPwdBo userForgotPwdBo)
{
SysUser user = userService.selectUserByEmail(userForgotPwdBo.getEmail());
if (ObjectUtil.isNull(user)) {
return error("user.register.email.not.exist.error");
}
checkCaptchaEmail(userForgotPwdBo.getCode(), userForgotPwdBo.getEmail());
String newPassword = userForgotPwdBo.getPassword();
String password = user.getPassword();
String username = user.getUserName();
if (SecurityUtils.matchesPassword(newPassword, password))
{
return error("user.modify.password.failed.new.password.same.old.password");
}
newPassword = SecurityUtils.encryptPassword(newPassword);
if (userService.resetUserPwd(username, newPassword) > 0)
{
return success();
}
return error("user.modify.password.failed.contact.administrator");
}
public void checkCaptchaEmail(String code, String email) throws CaptchaException
{
if (StringUtils.isEmpty(code))
{
throw new VerificationCodeException("email.code.not.blankk");
}
String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + GlobalConstants.SYSTEM + StringUtils.nvl(email, "");
String captcha = redisService.getCacheObject(verifyKey);
if (captcha == null)
{
throw new VerificationCodeException();
}
if (!code.equalsIgnoreCase(captcha))
{
throw new VerificationCodeException();
}
}
/**
* 头像上传
*/

View File

@@ -0,0 +1,15 @@
package org.wfc.system.domain.bo;
import lombok.Data;
/**
* @description: 忘记密码bo
* @author: cyc
* @since: 2025-02-12
*/
@Data
public class SysUserForgotPwdBo {
private String email;
private String password;
private String code;
}

View File

@@ -44,6 +44,14 @@ public interface SysUserMapper
*/
public SysUser selectUserByUserName(String userName);
/**
* 通过邮箱查询用户
*
* @param email 邮箱
* @return 用户对象信息
*/
public SysUser selectUserByEmail(String email);
/**
* 通过用户ID查询用户
*

View File

@@ -1,8 +1,9 @@
package org.wfc.system.service;
import java.util.List;
import org.wfc.system.api.domain.SysUser;
import java.util.List;
/**
* 用户 业务层
*
@@ -42,6 +43,14 @@ public interface ISysUserService
*/
public SysUser selectUserByUserName(String userName);
/**
* 通过邮箱查询用户
*
* @param email 用户名
* @return 用户对象信息
*/
public SysUser selectUserByEmail(String email);
/**
* 通过用户ID查询用户
*

View File

@@ -1,9 +1,5 @@
package org.wfc.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +27,11 @@ import org.wfc.system.service.ISysConfigService;
import org.wfc.system.service.ISysDeptService;
import org.wfc.system.service.ISysUserService;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户 业务层处理
*
@@ -116,6 +117,11 @@ public class SysUserServiceImpl implements ISysUserService
return userMapper.selectUserByUserName(userName);
}
@Override
public SysUser selectUserByEmail(String email) {
return userMapper.selectUserByEmail(email);
}
/**
* 通过用户ID查询用户
*

View File

@@ -128,6 +128,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.email = #{email} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}

View File

@@ -45,7 +45,7 @@ public class UEmailController extends BaseController {
if (!mailProperties.getEnabled()) {
return R.fail(MessageUtils.message("user.email.not.enable"));
}
String key = GlobalConstants.CAPTCHA_CODE_KEY + email;
String key = GlobalConstants.CAPTCHA_CODE_KEY + GlobalConstants.USER + email;
String code = RandomUtil.randomNumbers(4);
redisService.setCacheObject(key, code, Constants.MAIL_CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
try {

View File

@@ -1,23 +1,33 @@
package org.wfc.user.controller;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.wfc.common.core.constant.GlobalConstants;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.exception.CaptchaException;
import org.wfc.common.core.exception.VerificationCodeException;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.file.FileTypeUtils;
import org.wfc.common.core.utils.file.MimeTypeUtils;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.redis.service.RedisService;
import org.wfc.common.security.service.TokenService;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.RemoteUFileService;
import org.wfc.user.api.domain.UFile;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.bo.UUserForgotPwdBo;
import org.wfc.user.service.IUUserService;
import java.util.Arrays;
@@ -40,6 +50,9 @@ public class UProfileController extends BaseController
@Autowired
private RemoteUFileService remoteUFileService;
@Autowired
private RedisService redisService;
/**
* 个人信息
*/
@@ -124,6 +137,44 @@ public class UProfileController extends BaseController
return error(MessageUtils.message("user.modify.password.failed.contact.administrator"));
}
/**
* 忘记密码
*/
@PutMapping("/forgotPwd")
public AjaxResult forgotPwd(@RequestBody UUserForgotPwdBo UUserForgotPwdBo) {
UUser user = userService.selectUserByEmail(UUserForgotPwdBo.getEmail());
if (ObjectUtil.isNull(user)) {
return error("user.register.email.not.exist.error");
}
checkCaptchaEmail(UUserForgotPwdBo.getCode(), UUserForgotPwdBo.getEmail());
String newPassword = UUserForgotPwdBo.getPassword();
String password = user.getPassword();
String username = user.getUserName();
if (SecurityUtils.matchesPassword(newPassword, password)) {
return error("user.modify.password.failed.new.password.same.old.password");
}
newPassword = SecurityUtils.encryptPassword(newPassword);
if (userService.resetUserPwd(username, newPassword) > 0) {
return success();
}
return error("user.modify.password.failed.contact.administrator");
}
public void checkCaptchaEmail(String code, String email) throws CaptchaException {
if (StringUtils.isEmpty(code)) {
throw new VerificationCodeException("email.code.not.blankk");
}
String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + GlobalConstants.USER + StringUtils.nvl(email, "");
String captcha = redisService.getCacheObject(verifyKey);
if (captcha == null) {
throw new VerificationCodeException();
}
if (!code.equalsIgnoreCase(captcha)) {
throw new VerificationCodeException();
}
}
/**
* 头像上传
*/

View File

@@ -0,0 +1,15 @@
package org.wfc.user.domain.bo;
import lombok.Data;
/**
* @description: 忘记密码bo
* @author: cyc
* @since: 2025-02-12
*/
@Data
public class UUserForgotPwdBo {
private String email;
private String password;
private String code;
}

View File

@@ -44,6 +44,14 @@ public interface UUserMapper
*/
public UUser selectUserByUserName(String userName);
/**
* 通过邮箱查询用户
*
* @param email 邮箱
* @return 用户对象信息
*/
public UUser selectUserByEmail(String email);
/**
* 通过用户ID查询用户
*

View File

@@ -43,6 +43,14 @@ public interface IUUserService
*/
public UUser selectUserByUserName(String userName);
/**
* 通过邮箱查询用户
*
* @param email 用户名
* @return 用户对象信息
*/
public UUser selectUserByEmail(String email);
/**
* 通过用户ID查询用户
*

View File

@@ -109,6 +109,11 @@ public class UUserServiceImpl implements IUUserService
return userMapper.selectUserByUserName(userName);
}
@Override
public UUser selectUserByEmail(String email) {
return userMapper.selectUserByEmail(email);
}
/**
* 通过用户ID查询用户
*

View File

@@ -150,6 +150,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserByEmail" parameterType="String" resultMap="UUserResult">
<include refid="selectUserVo"/>
where u.email = #{email} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="UUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}