From d405d4d10f0e60be563ff974ab9a6e6fd0440a0a Mon Sep 17 00:00:00 2001 From: yss <17921@qq.com> Date: Tue, 15 Jun 2021 16:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserPasswordController.java | 14 ++++---------- .../userpassword/service/IUserPasswordService.java | 2 +- .../service/impl/UserPasswordServiceImpl.java | 10 +++++++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/controller/UserPasswordController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/controller/UserPasswordController.java index 95a87e7..61292b1 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/controller/UserPasswordController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/controller/UserPasswordController.java @@ -7,10 +7,7 @@ import com.chinaunicom.mall.ebtp.extend.userpassword.service.IUserPasswordServic import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -27,12 +24,9 @@ public class UserPasswordController{ * @return */ @ApiOperation("查询数据") - @GetMapping("/getPassword") - public BaseResponse getPassword(){ - - UserPassword userPassword = iuserPasswordService.list().get(0); - - return BaseResponse.success(userPassword); + @PostMapping("/validatePassword") + public BaseResponse validatePassword(@RequestParam String code){ + return BaseResponse.success(iuserPasswordService.validatePassword(code)); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/IUserPasswordService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/IUserPasswordService.java index 919ea73..0231fb3 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/IUserPasswordService.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/IUserPasswordService.java @@ -12,5 +12,5 @@ import com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword; public interface IUserPasswordService extends IService { - + boolean validatePassword(String code); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/impl/UserPasswordServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/impl/UserPasswordServiceImpl.java index 752ab11..ef4d5f9 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/impl/UserPasswordServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/userpassword/service/impl/UserPasswordServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.chinaunicom.mall.ebtp.extend.userpassword.dao.UserPasswordMapper; import com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword; import com.chinaunicom.mall.ebtp.extend.userpassword.service.IUserPasswordService; +import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; /** * 对数据表 user_password 操作的 serviceImpl @@ -13,5 +14,12 @@ import org.springframework.stereotype.Service; @Service public class UserPasswordServiceImpl extends ServiceImpl implements IUserPasswordService { - + @Override + public boolean validatePassword(String code) { + UserPassword userPassword = this.list().get(0); + if(StringUtils.isNotBlank(code) && code.equals(userPassword.getPassword())){ + return true; + } + return false; + } }