DormitorySystem
- 毕业设计💼
- MD5加密🔒
- SSM框架🎨
- Layui框架🎄
实现功能
一些截图
实现功能分类
结构
Spring SpringMVC Mybatis
核心代码
package com.itheima.service.impl;
import com.itheima.dao.StudentDao;
import com.itheima.po.PageInfo;
import com.itheima.po.Student;
import com.itheima.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 用户Service接口实现类
*/
@Service("studentService")
@Transactional
public class StudentServiceImpl implements StudentService {
// 注入studentDao
@Autowired
private StudentDao studentDao;
//分页查询
@Override
public PageInfo<Student> findPageInfo(String s_name, Integer s_studentid,Integer s_classid,
String s_classname, Integer pageIndex, Integer pageSize) {
PageInfo<Student> pi = new PageInfo<Student>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = studentDao.totalCount(s_name,s_studentid,s_classid,s_classname);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示学生信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<Student> studentList = studentDao.getStudentList(s_name,s_studentid,s_classid,s_classname,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(studentList);
}
return pi;
}
@Override
public List<Student> getAll(){
List<Student> studentList = studentDao.getAll();
return studentList;
}
//通过id删除学生信息
@Override
public int deleteStudent(Integer s_id) {
return studentDao.deleteStudent(s_id);
}
//添加学生信息
@Override
public int addStudent(Student student) {
return studentDao.addStudent(student);
}
//修改学生信息
@Override
public int updateStudent(Student student) { return studentDao.updateStudent(student); }
@Override
public Student findStudentById (Integer s_id){
Student s = studentDao.findStudentById(s_id);
return s;
}
}
package com.itheima.service.impl;
import com.itheima.dao.VisitorDao;
import com.itheima.po.PageInfo;
import com.itheima.po.Visitor;
import com.itheima.service.VisitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @program: dormitorySystem
* @description: 访客
* @author: Joyrocky
* @create: 2019-05-14 12:39
**/
@Service("visitorService")
@Transactional
public class VisitorServiceImpl implements VisitorService {
// 注入studentDao
@Autowired
private VisitorDao visitorDao;
//分页查询
@Override
public PageInfo<Visitor> findPageInfo(String v_name, Integer v_phone , Integer pageIndex, Integer pageSize) {
PageInfo<Visitor> pi = new PageInfo<Visitor>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = visitorDao.totalCount(v_name,v_phone);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示学生信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<Visitor> visitorList = visitorDao.getVisitorList(v_name,v_phone,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(visitorList);
}
return pi;
}
@Override
public List<Visitor> getAll(){
List<Visitor> visitorList = visitorDao.getAll();
return visitorList;
}
//添加学生信息
@Override
public int addVisitor(Visitor visitor) {
return visitorDao.addVisitor(visitor);
}
}
package com.itheima.service.impl;
import com.itheima.dao.ClassDao;
import com.itheima.po.Class;
import com.itheima.po.PageInfo;
import com.itheima.service.ClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 用户Service接口实现类
*/
@Service("classService")
@Transactional
public class ClassServiceImpl implements ClassService {
// classDao
@Autowired
private ClassDao classDao;
//分页查询
@Override
public PageInfo<Class> findPageInfo(String c_classname, String c_counsellor, Integer c_classid, Integer pageIndex, Integer pageSize) {
PageInfo<Class> pi = new PageInfo<Class>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = classDao.totalCount(c_classname,c_classid,c_counsellor);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示班级信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<Class> classList = classDao.getClassList(c_classname,c_classid,c_counsellor,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(classList);
}
return pi;
}
@Override
public List<Class> getAll(){
List<Class> classList = classDao.getAll();
return classList;
}
//通过id删除班级信息
@Override
public int deleteClass(Integer c_id) {
return classDao.deleteClass(c_id);
}
//添加班级信息
@Override
public int addClass(Class uclass) {
return classDao.addClass(uclass);
}
@Override
public Class findClassById (Integer c_id){
Class c = classDao.findClassById(c_id);
return c;
}
//修改班级信息
@Override
public int updateClass(Class uclass) {
return classDao.updateClass(uclass);
}
//查询宿舍人员信息
@Override
public List<Class> findClassStudent(Class uclass) {
List<Class> c = classDao.findClassStudent(uclass);
return c;
}
}
package com.itheima.service.impl;
import com.itheima.dao.AdminDao;
import com.itheima.po.Admin;
import com.itheima.po.PageInfo;
import com.itheima.service.AdminService;
import com.itheima.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 用户Service接口实现类
*/
@Service("adminService")
@Transactional
public class AdminServiceImpl implements AdminService {
// 注入UserDao
@Autowired
private AdminDao adminDao;
//管理登陆查询
@Override
public Admin findAdmin(Admin admin) {
Admin a = adminDao.findAdmin(admin);
return a;
}
@Override
public List<Admin> getAll(){
List<Admin> adminList = adminDao.getAll();
return adminList;
}
@Override
public PageInfo<Admin> findPageInfo(String a_username, String a_describe,Integer a_id,Integer pageIndex, Integer pageSize) {
PageInfo<Admin> pi = new PageInfo<Admin>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = adminDao.totalCount(a_username,a_describe,a_id);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示管理员信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<Admin> adminList = adminDao.getAdminList(a_username,a_describe,a_id,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(adminList);
}
return pi;
}
//添加管理员信息
@Override
public int addAdmin(Admin admin) {
return adminDao.addAdmin(admin);
}
//通过id删除管理员信息
@Override
public int deleteAdmin(Integer a_id) {
return adminDao.deleteAdmin(a_id);
}
//修改管理员信息
@Override
public int updateAdmin(Admin admin) {
return adminDao.updateAdmin(admin);
}
@Override
public Admin findAdminById (Integer a_id){
Admin a = adminDao.findAdminById(a_id);
return a;
}
}
源码地址:https://github.com/Joyrocky/DormitoryManager