From 4b7447beff647a63031baf12e8d078a9babfc569 Mon Sep 17 00:00:00 2001 From: pengbaohao <1336737600@qq.com> Date: Thu, 21 Nov 2024 15:44:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/pengbaohao/controller/LoginR.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 code/springboot/newBank/src/main/java/demo/pengbaohao/controller/LoginR.java diff --git a/code/springboot/newBank/src/main/java/demo/pengbaohao/controller/LoginR.java b/code/springboot/newBank/src/main/java/demo/pengbaohao/controller/LoginR.java new file mode 100644 index 000000000..e87bb2137 --- /dev/null +++ b/code/springboot/newBank/src/main/java/demo/pengbaohao/controller/LoginR.java @@ -0,0 +1,40 @@ +package demo.pengbaohao.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +@RestController +public class LoginR { + + @Autowired + private JdbcTemplate jdbcTemplate; + + @RequestMapping("/staffloginR") + public String getAllNewTableData(HttpServletRequest request) { + + String staffNo=request.getParameter("staffNo"); + String password=request.getParameter("password");//前端送过来的密码 + + String sql ="select password from staff where staffNo ='"+staffNo+"'"; + + List> list=jdbcTemplate.queryForList(sql); + + String result=""; + if(list==null||list.size()==0){ + result="0";//0表示不通过 + } + if(password.equals(list.get(0).get("password"))){ + result="1";//1表示通过 + }else { + result="0";//0表示不通过 + } + return result; + } + +}