commit
2519da14e9
@ -1,56 +1,115 @@
|
||||
package controller;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import service.LoginService;
|
||||
import domain.UserPO;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
@Autowired@Qualifier("LoginServiceImpl")
|
||||
private LoginService loginService;
|
||||
@RequestMapping("/login")
|
||||
public void login(int userid, int userpassword,
|
||||
HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
UserPO userPO=this.loginService.FindByUserid(userid);
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
/* 设置响应头允许ajax跨域访问 */
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
/* 星号表示所有的异域请求都可以接受, */
|
||||
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
|
||||
System.out.println(userid);
|
||||
if(userPO!=null)
|
||||
if(userpassword==userPO.getUserpassword())
|
||||
{
|
||||
System.out.println("密码正确");
|
||||
Writer out = response.getWriter();
|
||||
out.write("111");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
|
||||
else{
|
||||
System.out.println("密码错误");
|
||||
Writer out = response.getWriter();
|
||||
out.write("100");
|
||||
out.flush();
|
||||
}
|
||||
else{
|
||||
System.out.println("不存在用户名");
|
||||
Writer out = response.getWriter();
|
||||
out.write("001");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
package controller;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import service.LoginService;
|
||||
import domain.UserPO;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
@Autowired@Qualifier("LoginServiceImpl")
|
||||
private LoginService loginService;
|
||||
@RequestMapping("/login")
|
||||
public void login(int s_id, int s_password,
|
||||
HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
UserPO userPO=this.loginService.FindByUserid(s_id);
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
/* 设置响应头允许ajax跨域访问 */
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
/* 星号表示所有的异域请求都可以接受, */
|
||||
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
|
||||
System.out.println(s_id);
|
||||
if(userPO!=null)
|
||||
if(s_password==userPO.getUserpassword())
|
||||
{
|
||||
System.out.println("密码正确");
|
||||
Writer out = response.getWriter();
|
||||
out.write("111");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
|
||||
else{
|
||||
System.out.println("密码错误");
|
||||
Writer out = response.getWriter();
|
||||
out.write("100");
|
||||
out.flush();
|
||||
}
|
||||
else{
|
||||
System.out.println("不存在用户名");
|
||||
Writer out = response.getWriter();
|
||||
out.write("001");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
=======
|
||||
package controller;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import service.LoginService;
|
||||
import domain.UserPO;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
@Autowired@Qualifier("LoginServiceImpl")
|
||||
private LoginService loginService;
|
||||
@RequestMapping("/login")
|
||||
public void login(int userid, int userpassword,
|
||||
HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
UserPO userPO=this.loginService.FindByUserid(userid);
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
/* 设置响应头允许ajax跨域访问 */
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
/* 星号表示所有的异域请求都可以接受, */
|
||||
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
|
||||
System.out.println(userid);
|
||||
if(userPO!=null)
|
||||
if(userpassword==userPO.getUserpassword())
|
||||
{
|
||||
System.out.println("密码正确");
|
||||
Writer out = response.getWriter();
|
||||
out.write("111");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
|
||||
else{
|
||||
System.out.println("密码错误");
|
||||
Writer out = response.getWriter();
|
||||
out.write("100");
|
||||
out.flush();
|
||||
}
|
||||
else{
|
||||
System.out.println("不存在用户名");
|
||||
Writer out = response.getWriter();
|
||||
out.write("001");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
>>>>>>> 0877d8ad681d47bc72cd343cd73f8dfb7321c3b6
|
||||
|
@ -1,29 +1,61 @@
|
||||
package domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserPO implements Serializable{
|
||||
private int userid;
|
||||
private int userpassword;
|
||||
private String username;
|
||||
public int getUserid() {
|
||||
return userid;
|
||||
}
|
||||
public void setUserid(int userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
public int getUserpassword() {
|
||||
return userpassword;
|
||||
}
|
||||
public void setUserpassword(int userpassword) {
|
||||
this.userpassword = userpassword;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
package domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserPO implements Serializable{
|
||||
private int s_id;
|
||||
private int userpassword;
|
||||
private String username;
|
||||
public int getUserid() {
|
||||
return userid;
|
||||
}
|
||||
public void setUserid(int userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
public int getUserpassword() {
|
||||
return userpassword;
|
||||
}
|
||||
public void setUserpassword(int userpassword) {
|
||||
this.userpassword = userpassword;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
=======
|
||||
package domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserPO implements Serializable{
|
||||
private int userid;
|
||||
private int userpassword;
|
||||
private String username;
|
||||
public int getUserid() {
|
||||
return userid;
|
||||
}
|
||||
public void setUserid(int userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
public int getUserpassword() {
|
||||
return userpassword;
|
||||
}
|
||||
public void setUserpassword(int userpassword) {
|
||||
this.userpassword = userpassword;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
>>>>>>> 0877d8ad681d47bc72cd343cd73f8dfb7321c3b6
|
||||
|
@ -1,12 +1,27 @@
|
||||
package mapperDAO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import domain.UserPO;
|
||||
|
||||
@Repository("UserDAO")
|
||||
public interface UserDAO {
|
||||
public UserPO FindByUserid(int userid);
|
||||
|
||||
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
package mapperDAO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import domain.UserPO;
|
||||
|
||||
@Repository("UserDAO")
|
||||
public interface UserDAO {
|
||||
public UserPO FindByUserid(int s_id);
|
||||
|
||||
|
||||
}
|
||||
=======
|
||||
package mapperDAO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import domain.UserPO;
|
||||
|
||||
@Repository("UserDAO")
|
||||
public interface UserDAO {
|
||||
public UserPO FindByUserid(int userid);
|
||||
|
||||
|
||||
}
|
||||
>>>>>>> 0877d8ad681d47bc72cd343cd73f8dfb7321c3b6
|
||||
|
@ -1,8 +1,19 @@
|
||||
package service;
|
||||
|
||||
import domain.UserPO;
|
||||
|
||||
public interface LoginService{
|
||||
|
||||
public UserPO FindByUserid(int userid);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
package service;
|
||||
|
||||
import domain.UserPO;
|
||||
|
||||
public interface LoginService{
|
||||
|
||||
public UserPO FindByUserid(int s_id);
|
||||
}
|
||||
=======
|
||||
package service;
|
||||
|
||||
import domain.UserPO;
|
||||
|
||||
public interface LoginService{
|
||||
|
||||
public UserPO FindByUserid(int userid);
|
||||
}
|
||||
>>>>>>> 0877d8ad681d47bc72cd343cd73f8dfb7321c3b6
|
||||
|
@ -1,22 +1,47 @@
|
||||
package serviceimpl;
|
||||
|
||||
import mapperDAO.UserDAO;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import domain.UserPO;
|
||||
import service.LoginService;
|
||||
|
||||
@Component("LoginServiceImpl")
|
||||
public class LoginServiceImpl implements LoginService{
|
||||
@Autowired@Qualifier("UserDAO")
|
||||
private UserDAO userDAO;
|
||||
|
||||
|
||||
public UserPO FindByUserid(int userid){
|
||||
return this.userDAO.FindByUserid(userid);
|
||||
}
|
||||
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
package serviceimpl;
|
||||
|
||||
import mapperDAO.UserDAO;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import domain.UserPO;
|
||||
import service.LoginService;
|
||||
|
||||
@Component("LoginServiceImpl")
|
||||
public class LoginServiceImpl implements LoginService{
|
||||
@Autowired@Qualifier("UserDAO")
|
||||
private UserDAO userDAO;
|
||||
|
||||
|
||||
public UserPO FindByUserid(int s_id){
|
||||
return this.userDAO.FindByUserid(s_id);
|
||||
}
|
||||
|
||||
}
|
||||
=======
|
||||
package serviceimpl;
|
||||
|
||||
import mapperDAO.UserDAO;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import domain.UserPO;
|
||||
import service.LoginService;
|
||||
|
||||
@Component("LoginServiceImpl")
|
||||
public class LoginServiceImpl implements LoginService{
|
||||
@Autowired@Qualifier("UserDAO")
|
||||
private UserDAO userDAO;
|
||||
|
||||
|
||||
public UserPO FindByUserid(int userid){
|
||||
return this.userDAO.FindByUserid(userid);
|
||||
}
|
||||
|
||||
}
|
||||
>>>>>>> 0877d8ad681d47bc72cd343cd73f8dfb7321c3b6
|
||||
|
Loading…
Reference in new issue