From e1bdd49dbe6e70c68aa5f4df1c28677b7bcdcac8 Mon Sep 17 00:00:00 2001 From: tomoya92 Date: Fri, 24 May 2019 23:49:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8C=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E6=9C=89=E5=A4=9A=E6=9D=A1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=97=B6=E6=9F=A5=E8=AF=A2=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/co/yiiu/pybbs/service/CodeService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/co/yiiu/pybbs/service/CodeService.java b/src/main/java/co/yiiu/pybbs/service/CodeService.java index f374bc8f5..70f2b2cc6 100644 --- a/src/main/java/co/yiiu/pybbs/service/CodeService.java +++ b/src/main/java/co/yiiu/pybbs/service/CodeService.java @@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Date; +import java.util.List; /** * Created by tomoya. @@ -59,7 +60,9 @@ public Code selectNotUsedCode(Integer userId, String email, String mobile) { } lambda.eq(Code::getUsed, false); lambda.gt(Code::getExpireTime, new Date()); - return codeMapper.selectOne(wrapper); + List codes = codeMapper.selectList(wrapper); + if (codes.isEmpty()) return null; + return codes.get(0); } // 创建一条验证码记录