1 changed files with 40 additions and 0 deletions
@ -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<Map<String,Object>> 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; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue