From 032cee85a1fc0a69055f1c0d454d60aa988049ed Mon Sep 17 00:00:00 2001 From: "jiakun.lin" Date: Mon, 26 Apr 2021 14:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liuwanr/controller/UserController.java | 24 +++++++++++++++++++ .../com/yipin/liuwanr/mapper/UserMapper.java | 4 ++++ .../yipin/liuwanr/service/UserService.java | 14 +++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/main/java/com/yipin/liuwanr/controller/UserController.java b/src/main/java/com/yipin/liuwanr/controller/UserController.java index 897a8b0..e8bfdcc 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserController.java @@ -556,4 +556,28 @@ public class UserController { } return resp; } + + /** + * 查询邮箱是否存在 + */ + @GetMapping("/queryEmail") + Response queryEmail(@RequestParam String email) { + Response resp = new Response(); + if (email==null||email=="") {//前台传来的值是否为空 + resp.setStatus(300); + resp.setErrmessage("邮箱为空!查询失败!"); + }else { + HashMap ret = userService.queryEmail(email); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + } diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java index 5750558..b2a37fb 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java @@ -286,4 +286,8 @@ public interface UserMapper { @Update("update user set lastTimeOfLanding=#{time},logInNumber=#{logInNumber} where userId=#{userId}") void updateUserQ(@Param("time")String time,@Param("logInNumber") Integer logInNumber,@Param("userId") Integer userId); + + //查询用户邮箱 + @Select("SELECT u.email,u.userId from hr_user_info u where isdel = 0 and email = #{email}") + List queryEmail(String email); } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/service/UserService.java b/src/main/java/com/yipin/liuwanr/service/UserService.java index ca48336..6dd8fc3 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserService.java @@ -423,4 +423,18 @@ public class UserService { } return resp; } + + public HashMap queryEmail(String email) { + HashMap resp = new HashMap(); + try { + resp.put("retvalue", userMapper.queryEmail(email)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "查询手机号失败!"); + return resp; + } + return resp; + } }