项目效果图
StudentController.java
package cn.wmyskxz.controller;
import cn.wmyskxz.entity.Student;
import cn.wmyskxz.service.StudentService;
import cn.wmyskxz.util.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Student 控制器
*
* @author:z84108918
*/
@Controller
public class StudentController {
@Autowired
private StudentService studentService;
@RequestMapping(value = "/queryByCon", method = RequestMethod.POST)
@ResponseBody
public List<Student> queryByCon(@RequestBody Student student)
{
List<Student> stu = new ArrayList<Student>();
stu = studentService.findOrdersByCon(student.getName(), student.getSex(), student.getGrade(), student.getClass_name());
return stu;
}
}
UserController.java
package cn.wmyskxz.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import cn.wmyskxz.entity.User;
import cn.wmyskxz.service.StudentService;
import cn.wmyskxz.service.UserService;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
@RestController
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public boolean login(@RequestBody User user)
{
return userService.checkLogin(user.getUserName(), user.getPassword());
}
}
StudentDao.java
package cn.wmyskxz.dao;
import cn.wmyskxz.entity.Student;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface StudentDao
{
int getTotal();
void addStudent(Student student);
void deleteStudent(int id);
void updateStudent(Student student);
Student getStudent(int id);
void getStudentByFuzzyQuery(Student student);
List<Student> list(@Param("start") int start, @Param("count") int count);
List<Student> findOrdersByCon(@Param("name") String name, @Param("sex") String sex, @Param("grade") int grade,
@Param("class_name") int class_name);
// List<Student> findOrdersByCon(Student student);
}
UserDao.java
package cn.wmyskxz.dao;
import java.sql.SQLException;
import org.apache.ibatis.annotations.Param;
import cn.wmyskxz.entity.User;
public interface UserDao {
int insert(User user) throws SQLException;
User selectByName(@Param("userName") String userName) throws SQLException;
}
Student.java
package cn.wmyskxz.entity;
/**
* Student 实体类
*
* @author:
*/
public class Student {
private int id;
private int student_id;
private String name;