develop
spc 5 months ago
parent 6622544ff5
commit b75a130441

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
<!-- 读取db.properties -->
<context:property-placeholder location="classpath:db.properties"/>
<!-- 配置数据源 -->
<bean id="dataSource"
class="org.apache.commons.dbcp2.BasicDataSource">
<!--数据库驱动 -->
<property name="driverClassName" value="${jdbc.driver}" />
<!--连接数据库的url -->
<property name="url" value="${jdbc.url}" />
<!--连接数据库的用户名 -->
<property name="username" value="${jdbc.username}" />
<!--连接数据库的密码 -->
<property name="password" value="${jdbc.password}" />
<!--最大连接数 -->
<property name="maxTotal" value="${jdbc.maxTotal}" />
<!--最大空闲连接 -->
<property name="maxIdle" value="${jdbc.maxIdle}" />
<!--初始化连接数 -->
<property name="initialSize" value="${jdbc.initialSize}" />
</bean>
<!-- 事务管理器,依赖于数据源 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 开启事务注解 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- 配置MyBatis工厂SqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!--注入数据源 -->
<property name="dataSource" ref="dataSource" />
<!--指定核MyBatis心配置文件位置 -->
<property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>
<!-- 配置mapper扫描器 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.itheima.dao"/>
</bean>
<!-- 扫描Service -->
<context:component-scan base-package="com.itheima.service" />
</beans>

@ -0,0 +1,129 @@
package com.itheima.controller;
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.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
*
*/
@Controller
public class AdminController {
// 依赖注入
@Autowired
private AdminService adminService;
/**
*
*/
/**
* (username,password)Admin
*/
@RequestMapping(value = "/login")
public String login( Admin admin, Model model, HttpSession session, HttpServletRequest request) {
// 通过账号和密码查询用户
admin.setA_password(MD5Util.MD5EncodeUtf8(admin.getA_password()));
Admin ad = adminService.findAdmin(admin);
if(ad!=null){
session.setAttribute("ad", ad);
return "homepage";
}
model.addAttribute("msg", "用户名或密码错误,请重新登录!");
return "login";
}
/**
* 退
*/
@RequestMapping(value = "/loginOut")
public String loginOut(Admin admin, Model model, HttpSession session) {
session.invalidate();
return "login";
}
/**
*
*/
@RequestMapping(value = "/findAdmin")
public String findAdmin(String a_username, String a_describe,Integer pageIndex,
Integer a_id ,Integer pageSize, Model model) {
PageInfo<Admin> ai = adminService.findPageInfo(a_username,a_describe,
a_id,pageIndex,pageSize);
model.addAttribute("ai",ai);
return "admin_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportadminlist" , method = RequestMethod.POST)
@ResponseBody
public List<Admin> exportAdmin(){
List<Admin> admin = adminService.getAll();
return admin;
}
/**
*
*/
@RequestMapping(value = "/addAdmin" ,method = RequestMethod.POST)
@ResponseBody
public String addAdmin( @RequestBody Admin admin) {
admin.setA_password(MD5Util.MD5EncodeUtf8(admin.getA_password()));
int a = adminService.addAdmin(admin);
return "admin_list";
}
/**
* a_ida_id
*/
@RequestMapping( "/deleteAdmin")
@ResponseBody
public String deleteAdmin(Integer a_id) {
int a = adminService.deleteAdmin(a_id);
return "admin_list";
}
/**
*
*/
/**
* (a_id,a_username...)Admin
*/
@RequestMapping( value = "/updateAdmin", method = RequestMethod.POST)
public String updateAdmin(Admin admin) {
admin.setA_password(MD5Util.MD5EncodeUtf8(admin.getA_password()));
int a = adminService.updateAdmin(admin);
return "redirect:/findAdmin";
}
/**
* Id;a_ida_id
*/
@RequestMapping( "/findAdminById")
public String findAdminById( Integer a_id,HttpSession session) {
Admin a= adminService.findAdminById(a_id);
session.setAttribute("a",a);
return "admin_edit";
}
}

@ -0,0 +1,107 @@
package com.itheima.controller;
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.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;
/**
*
*/
@Controller
public class ClassController {
// 依赖注入
@Autowired
private ClassService classService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findClass")
public String findClass(Integer c_classid, String c_classname, String c_counsellor,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<Class> ci = classService.findPageInfo(c_classname,c_counsellor,
c_classid,pageIndex,pageSize);
model.addAttribute("ci",ci);
model.addAttribute("c_classid",c_classid);
return "class_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportclasslist", method = RequestMethod.POST)
@ResponseBody
public List<Class> exportClass(){
List<Class> classList = classService.getAll();
return classList;
}
/**
*
*/
@RequestMapping( "/deleteClass")
@ResponseBody
public String deleteClass(Integer c_id) {
int c = classService.deleteClass(c_id);
return "class_list";
}
/**
*
*/
@RequestMapping(value = "/addClass" ,method = RequestMethod.POST)
@ResponseBody
public String addClass( @RequestBody Class uclass) {
int c = classService.addClass(uclass);
return "class_list";
}
@RequestMapping( "/findClassById")
public String findClassById( Integer c_id,HttpSession session) {
Class c= classService.findClassById(c_id);
session.setAttribute("c",c);
return "class_edit";
}
/**
*
*/
@RequestMapping(value = "/updateClass" ,method = RequestMethod.POST)
public String updateClass( Class uclass) {
int c = classService.updateClass(uclass);
return "redirect:/findClass";
}
/**
*
*/
@RequestMapping(value = "/findClassStudent")
public String findClassStudent(Class uclass,Model model) {
List<Class> c = classService.findClassStudent(uclass);
model.addAttribute("cs",c);
return "class_Studentlist";
}
//采用Ajax来提交表单并返回JSON数据
// @RequestMapping(value = "/findClassStudentlist",method = RequestMethod.POST)
// @ResponseBody
// public List<Class> findClassStudentlist(@RequestBody Class uclass){
// List<Class> c = classService.findClassStudent(uclass);
// return c;
// }
}

@ -0,0 +1,98 @@
package com.itheima.controller;
import com.itheima.po.DormClean;
import com.itheima.po.PageInfo;
import com.itheima.service.DormCleanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
/**
* @program: dormitorySystem
* @description: 宿
* @author: Joyrocky
* @create: 2019-04-24 11:19
**/
@Controller
public class DormCleanController {
//依赖注入
@Autowired
private DormCleanService dormCleanService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findDormClean")
public String findDormClean(Integer d_id,String d_dormbuilding,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<DormClean> di = dormCleanService.findPageInfo(d_id,d_dormbuilding,
pageIndex,pageSize);
model.addAttribute("di",di);
return "dormclean_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportdormcleanlist", method = RequestMethod.POST)
@ResponseBody
public List<DormClean> exportDormclean(){
List<DormClean> dormclean = dormCleanService.getAll();
return dormclean;
}
/**
* 宿
*/
@RequestMapping(value = "/addDormClean" ,method = RequestMethod.POST)
@ResponseBody
public String addDormClean( @RequestBody DormClean dormclean) {
int d = dormCleanService.addDormClean(dormclean);
return "dormclean_list";
}
/**
* 宿
*/
@RequestMapping( "/deleteDormClean")
@ResponseBody
public String deleteDormClean(Integer g_id) {
int d = dormCleanService.deleteDormClean(g_id);
return "dormclean_list";
}
/**
* 宿
*/
@RequestMapping( "/updateDormClean")
public String updateDormClean( DormClean dormclean) {
int d = dormCleanService.updateDormClean(dormclean);
return "redirect:/findDormClean";
}
@RequestMapping( "/findDormCleanById")
public String findDormCleanById(Integer g_id, HttpSession session) {
DormClean d= dormCleanService.findDormCleanById(g_id);
session.setAttribute("d",d);
return "dormclean_edit";
}
}

@ -0,0 +1,95 @@
package com.itheima.controller;
import com.itheima.po.DormRepair;
import com.itheima.po.Dormitory;
import com.itheima.po.PageInfo;
import com.itheima.service.DormRepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-27 17:13
**/
@Controller
public class DormRepairController {
// 依赖注入
@Autowired
private DormRepairService dormRepairService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findDormRepair")
public String findDormRepair(Integer d_id,String d_dormbuilding,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<DormRepair> di = dormRepairService.findPageInfo(d_id,d_dormbuilding,
pageIndex,pageSize);
model.addAttribute("di",di);
return "dormrepair_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportdormrepairlist", method = RequestMethod.POST)
@ResponseBody
public List<DormRepair> exportDormrepair(){
List<DormRepair> dormRepairList = dormRepairService.getAll();
return dormRepairList;
}
/**
* 宿
*/
@RequestMapping(value = "/addDormRepair" ,method = RequestMethod.POST)
@ResponseBody
public String addDormitory( @RequestBody DormRepair dormrepair) {
int d = dormRepairService.addDormRepair(dormrepair);
return "dormrepair_list";
}
/**
* 宿
*/
@RequestMapping( "/deleteDormRepair")
@ResponseBody
public String deleteDormRepair(Integer r_id) {
int d = dormRepairService.deleteDormRepair(r_id);
return "dormrepair_list";
}
/**
*
*/
@RequestMapping( "/updateDormRepair")
public String updateDormRepair( DormRepair dormrepair) {
int d = dormRepairService.updateDormRepair(dormrepair);
return "redirect:/findDormRepair";
}
@RequestMapping( "/findDormRepairById")
public String findDormRepairById(Integer r_id, HttpSession session) {
DormRepair d= dormRepairService.findDormRepairById(r_id);
session.setAttribute("d",d);
return "dormrepair_edit";
}
}

@ -0,0 +1,102 @@
package com.itheima.controller;
import com.itheima.po.Dormitory;
import com.itheima.po.PageInfo;
import com.itheima.service.DormitoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;
/**
*
*/
@Controller
public class DormitoryController {
// 依赖注入
@Autowired
private DormitoryService dormitoryService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findDormitory")
public String findDormitory(String a_name,Integer s_dormitoryid,String d_dormbuilding,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<Dormitory> di = dormitoryService.findPageInfo(a_name,s_dormitoryid,
d_dormbuilding,pageIndex,pageSize);
model.addAttribute("di",di);
return "dormitory_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportdormitorylist", method = RequestMethod.POST)
@ResponseBody
public List<Dormitory> exportDormitory(){
List<Dormitory> dormitoryList = dormitoryService.getAll();
return dormitoryList;
}
/**
* 宿
*/
@RequestMapping(value = "/addDormitory" ,method = RequestMethod.POST)
@ResponseBody
public String addDormitory( @RequestBody Dormitory dormitory) {
int d = dormitoryService.addDormitory(dormitory);
return "dormitory_list";
}
/**
* 宿
*/
@RequestMapping( "/deleteDormitory")
@ResponseBody
public String deleteDormitory(Integer d_id) {
int d = dormitoryService.deleteDormitory(d_id);
return "dormitory_list";
}
/**
*
*/
@RequestMapping( "/updateDormitory")
public String updateDormitory( Dormitory dormitory) {
int d = dormitoryService.updateDormitory(dormitory);
return "redirect:/findDormitory";
}
@RequestMapping( "/findDormitoryById")
public String findDormitoryById(Integer d_id,HttpSession session) {
Dormitory d= dormitoryService.findDormitoryById(d_id);
session.setAttribute("d",d);
return "dormitory_edit";
}
/**
* 宿
*/
@RequestMapping(value = "/findDormitoryStudent")
public String findDormitoryStudent(Dormitory dormitory,Model model) {
List<Dormitory> d = dormitoryService.findDormitoryStudent(dormitory);
model.addAttribute("ds",d);
return "dormitory_Studentlist";
}
}

@ -0,0 +1,90 @@
package com.itheima.controller;
import com.itheima.po.PageInfo;
import com.itheima.po.StudentClean;
import com.itheima.service.StudentCleanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-25 12:13
**/
@Controller
public class StudentCleanController {
//依赖注入
@Autowired
private StudentCleanService studentCleanService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findStudentClean")
public String findDormClean(Integer s_studentid, String s_name, Integer s_dormitoryid, Integer pageIndex, Integer pageSize, Model model) {
PageInfo<StudentClean> di = studentCleanService.findPageInfo(s_studentid,s_name,s_dormitoryid,pageIndex,pageSize);
model.addAttribute("di",di);
return "studentclean_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportstudentcleanlist", method = RequestMethod.POST)
@ResponseBody
public List<StudentClean> exportStudentclean(){
List<StudentClean> studentCleanList = studentCleanService.getAll();
return studentCleanList;
}
/**
* 宿
*/
@RequestMapping(value = "/addStudentClean" ,method = RequestMethod.POST)
@ResponseBody
public String addDormClean( @RequestBody StudentClean studentclean) {
int d = studentCleanService.addStudentClean(studentclean);
return "studentclean_list";
}
/**
* 宿
*/
@RequestMapping( "/deleteStudentClean")
@ResponseBody
public String deleteDormClean(Integer g_id) {
int d = studentCleanService.deleteStudentClean(g_id);
return "studentclean_list";
}
/**
* 宿
*/
@RequestMapping( "/updateStudentClean")
public String updateDormClean( StudentClean studentclean) {
int d = studentCleanService.updateStudentClean(studentclean);
return "redirect:/findStudentClean";
}
@RequestMapping( "/findStudentCleanById")
public String findDormCleanById(Integer g_id, HttpSession session) {
StudentClean d= studentCleanService.findStudentCleanById(g_id);
session.setAttribute("d",d);
return "studentclean_edit";
}
}

@ -0,0 +1,90 @@
package com.itheima.controller;
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.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
*
*/
@Controller
public class StudentController {
// 依赖注入
@Autowired
private StudentService studentService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findStudent")
public String findStudent(String s_name, Integer s_studentid,Integer s_classid, String s_classname,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<Student> pi = studentService.findPageInfo(s_name,s_studentid,s_classid,
s_classname,pageIndex,pageSize);
model.addAttribute("pi",pi);
model.addAttribute("s_name",s_name);
return "student_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportstudentlist", method = RequestMethod.POST)
@ResponseBody
public List<Student> exportStudent(){
List<Student> studentList = studentService.getAll();
return studentList;
}
/**
*
*/
@RequestMapping( "/deleteStudent")
@ResponseBody
public String deleteStudent(Integer s_id) {
int s = studentService.deleteStudent(s_id);
return "student_list";
}
/**
*
*/
@RequestMapping(value = "/addStudent" ,method = RequestMethod.POST)
@ResponseBody
public String addStudent(@RequestBody Student student) {
int s = studentService.addStudent(student);
return "student_list";
}
/**
*
*/
@RequestMapping(value = "/updateStudent" ,method = RequestMethod.POST )
public String updateStudent( Student student) {
int s = studentService.updateStudent(student);
return "redirect:/findStudent";
}
@RequestMapping( "/findStudentById")
public String findStudentById(Integer s_id,HttpSession session) {
Student s= studentService.findStudentById(s_id);
session.setAttribute("s",s);
return "student_edit";
}
}

@ -0,0 +1,65 @@
package com.itheima.controller;
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.Controller;
import org.springframework.ui.Model;
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 java.util.List;
/**
* @program: dormitorySystem
* @description: 访
* @author: Joyrocky
* @create: 2019-05-14 12:37
**/
@Controller
public class VisitorController {
//依赖注入
@Autowired
private VisitorService visitorService;
/**
*
* pageIndex
* pageSize
*/
@RequestMapping(value = "/findVisitor")
public String findVisitor(String v_name, Integer v_phone , Integer pageIndex,
Integer pageSize, Model model) {
PageInfo<Visitor> pi = visitorService.findPageInfo(v_name,v_phone,
pageIndex,pageSize);
model.addAttribute("pi",pi);
model.addAttribute("v_name",v_name);
return "visitor_list";
}
/**
* Excel
*/
@RequestMapping(value = "/exportvisitorlist", method = RequestMethod.POST)
@ResponseBody
public List<Visitor> exportVisitor(){
List<Visitor> visitorList = visitorService.getAll();
return visitorList;
}
/**
*
*/
@RequestMapping(value = "/addVisitor" ,method = RequestMethod.POST)
@ResponseBody
public String addStudent(@RequestBody Visitor visitor) {
int v = visitorService.addVisitor(visitor);
return "visitor_list";
}
}

@ -0,0 +1,31 @@
package com.itheima.dao;
import com.itheima.po.Admin;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* DAO
*/
public interface AdminDao {
/**
*
*/
public Admin findAdmin(Admin admin);
/**
*
*/
//获取总条数
public Integer totalCount(@Param("a_username") String a_username, @Param("a_describe") String a_describe,@Param("a_id") Integer a_id);
//获取用户列表
public List<Admin> getAdminList(@Param("a_username") String a_username, @Param("a_describe") String a_describe,@Param("a_id") Integer a_id, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
public int addAdmin(Admin admin); //添加管理员信息
public int deleteAdmin(Integer a_id); //删除管理员信息
public int updateAdmin(Admin admin); //修改管理员信息
public Admin findAdminById(Integer a_id);
public List<Admin> getAll();
}

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.AdminDao" >
<!--登陆查询-->
<select id="findAdmin" parameterType="Admin" resultType="Admin">
select * from d_admin
where
<if test="a_username!=null and a_username!='' ">
a_username = #{a_username}
</if>
<if test="a_password!=null and a_password!='' ">
and a_password = #{a_password}
</if>
</select>
<!--分页查询-->
<select id="getAdminList" parameterType="Admin" resultType="Admin">
select * from d_admin
<where>
<if test="a_username!=null and a_username!='' ">
and a_username like '%${a_username}%'
</if>
<if test="a_describe!=null and a_describe!=''">
and a_describe like '%${a_describe}%'
</if>
<if test="a_id!=null and a_id!=0">
and a_id like '%${a_id}%'
</if>
</where>
ORDER BY a_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(a_id) from d_admin
<where>
<if test="a_username!=null and a_username!='' ">
and a_username like '%${a_username}%'
</if>
<if test="a_describe!=null and a_describe!=''">
and a_describe like '%${a_describe}%'
</if>
<if test="a_id!=null and a_id!=0">
and a_id like '%${a_id}%'
</if>
</where>
</select>
<!--添加管理员信息-->
<insert id="addAdmin" parameterType="Admin" keyProperty="a_id" useGeneratedKeys="true">
insert into d_admin (a_username,a_password,a_name,a_phone,a_power,a_describe)
values(#{a_username},#{a_password},#{a_name},#{a_phone},#{a_power},#{a_describe})
</insert>
<!--通过id删除管理员信息-->
<delete id="deleteAdmin" parameterType="Integer" >
delete from d_admin where a_id=#{a_id}
</delete>
<select id="findAdminById" parameterType="Integer" resultType="Admin" >
select * from d_admin where a_id=#{a_id}
</select>
<select id="getAll" resultType="Admin">
select * from d_admin;
</select>
<!--修改管理员信息-->
<update id="updateAdmin" parameterType="Admin">
update d_admin
<set>
<if test="a_username!=null and a_username !=''">
a_username=#{a_username},
</if>
<if test="a_password !=null and a_password !=''">
a_password=#{a_password},
</if>
<if test="a_name !=null and a_name !=''">
a_name=#{a_name},
</if>
<if test="a_phone !=null and a_phone !=0">
a_phone=#{a_phone},
</if>
<if test="a_power !=null and a_power !=''">
a_power=#{a_power},
</if>
<if test="a_describe!=null and a_describe!=''">
a_describe=#{a_describe},
</if>
</set>
where a_id = #{a_id}
</update>
</mapper>

@ -0,0 +1,27 @@
package com.itheima.dao;
import com.itheima.po.Class;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* DAO
*/
public interface ClassDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("c_classname") String c_classname, @Param("c_classid") Integer c_classid, @Param("c_counsellor") String c_counsellor);
//获取用户列表
public List<Class> getClassList(@Param("c_classname") String c_classname, @Param("c_classid") Integer c_classid, @Param("c_counsellor") String c_counsellor, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
public int deleteClass(Integer c_id); //删除班级信息
public int addClass(Class ucalss); //添加班级信息
public int updateClass(Class uclass); //修改班级信息
public Class findClassById(Integer c_id);
public List<Class> findClassStudent(Class uclass);//查询班级人员信息
public List<Class> getAll();
}

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.ClassDao" >
<!--分页查询-->
<select id="getClassList" parameterType="Class" resultType="Class">
select *from d_class
<where>
<if test="c_classname!=null and c_classname!='' ">
and c_classname like '%${c_classname}%'
</if>
<if test="c_counsellor!=null and c_counsellor!=''">
and c_counsellor like '%${c_counsellor}%'
</if>
<if test="c_classid!=null and c_classid!=0">
and c_classid like '%${c_classid}%'
</if>
</where>
ORDER BY c_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(c_id) from d_class
<where>
<if test="c_classname!=null and c_classname!='' ">
and c_classname like '%${c_classname}%'
</if>
<if test="c_counsellor!=null and c_counsellor!=''">
and c_counsellor like '%${c_counsellor}%'
</if>
<if test="c_classid!=null and c_classid!=0">
and c_classid like '%${c_classid}%'
</if>
</where>
</select>
<!--通过id删除班级信息-->
<delete id="deleteClass" parameterType="Integer" >
delete from d_class where c_id=#{c_id}
</delete>
<!--添加班级信息-->
<insert id="addClass" parameterType="Class" keyProperty="c_id" useGeneratedKeys="true">
insert into d_class (c_classid,c_classname,c_counsellor)
values(#{c_classid},#{c_classname},#{c_counsellor})
</insert>
<select id="findClassById" parameterType="Integer" resultType="Class" >
select * from d_class where c_id=#{c_id}
</select>
<!--修改班级信息-->
<update id="updateClass" parameterType="Class">
update d_class
<set>
<if test="c_classid!=null and c_classid!=0">
c_classid=#{c_classid},
</if>
<if test="c_classname !=null and c_classname !=''">
c_classname=#{c_classname},
</if>
<if test="c_counsellor !=null and c_counsellor !=''">
c_counsellor=#{c_counsellor},
</if>
</set>
where c_id = #{c_id}
</update>
<!--Mybatis使用Collection进行表关联查询关联一对多数据类型(class为一student为多)且需要有id-->
<!--Association关联一对一类型-->
<!--班级人员信息查询信息-->
<resultMap type="com.itheima.po.Class" id="cardAndInfo2">
<id property="c_id" column="c_id"/>
<result property="c_classid" column="c_classid"/>
<result property="c_classname" column="c_classname"/>
<result property="c_counsellor" column="c_counsellor"/>
<collection property="students" ofType="com.itheima.po.Student" javaType="ArrayList">
<id property="s_id" column="s_id"/>
<result property="s_studentid" column="s_studentid"/>
<result property="s_name" column="s_name"/>
<result property="s_sex" column="s_sex"/>
<result property="s_age" column="s_age"/>
<result property="s_phone" column="s_phone"/>
<result property="s_classid" column="s_classid"/>
<result property="s_classname" column="s_classname"/>
<result property="s_dormitoryid" column="s_dormitoryid"/>
</collection>
</resultMap>
<!--SQL选择属性与构造的resultMap属性名要一致-->
<select id="findClassStudent" parameterType="Class" resultMap="cardAndInfo2">
SELECT uclass.c_id as c_id,uclass.c_classid as c_classid,uclass.c_classname as c_classname,uclass.c_counsellor as c_counsellor,
student.s_id as s_id,student.s_studentid as s_studentid,student.s_name as s_name,student.s_sex as s_sex,student.s_age as s_age,
student.s_phone as s_phone,student.s_classid as s_classid,student.s_classname as s_classname,student.s_dormitoryid as s_dormitoryid
FROM d_class uclass join d_student student
on uclass.c_classid = student.s_classid
and uclass.c_classname = student.s_classname
where uclass.c_classid = #{c_classid}
and uclass.c_classname = #{c_classname}
</select>
<select id="getAll" resultType="Class">
select * from d_class;
</select>
</mapper>

@ -0,0 +1,29 @@
package com.itheima.dao;
import com.itheima.po.DormClean;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @program: dormitorySystem
* @description: 宿
* @author: Joyrocky
* @create: 2019-04-24 14:37
**/
public interface DormCleanDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("d_id") Integer d_id, @Param("d_dormbuilding") String d_dormbuilding);
//获取用户列表
public List<DormClean> getDormCleanList(@Param("d_id") Integer d_id, @Param("d_dormbuilding") String d_dormbuilding, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
public int addDormClean(DormClean dormclean); //添加宿舍卫生信息
public int deleteDormClean(Integer g_id); //删除宿舍卫生信息
public int updateDormClean(DormClean dormclean); //修改宿舍卫生信息
public DormClean findDormCleanById(Integer g_id);
public List<DormClean> getAll();
}

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.DormCleanDao" >
<!--分页查询-->
<select id="getDormCleanList" parameterType="DormClean" resultType="DormClean">
select *from d_dormgrade
<where>
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
ORDER BY g_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(g_id) from d_dormgrade
<where>
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
</select>
<!--添加宿舍卫生信息-->
<insert id="addDormClean" parameterType="DormClean" keyProperty="g_id" useGeneratedKeys="true">
insert into d_dormgrade (d_id,d_dormbuilding,d_grade,create_time,update_time)
values(#{d_id},#{d_dormbuilding},#{d_grade},now(),now())
</insert>
<!--通过id删除宿舍卫生信息-->
<delete id="deleteDormClean" parameterType="Integer" >
delete from d_dormgrade where g_id=#{g_id}
</delete>
<select id="findDormCleanById" parameterType="Integer" resultType="DormClean" >
select * from d_dormgrade where g_id=#{g_id}
</select>
<!--修改宿舍卫生信息-->
<update id="updateDormClean" parameterType="DormClean">
update d_dormgrade
<set>
<if test="d_id!=null and d_id!=0">
d_id=#{d_id},
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
d_dormbuilding=#{d_dormbuilding},
</if>
<if test="d_grade!=null and d_grade!=0">
d_grade=#{d_grade},
</if>
<if test="update_time != null" >
update_time = now(),
</if>
</set>
where g_id = #{g_id}
</update>
<select id="getAll" resultType="DormClean">
select * from d_dormgrade;
</select>
<!--宿舍卫生信息查询信息-->
<resultMap type="com.itheima.po.DormClean" id="cardAndInfo2">
<id property="d_id" column="d_id"/>
<result property="d_dormbuilding" column="d_dormbuilding" />
</resultMap>
</mapper>

@ -0,0 +1,31 @@
package com.itheima.dao;
import com.itheima.po.DormRepair;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-27 17:20
**/
public interface DormRepairDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("d_id") Integer d_id, @Param("d_dormbuilding") String d_dormbuilding);
//获取用户列表
public List<DormRepair> getDormRepairList(@Param("d_id") Integer d_id, @Param("d_dormbuilding") String d_dormbuilding, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
public int addDormRepair(DormRepair dormrepair); //添加宿舍信息
public int deleteDormRepair(Integer r_id); //删除宿舍信息
public int updateDormRepair(DormRepair dormrepair); //修改宿舍信息
public DormRepair findDormRepairById(Integer r_id);
public List<DormRepair> getAll();
}

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.DormRepairDao" >
<!--分页查询-->
<select id="getDormRepairList" parameterType="DormRepair" resultType="DormRepair">
select *from d_dormrepair
<where>
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
ORDER BY r_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(r_id) from d_dormrepair
<where>
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
</select>
<!--添加宿舍信息-->
<insert id="addDormRepair" parameterType="DormRepair" keyProperty="r_id" useGeneratedKeys="true">
insert into d_dormrepair (d_id,d_dormbuilding,r_name,reason,create_time,update_time)
values(#{d_id},#{d_dormbuilding},#{r_name},#{reason},now(),now())
</insert>
<!--通过id删除宿舍信息-->
<delete id="deleteDormRepair" parameterType="Integer" >
delete from d_dormrepair where r_id=#{r_id}
</delete>
<select id="findDormRepairById" parameterType="Integer" resultType="DormRepair" >
select * from d_dormrepair where r_id=#{r_id}
</select>
<select id="getAll" resultType="DormRepair">
select * from d_dormrepair;
</select>
<!--修改宿舍信息-->
<update id="updateDormRepair" parameterType="DormRepair">
update d_dormrepair
<set>
<if test="d_id!=null and d_id!=0">
d_id=#{d_id},
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
d_dormbuilding=#{d_dormbuilding},
</if>
<if test="r_name !=null and r_name !=''">
r_name=#{r_name},
</if>
<if test="reason !=null and reason !=''">
reason=#{reason},
</if>
<if test="update_time !=null ">
update_time=now(),
</if>
</set>
where r_id = #{r_id}
</update>
<!--宿舍人员信息查询信息-->
<resultMap type="com.itheima.po.DormRepair" id="cardAndInfo2">
<id property="r_id" column="r_id"/>
<result property="d_id" column="d_id" />
<result property="d_dormbuilding" column="d_dormbuilding" />
<result property="r_name" column="r_name"/>
<result property="reason" column="reason"/>
<result property="create_time" column="create_time"/>
<result property="update_time" column="update_time"/>
</resultMap>
</mapper>

@ -0,0 +1,29 @@
package com.itheima.dao;
import com.itheima.po.Dormitory;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* DAO
*/
public interface DormitoryDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("a_name") String a_name, @Param("s_dormitoryid") Integer s_dormitoryid,@Param("d_dormbuilding") String d_dormbuilding);
//获取用户列表
public List<Dormitory> getDormitoryList(@Param("a_name") String a_name, @Param("s_dormitoryid") Integer s_dormitoryid, @Param("d_dormbuilding") String d_dormbuilding, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
public int addDormitory(Dormitory dormitory); //添加宿舍信息
public int deleteDormitory(Integer d_id); //删除宿舍信息
public int updateDormitory(Dormitory dormitory); //修改宿舍信息
public Dormitory findDormitoryById(Integer d_id);
public List<Dormitory> findDormitoryStudent(Dormitory dormitory);//查询宿舍人员信息
public List<Dormitory> getAll();
}

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.DormitoryDao" >
<!--分页查询-->
<select id="getDormitoryList" parameterType="Dormitory" resultType="Dormitory">
select *from d_dormitoryinfo
<where>
<if test="a_name!=null and a_name!=''">
and a_name like '%${a_name}%'
</if>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
ORDER BY d_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(s_dormitoryid) from d_dormitoryinfo
<where>
<if test="a_name!=null and a_name!=''">
and a_name like '%${a_name}%'
</if>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
</select>
<!--添加宿舍信息-->
<insert id="addDormitory" parameterType="Dormitory" keyProperty="d_id" useGeneratedKeys="true">
insert into d_dormitoryinfo (s_dormitoryid,d_dormbuilding,d_bedtotal,d_bed,a_name)
values(#{s_dormitoryid},#{d_dormbuilding},#{d_bedtotal},#{d_bed},#{a_name})
</insert>
<!--通过id删除宿舍信息-->
<delete id="deleteDormitory" parameterType="Integer" >
delete from d_dormitoryinfo where d_id=#{d_id}
</delete>
<select id="findDormitoryById" parameterType="Integer" resultType="Dormitory" >
select * from d_dormitoryinfo where d_id=#{d_id}
</select>
<!--修改宿舍信息-->
<update id="updateDormitory" parameterType="Dormitory">
update d_dormitoryinfo
<set>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
s_dormitoryid=#{s_dormitoryid},
</if>
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
d_dormbuilding=#{d_dormbuilding},
</if>
<if test="d_bedtotal !=null and d_bedtotal !=''">
d_bedtotal=#{d_bedtotal},
</if>
<if test="d_bed !=null and d_bed !=''">
d_bed=#{d_bed},
</if>
<if test="a_name !=null and a_name !=''">
a_name=#{a_name},
</if>
</set>
where d_id = #{d_id}
</update>
<!--宿舍人员信息查询信息-->
<resultMap type="com.itheima.po.Dormitory" id="cardAndInfo2">
<id property="d_id" column="d_id"/>
<result property="s_dormitoryid" column="s_dormitoryid" />
<result property="d_dormbuilding" column="d_dormbuilding" />
<result property="d_bedtotal" column="d_bedtotal"/>
<result property="d_bed" column="d_bed"/>
<result property="a_name" column="a_name"/>
<collection property="students" ofType="com.itheima.po.Student" javaType="ArrayList">
<id property="s_id" column="s_id"/>
<result property="s_studentid" column="s_studentid"/>
<result property="s_name" column="s_name"/>
<result property="s_sex" column="s_sex"/>
<result property="s_age" column="s_age"/>
<result property="s_phone" column="s_phone"/>
<result property="s_classid" column="s_classid"/>
<result property="s_classname" column="s_classname"/>
<result property="s_dormitoryid" column="s_dormitoryid"/>
</collection>
</resultMap>
<select id="findDormitoryStudent" parameterType="Dormitory" resultMap="cardAndInfo2">
SELECT dormitoryinfos.*,students.*
FROM d_dormitoryinfo dormitoryinfos join d_student students
on dormitoryinfos.s_dormitoryid = students.s_dormitoryid
where dormitoryinfos.s_dormitoryid = #{s_dormitoryid}
</select>
<select id="getAll" resultType="Dormitory">
select * from d_dormitoryinfo;
</select>
</mapper>

@ -0,0 +1,29 @@
package com.itheima.dao;
import com.itheima.po.StudentClean;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-25 12:14
**/
public interface StudentCleanDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("s_studentid") Integer s_studentid, @Param("s_name") String s_name,@Param("s_dormitoryid") Integer s_dormitoryid);
//获取用户列表
public List<StudentClean> getStudentCleanList(@Param("s_studentid") Integer s_studentid, @Param("s_name") String s_name, @Param("s_dormitoryid") Integer s_dormitoryid, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
public int addStudentClean(StudentClean studentclean); //添加宿舍卫生信息
public int deleteStudentClean(Integer g_id); //删除宿舍卫生信息
public int updateStudentClean(StudentClean studentclean); //修改宿舍卫生信息
public StudentClean findStudentCleanById(Integer g_id);
public List<StudentClean> getAll();
}

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.StudentCleanDao" >
<!--分页查询-->
<select id="getStudentCleanList" parameterType="StudentClean" resultType="StudentClean">
select *from d_stgrade
<where>
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
</if>
<if test="s_name !=null and s_name !=''">
and s_name like '%${s_name}%'
</if>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
</where>
ORDER BY g_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(g_id) from d_stgrade
<where>
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
</if>
<if test="s_name !=null and s_name !=''">
and s_name like '%${s_name}%'
</if>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
</where>
</select>
<!--添加宿舍卫生信息-->
<insert id="addStudentClean" parameterType="StudentClean" keyProperty="g_id" useGeneratedKeys="true">
insert into d_stgrade (s_studentid,s_name,s_grade,s_classid,s_dormitoryid,create_time,update_time)
values(#{s_studentid},#{s_name},#{s_grade},#{s_classid},#{s_dormitoryid},now(),now())
</insert>
<!--通过id删除宿舍卫生信息-->
<delete id="deleteStudentClean" parameterType="Integer" >
delete from d_stgrade where g_id=#{g_id}
</delete>
<select id="findStudentCleanById" parameterType="Integer" resultType="StudentClean" >
select * from d_stgrade where g_id=#{g_id}
</select>
<select id="getAll" resultType="StudentClean">
select * from d_stgrade;
</select>
<!--修改宿舍卫生信息-->
<update id="updateStudentClean" parameterType="StudentClean">
update d_stgrade
<set>
<if test="s_studentid!=null and s_studentid!=0">
s_studentid=#{s_studentid},
</if>
<if test="s_name !=null and s_name !=''">
s_name=#{s_name},
</if>
<if test="s_grade!=null and s_grade!=0">
s_grade=#{s_grade},
</if>
<if test="s_classid!=null and s_classid!=0">
s_classid=#{s_classid},
</if>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
s_dormitoryid=#{s_dormitoryid},
</if>
<if test="update_time != null" >
update_time = now(),
</if>
</set>
where g_id = #{g_id}
</update>
<!--宿舍卫生信息查询信息-->
<resultMap type="com.itheima.po.StudentClean" id="cardAndInfo2">
<id property="g_id" column="g_id"/>
<result property="s_studentid" column="s_studentid" />
<result property="s_name" column="s_name" />
<result property="s_grade" column="s_grade" />
<result property="s_classid" column="s_classid" />
<result property="s_dormitoryid" column="s_dormitoryid" />
</resultMap>
</mapper>

@ -0,0 +1,28 @@
package com.itheima.dao;
import com.itheima.po.Student;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* DAO
*/
public interface StudentDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("s_name") String s_name, @Param("s_studentid")Integer s_studentid,
@Param("s_classid")Integer s_classid,@Param("s_classname")String s_classname);
//获取用户列表
public List<Student> getStudentList(@Param("s_name") String s_name, @Param("s_studentid")Integer s_studentid,@Param("s_classid")Integer s_classid,
@Param("s_classname")String s_classname, @Param("currentPage")Integer currentPage, @Param("pageSize")Integer pageSize);
public int deleteStudent(Integer s_id); //删除学生信息
public int addStudent(Student student); //添加学生信息
public int updateStudent(Student student); //修改学生信息
public Student findStudentById(Integer s_id);
public List<Student> getAll();
}

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.StudentDao" >
<!--分页查询-->
<select id="getStudentList" parameterType="Student" resultType="Student">
select *from d_student
<where>
<if test="s_name!=null and s_name!='' ">
and s_name like '%${s_name}%'
</if>
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
</if>
<if test="s_classid!=null and s_classid!=0">
and s_classid like '%${s_classid}%'
</if>
<if test="s_classname!=null and s_classname!='' ">
and s_classname like '%${s_classname}%'
</if>
</where>
ORDER BY s_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(s_studentid) from d_student
<where>
<if test="s_name!=null and s_name!='' ">
and s_name like '%${s_name}%'
</if>
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
</if>
<if test="s_classid!=null and s_classid!=0">
and s_classid like '%${s_classid}%'
</if>
<if test="s_classname!=null and s_classname!='' ">
and s_classname like '%${s_classname}%'
</if>
</where>
</select>
<!--通过id删除学生信息-->
<delete id="deleteStudent" parameterType="Integer" >
delete from d_student where s_id=#{s_id}
</delete>
<!--添加学生信息-->
<insert id="addStudent" parameterType="Student" keyProperty="s_id" useGeneratedKeys="true">
insert into d_student (s_studentid,s_name,s_sex,s_age,s_phone,s_classid,s_classname,s_dormitoryid)
values(#{s_studentid},#{s_name},#{s_sex},#{s_age},#{s_phone},#{s_classid},#{s_classname},#{s_dormitoryid})
</insert>
<select id="findStudentById" parameterType="Integer" resultType="Student" >
select * from d_student where s_id=#{s_id}
</select>
<!--修改学生信息-->
<update id="updateStudent" parameterType="Student">
update d_student
<set>
<if test="s_studentid!=null and s_studentid!=0">
s_studentid=#{s_studentid},
</if>
<if test="s_name !=null and s_name !=''">
s_name=#{s_name},
</if>
<if test="s_sex !=null and s_sex !=''">
s_sex=#{s_sex},
</if>
<if test="s_age !=null and s_age !=0">
s_age=#{s_age},
</if>
<if test="s_phone !=null and s_phone !=0">
s_phone=#{s_phone},
</if>
<if test="s_classid!=null and s_classid!=0">
s_classid=#{s_classid},
</if>
<if test="s_classname !=null and s_classname !=''">
s_classname=#{s_classname},
</if>
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
s_dormitoryid=#{s_dormitoryid},
</if>
</set>
where s_id = #{s_id}
</update>
<select id="getAll" resultType="Student">
select * from d_student;
</select>
</mapper>

@ -0,0 +1,27 @@
package com.itheima.dao;
import com.itheima.po.Visitor;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @program: dormitorySystem
* @description: 访
* @author: Joyrocky
* @create: 2019-05-14 12:57
**/
public interface VisitorDao {
/**
*
*/
//获取总条数
public Integer totalCount(@Param("v_name") String v_name, @Param("v_phone")Integer v_phone);
//获取用户列表
public List<Visitor> getVisitorList(@Param("v_name") String v_name, @Param("v_phone")Integer v_phone,@Param("currentPage")Integer currentPage, @Param("pageSize")Integer pageSize);
public int addVisitor(Visitor visitor); //添加学生信息
public List<Visitor> getAll();
}

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.itheima.dao.VisitorDao" >
<!--分页查询-->
<select id="getVisitorList" parameterType="Visitor" resultType="Visitor">
select * from d_visitor
<where>
<if test="v_name!=null and v_name!='' ">
and v_name like '%${v_name}%'
</if>
<if test="v_phone!=null and v_phone!=0">
and v_phone like '%${v_phone}%'
</if>
</where>
ORDER BY v_id asc
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
select count(v_id) from d_visitor
<where>
<if test="v_name!=null and v_name!='' ">
and v_name like '%${v_name}%'
</if>
<if test="v_phone!=null and v_phone!=0">
and v_phone like '%${v_phone}%'
</if>
</where>
</select>
<!--添加学生信息-->
<insert id="addVisitor" parameterType="Visitor" keyProperty="v_id" useGeneratedKeys="true">
insert into d_visitor (v_name,v_phone,v_dormitoryid,v_dormbuilding,create_time)
values(#{v_name},#{v_phone},#{v_dormitoryid},#{v_dormbuilding},now())
</insert>
<select id="getAll" resultType="Visitor">
select * from d_visitor;
</select>
</mapper>

@ -0,0 +1,47 @@
package com.itheima.interceptor;
import com.itheima.po.Admin;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
*/
public class Loginlnterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
// 获取请求的URL
String url = request.getRequestURI();
// URL:除了login.jsp是可以公开访问的其它的URL都进行拦截控制
if(url.indexOf("/login")>=0){
return true;
}
// 获取Session
HttpSession session = request.getSession();
Admin admin = (Admin) session.getAttribute("admin");
// 判断Session中是否有用户数据如果有则返回true,继续向下执行
if(admin != null){
return true;
}
// 不符合条件的给出提示信息,并转发到主页面
request.setAttribute("msga", "您还没有登录,请先登录!");
request.getRequestDispatcher("/shopping homepage.jsp")
.forward(request, response);
return false;
}
@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex)
throws Exception {
}
}

@ -0,0 +1,75 @@
package com.itheima.po;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class Admin {
private Integer a_id;
private String a_username;
@JsonIgnore
private String a_password;
private String a_name;
private Integer a_phone;
@JsonIgnore
private Integer a_power;
private String a_describe;
public Integer getA_id() {
return a_id;
}
public void setA_id(Integer a_id) {
this.a_id = a_id;
}
public String getA_username() {
return a_username;
}
public void setA_username(String a_username) {
this.a_username = a_username;
}
public String getA_password() {
return a_password;
}
public void setA_password(String a_password) {
this.a_password = a_password;
}
public String getA_name() {
return a_name;
}
public void setA_name(String a_name) {
this.a_name = a_name;
}
public Integer getA_phone() {
return a_phone;
}
public void setA_phone(Integer a_phone) {
this.a_phone = a_phone;
}
public Integer getA_power() {
return a_power;
}
public void setA_power(Integer a_power) {
this.a_power = a_power;
}
public String getA_describe() {
return a_describe;
}
public void setA_describe(String a_describe) {
this.a_describe = a_describe;
}
}

@ -0,0 +1,52 @@
package com.itheima.po;
import java.util.List;
public class Class {
private Integer c_id;
private Integer c_classid;
private String c_classname;
private String c_counsellor;
//班级与学生为一对多关系,使用链表
private List<Student> students;
public Integer getC_id() {
return c_id;
}
public void setC_id(Integer c_id) {
this.c_id = c_id;
}
public Integer getC_classid() {
return c_classid;
}
public void setC_classid(Integer c_classid) {
this.c_classid = c_classid;
}
public String getC_classname() {
return c_classname;
}
public void setC_classname(String c_classname) {
this.c_classname = c_classname;
}
public String getC_counsellor() {
return c_counsellor;
}
public void setC_counsellor(String c_counsellor) {
this.c_counsellor = c_counsellor;
}
public List<Student> getStudents() {
return students;
}
public void setStudents(List<Student> students) {
this.students = students;
}
}

@ -0,0 +1,72 @@
package com.itheima.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* @program: dormitorySystem
* @description: 宿
* @author: Joyrocky
* @create: 2019-04-24 11:21
**/
public class DormClean {
private Integer g_id;
private Integer d_id;
private String d_dormbuilding;
private Integer d_grade;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date create_time;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date update_time;
public Integer getG_id() {
return g_id;
}
public void setG_id(Integer g_id) {
this.g_id = g_id;
}
public Integer getD_id() {
return d_id;
}
public void setD_id(Integer d_id) {
this.d_id = d_id;
}
public String getD_dormbuilding() {
return d_dormbuilding;
}
public void setD_dormbuilding(String d_dormbuilding) {
this.d_dormbuilding = d_dormbuilding;
}
public Integer getD_grade() {
return d_grade;
}
public void setD_grade(Integer d_grade) {
this.d_grade = d_grade;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getUpdate_time() {
return update_time;
}
public void setUpdate_time(Date update_time) {
this.update_time = update_time;
}
}

@ -0,0 +1,81 @@
package com.itheima.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-28 00:23
**/
public class DormRepair {
private int r_id;
private int d_id;
private int d_dormbuilding;
private String r_name;
private String reason;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date create_time;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date update_time;
public int getR_id() {
return r_id;
}
public void setR_id(int r_id) {
this.r_id = r_id;
}
public int getD_id() {
return d_id;
}
public void setD_id(int d_id) {
this.d_id = d_id;
}
public int getD_dormbuilding() {
return d_dormbuilding;
}
public void setD_dormbuilding(int d_dormbuilding) {
this.d_dormbuilding = d_dormbuilding;
}
public String getR_name() {
return r_name;
}
public void setR_name(String r_name) {
this.r_name = r_name;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getUpdate_time() {
return update_time;
}
public void setUpdate_time(Date update_time) {
this.update_time = update_time;
}
}

@ -0,0 +1,72 @@
package com.itheima.po;
import java.io.Serializable;
import java.util.List;
public class Dormitory implements Serializable {
private static final long serialVersionUID = 1L;
private Integer d_id;
private Integer s_dormitoryid;
private String d_dormbuilding;
private String d_bedtotal;
private String d_bed;
private String a_name;
private List<Student> students;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getD_id() {
return d_id;
}
public void setD_id(Integer d_id) {
this.d_id = d_id;
}
public Integer getS_dormitoryid() {
return s_dormitoryid;
}
public void setS_dormitoryid(Integer s_dormitoryid) {
this.s_dormitoryid = s_dormitoryid;
}
public String getD_dormbuilding() {return d_dormbuilding;}
public void setD_dormbuilding(String d_dormbuilding) {this.d_dormbuilding = d_dormbuilding;}
public String getD_bedtotal() {
return d_bedtotal;
}
public void setD_bedtotal(String d_bedtotal) {
this.d_bedtotal = d_bedtotal;
}
public String getD_bed() {
return d_bed;
}
public void setD_bed(String d_bed) {
this.d_bed = d_bed;
}
public String getA_name() {
return a_name;
}
public void setA_name(String a_name) {
this.a_name = a_name;
}
public List<Student> getStudents() {
return students;
}
public void setStudents(List<Student> students) {
this.students = students;
}
}

@ -0,0 +1,66 @@
package com.itheima.po;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class PageInfo<T> implements Serializable {
private Integer pageIndex =1;//页码
private Integer pageSize =3;//显示条数
private Integer totalCount =0; //总条数
private Integer pageTotalCount =0; //总页数
//每页显示的数据集合
private List<T> list = new ArrayList<T>();
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
if (pageIndex==null || pageIndex<1){
this.pageIndex =1;
}
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
if (pageSize ==null || pageSize<1){
this.pageSize =3;
}
}
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
//获取总页数
public Integer getPageTotalCount() {
this.pageTotalCount = totalCount/pageSize;
if(totalCount%pageSize!=0){
this.pageTotalCount ++;
}
return pageTotalCount;
}
public void setPageTotalCount(Integer pageTotalCount) {
this.pageTotalCount = pageTotalCount;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
}

@ -0,0 +1,91 @@
package com.itheima.po;
public class Student {
private static final long serialVersionUID = 1L;
private Integer s_id;
private Integer s_studentid;
private String s_name;
private String s_sex;
private Integer s_age;
private Integer s_phone;
private Integer s_classid;
private String s_classname;
private Integer s_dormitoryid;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getS_id() {
return s_id;
}
public void setS_id(Integer s_id) {
this.s_id = s_id;
}
public Integer getS_studentid() {
return s_studentid;
}
public void setS_studentid(Integer s_studentid) {
this.s_studentid = s_studentid;
}
public String getS_name() {
return s_name;
}
public void setS_name(String s_name) {
this.s_name = s_name;
}
public String getS_sex() {
return s_sex;
}
public void setS_sex(String s_sex) {
this.s_sex = s_sex;
}
public Integer getS_age() {
return s_age;
}
public void setS_age(Integer s_age) {
this.s_age = s_age;
}
public Integer getS_phone() {
return s_phone;
}
public void setS_phone(Integer s_phone) {
this.s_phone = s_phone;
}
public Integer getS_classid() {
return s_classid;
}
public void setS_classid(Integer s_classid) {
this.s_classid = s_classid;
}
public String getS_classname() {
return s_classname;
}
public void setS_classname(String s_classname) {
this.s_classname = s_classname;
}
public Integer getS_dormitoryid() {
return s_dormitoryid;
}
public void setS_dormitoryid(Integer s_dormitoryid) {
this.s_dormitoryid = s_dormitoryid;
}
}

@ -0,0 +1,90 @@
package com.itheima.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-25 12:12
**/
public class StudentClean {
private Integer g_id;
private Integer s_studentid;
private String s_name;
private Integer s_grade;
private Integer s_classid;
private Integer s_dormitoryid;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date create_time;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date update_time;
public Integer getG_id() {
return g_id;
}
public void setG_id(Integer g_id) {
this.g_id = g_id;
}
public Integer getS_studentid() {
return s_studentid;
}
public void setS_studentid(Integer s_studentid) {
this.s_studentid = s_studentid;
}
public String getS_name() {
return s_name;
}
public void setS_name(String s_name) {
this.s_name = s_name;
}
public Integer getS_grade() {
return s_grade;
}
public void setS_grade(Integer s_grade) {
this.s_grade = s_grade;
}
public Integer getS_classid() {
return s_classid;
}
public void setS_classid(Integer s_classid) {
this.s_classid = s_classid;
}
public Integer getS_dormitoryid() {
return s_dormitoryid;
}
public void setS_dormitoryid(Integer s_dormtoryid) {
this.s_dormitoryid = s_dormtoryid;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getUpdate_time() {
return update_time;
}
public void setUpdate_time(Date update_time) {
this.update_time = update_time;
}
}

@ -0,0 +1,71 @@
package com.itheima.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* @program: dormitorySystem
* @description: 访
* @author: Joyrocky
* @create: 2019-05-14 00:37
**/
public class Visitor {
private Integer v_id;
private String v_name;
private Integer v_phone;
private Integer v_dormitoryid;
private String v_dormbuilding;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date create_time;
public Integer getV_id() {
return v_id;
}
public void setV_id(Integer v_id) {
this.v_id = v_id;
}
public String getV_name() {
return v_name;
}
public void setV_name(String v_name) {
this.v_name = v_name;
}
public Integer getV_phone() {
return v_phone;
}
public void setV_phone(Integer v_phone) {
this.v_phone = v_phone;
}
public Integer getV_dormitoryid() {
return v_dormitoryid;
}
public void setV_dormitoryid(Integer v_dormitoryid) {
this.v_dormitoryid = v_dormitoryid;
}
public String getV_dormbuilding() {
return v_dormbuilding;
}
public void setV_dormbuilding(String v_dormbuilding) {
this.v_dormbuilding = v_dormbuilding;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
}

@ -0,0 +1,25 @@
package com.itheima.service;
import com.itheima.po.Admin;
import com.itheima.po.PageInfo;
import java.util.List;
/**
* Service
*/
public interface AdminService {
// 通过账号和密码查询用户
public Admin findAdmin(Admin admin);
//找到所有所有数据
public List<Admin> getAll();
//分页查询
public PageInfo<Admin> findPageInfo(String a_username, String a_describe,Integer a_id, Integer pageIndex, Integer pageSize);
public int addAdmin(Admin admin); //添加管理员信息
public int deleteAdmin(Integer a_id); //删除管理员信息
public int updateAdmin(Admin admin); //修改管理员信息
public Admin findAdminById(Integer a_id);
}

@ -0,0 +1,21 @@
package com.itheima.service;
import com.itheima.po.Class;
import com.itheima.po.PageInfo;
import java.util.List;
/**
* Service
*/
public interface ClassService {
//分页查询
public PageInfo<Class> findPageInfo(String c_classname, String c_counsellor, Integer c_classid, Integer pageIndex, Integer pageSize);
public int deleteClass(Integer c_id); //删除班级信息
public int addClass(Class ucalss); //添加班级信息
public Class findClassById(Integer c_id);
public int updateClass(Class uclass); //修改班级信息
public List<Class> findClassStudent(Class uclass);//查询班级人员信息
public List<Class> getAll();
}

@ -0,0 +1,23 @@
package com.itheima.service;
import com.itheima.po.DormClean;
import com.itheima.po.PageInfo;
import java.util.List;
/**
* @program: dormitorySystem
* @description: 宿
* @author: Joyrocky
* @create: 2019-04-24 15:18
**/
public interface DormCleanService {
//分页查询
public PageInfo<DormClean> findPageInfo(Integer d_id, String d_dormbuilding, Integer pageIndex, Integer pageSize);
public int addDormClean(DormClean dormclean); //添加宿舍信息
public int deleteDormClean(Integer g_id); //删除宿舍信息
public int updateDormClean(DormClean dormclean); //修改宿舍信息
public DormClean findDormCleanById(Integer g_id);
public List<DormClean> getAll();
}

@ -0,0 +1,24 @@
package com.itheima.service;
import com.itheima.po.DormRepair;
import com.itheima.po.PageInfo;
import java.util.List;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-28 00:25
**/
public interface DormRepairService {
//分页查询
public PageInfo<DormRepair> findPageInfo(Integer d_id, String d_dormbuilding, Integer pageIndex, Integer pageSize);
public int addDormRepair(DormRepair dormrepair); //添加宿舍信息
public int deleteDormRepair(Integer r_id); //删除宿舍信息
public int updateDormRepair(DormRepair dormrepair); //修改宿舍信息
public DormRepair findDormRepairById(Integer r_id);
public List<DormRepair> getAll();
}

@ -0,0 +1,24 @@
package com.itheima.service;
import com.itheima.po.Dormitory;
import com.itheima.po.PageInfo;
import java.util.List;
/**
* Service
*/
public interface DormitoryService {
//分页查询
public PageInfo<Dormitory> findPageInfo(String a_name, Integer s_dormitoryid,String d_dormbuilding, Integer pageIndex, Integer pageSize);
public int addDormitory(Dormitory dormitory); //添加宿舍信息
public int deleteDormitory(Integer d_id); //删除宿舍信息
public int updateDormitory(Dormitory dormitory); //修改宿舍信息
public Dormitory findDormitoryById(Integer d_id);
public List<Dormitory> findDormitoryStudent(Dormitory dormitory);//查询宿舍人员信息
public List<Dormitory> getAll();
}

@ -0,0 +1,23 @@
package com.itheima.service;
import com.itheima.po.PageInfo;
import com.itheima.po.StudentClean;
import java.util.List;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-25 12:15
**/
public interface StudentCleanService {
//分页查询
public PageInfo<StudentClean> findPageInfo(Integer s_studentid, String s_name, Integer s_dormitoryid, Integer pageIndex, Integer pageSize);
public int addStudentClean(StudentClean studentclean); //添加宿舍信息
public int deleteStudentClean(Integer g_id); //删除宿舍信息
public int updateStudentClean(StudentClean studentclean); //修改宿舍信息
public StudentClean findStudentCleanById(Integer g_id);
public List<StudentClean> getAll();
}

@ -0,0 +1,23 @@
package com.itheima.service;
import com.itheima.po.PageInfo;
import com.itheima.po.Student;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Service
*/
public interface StudentService {
//分页查询
public PageInfo<Student> findPageInfo(String s_name,Integer s_studentid,Integer s_classid,
String s_classname, Integer pageIndex, Integer pageSize);
public int deleteStudent(Integer s_id); //通过id删除学生信息
public int addStudent(Student student); //添加学生信息
public int updateStudent(Student student); //修改学生信息
public Student findStudentById(Integer s_id);
public List<Student> getAll();
}

@ -0,0 +1,20 @@
package com.itheima.service;
import com.itheima.po.PageInfo;
import com.itheima.po.Visitor;
import org.springframework.ui.Model;
import java.util.List;
/**
* @program: dormitorySystem
* @description: 访
* @author: Joyrocky
* @create: 2019-05-14 12:39
**/
public interface VisitorService {
//分页查询
public PageInfo<Visitor> findPageInfo(String v_name, Integer v_phone , Integer pageIndex, Integer pageSize);
public int addVisitor(Visitor visitor); //添加访客信息
public List<Visitor> getAll();
}

@ -0,0 +1,79 @@
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;
}
}

@ -0,0 +1,79 @@
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;
}
}

@ -0,0 +1,77 @@
package com.itheima.service.impl;
import com.itheima.dao.DormCleanDao;
import com.itheima.po.DormClean;
import com.itheima.po.PageInfo;
import com.itheima.service.DormCleanService;
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-04-24 15:19
**/
@Service("dormCleanService")
@Transactional
public class DormCleanServiceImpl implements DormCleanService {
// classDao
@Autowired
private DormCleanDao dormCleanDao;
//分页查询
@Override
public PageInfo<DormClean> findPageInfo(Integer d_id, String d_dormbuilding, Integer pageIndex, Integer pageSize) {
PageInfo<DormClean> pi = new PageInfo<DormClean>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = dormCleanDao.totalCount(d_id,d_dormbuilding);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示宿舍信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<DormClean> dormCleanList = dormCleanDao.getDormCleanList(d_id,d_dormbuilding,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(dormCleanList);
}
return pi;
}
@Override
public List<DormClean> getAll(){
List<DormClean> dormCleanList = dormCleanDao.getAll();
return dormCleanList;
}
//添加宿舍卫生信息
@Override
public int addDormClean(DormClean dormclean) {
return dormCleanDao.addDormClean(dormclean);
}
//通过id删除宿舍卫生信息
@Override
public int deleteDormClean(Integer g_id) {
return dormCleanDao.deleteDormClean(g_id);
}
//修改宿舍卫生信息
@Override
public int updateDormClean(DormClean dormclean) {
return dormCleanDao.updateDormClean(dormclean);
}
@Override
public DormClean findDormCleanById (Integer g_id){
DormClean d = dormCleanDao.findDormCleanById(g_id);
return d;
}
}

@ -0,0 +1,77 @@
package com.itheima.service.impl;
import com.itheima.dao.DormRepairDao;
import com.itheima.po.DormRepair;
import com.itheima.po.PageInfo;
import com.itheima.service.DormRepairService;
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-04-28 00:24
**/
@Service("dormRepairService")
@Transactional
public class DormRepairServiceImpl implements DormRepairService {
// classDao
@Autowired
private DormRepairDao dormRepairDao;
//分页查询
@Override
public PageInfo<DormRepair> findPageInfo(Integer d_id, String d_dormbuilding, Integer pageIndex, Integer pageSize) {
PageInfo<DormRepair> pi = new PageInfo<DormRepair>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = dormRepairDao.totalCount(d_id,d_dormbuilding);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示宿舍信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<DormRepair> dormRepairList = dormRepairDao.getDormRepairList(d_id,d_dormbuilding,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(dormRepairList);
}
return pi;
}
@Override
public List<DormRepair> getAll(){
List<DormRepair> dormRepairList = dormRepairDao.getAll();
return dormRepairList;
}
//添加宿舍信息
@Override
public int addDormRepair(DormRepair dormrepair) {
return dormRepairDao.addDormRepair(dormrepair);
}
//通过id删除宿舍信息
@Override
public int deleteDormRepair(Integer r_id) {
return dormRepairDao.deleteDormRepair(r_id);
}
//修改宿舍信息
@Override
public int updateDormRepair(DormRepair dormrepair) {
return dormRepairDao.updateDormRepair(dormrepair);
}
@Override
public DormRepair findDormRepairById (Integer r_id){
DormRepair d = dormRepairDao.findDormRepairById(r_id);
return d;
}
}

@ -0,0 +1,82 @@
package com.itheima.service.impl;
import com.itheima.dao.DormitoryDao;
import com.itheima.po.Dormitory;
import com.itheima.po.PageInfo;
import com.itheima.service.DormitoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Service
*/
@Service("dormitoryService")
@Transactional
public class DormitoryServiceImpl implements DormitoryService {
// classDao
@Autowired
private DormitoryDao dormitoryDao;
//分页查询
@Override
public PageInfo<Dormitory> findPageInfo(String a_name, Integer s_dormitoryid,String d_dormbuilding, Integer pageIndex, Integer pageSize) {
PageInfo<Dormitory> pi = new PageInfo<Dormitory>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = dormitoryDao.totalCount(a_name,s_dormitoryid,d_dormbuilding);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示宿舍信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<Dormitory> dormitoryList = dormitoryDao.getDormitoryList(a_name,s_dormitoryid,d_dormbuilding,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(dormitoryList);
}
return pi;
}
@Override
public List<Dormitory> getAll(){
List<Dormitory> dormitoryList = dormitoryDao.getAll();
return dormitoryList;
}
//添加宿舍信息
@Override
public int addDormitory(Dormitory dormitory) {
return dormitoryDao.addDormitory(dormitory);
}
//通过id删除宿舍信息
@Override
public int deleteDormitory(Integer d_id) {
return dormitoryDao.deleteDormitory(d_id);
}
//修改宿舍信息
@Override
public int updateDormitory(Dormitory dormitory) {
return dormitoryDao.updateDormitory(dormitory);
}
@Override
public Dormitory findDormitoryById (Integer d_id){
Dormitory d = dormitoryDao.findDormitoryById(d_id);
return d;
}
//查询宿舍人员信息
@Override
public List<Dormitory> findDormitoryStudent(Dormitory dormitory) {
List<Dormitory> d = dormitoryDao.findDormitoryStudent(dormitory);
return d;
}
}

@ -0,0 +1,77 @@
package com.itheima.service.impl;
import com.itheima.dao.StudentCleanDao;
import com.itheima.po.PageInfo;
import com.itheima.po.StudentClean;
import com.itheima.service.StudentCleanService;
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-04-25 12:16
**/
@Service("studentCleanService")
@Transactional
public class StudentCleanServiceImpl implements StudentCleanService {
// classDao
@Autowired
private StudentCleanDao studentCleanDao;
//分页查询
@Override
public PageInfo<StudentClean> findPageInfo(Integer s_studentid, String s_name, Integer s_dormitoryid, Integer pageIndex, Integer pageSize) {
PageInfo<StudentClean> pi = new PageInfo<StudentClean>();
pi.setPageIndex(pageIndex);
pi.setPageSize(pageSize);
//获取总条数
Integer totalCount = studentCleanDao.totalCount(s_studentid,s_name,s_dormitoryid);
if (totalCount>0){
pi.setTotalCount(totalCount);
//每一页显示宿舍信息数
//currentPage = (pageIndex-1)*pageSize 当前页码数减1*最大条数=开始行数
List<StudentClean> studentCleanList = studentCleanDao.getStudentCleanList(s_studentid,s_name,s_dormitoryid,
(pi.getPageIndex()-1)*pi.getPageSize(),pi.getPageSize());
pi.setList(studentCleanList);
}
return pi;
}
@Override
public List<StudentClean> getAll(){
List<StudentClean> studentCleanList = studentCleanDao.getAll();
return studentCleanList;
}
//添加宿舍卫生信息
@Override
public int addStudentClean(StudentClean studentclean) {
return studentCleanDao.addStudentClean(studentclean);
}
//通过id删除宿舍卫生信息
@Override
public int deleteStudentClean(Integer g_id) {
return studentCleanDao.deleteStudentClean(g_id);
}
//修改宿舍卫生信息
@Override
public int updateStudentClean(StudentClean studentclean) {
return studentCleanDao.updateStudentClean(studentclean);
}
@Override
public StudentClean findStudentCleanById (Integer g_id){
StudentClean d = studentCleanDao.findStudentCleanById(g_id);
return d;
}
}

@ -0,0 +1,72 @@
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;
}
}

@ -0,0 +1,58 @@
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);
}
}

@ -0,0 +1,65 @@
package com.itheima.util;
import java.security.MessageDigest;
/**
* @program: Student_dorm_System
* @description: MD5
* @author: Joyrocky
* @create: 2019-04-13 13:04
**/
public class MD5Util {
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++)
resultSb.append(byteToHexString(b[i]));
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n += 256;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
/**
* MD5
*
* @param origin
* @param charsetname
* @return
*/
private static String MD5Encode(String origin, String charsetname) {
String resultString = null;
try {
resultString = new String(origin);
MessageDigest md = MessageDigest.getInstance("MD5");
if (charsetname == null || "".equals(charsetname))
resultString = byteArrayToHexString(md.digest(resultString.getBytes()));
else
resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname)));
} catch (Exception exception) {
}
return resultString.toUpperCase();
}
public static String MD5EncodeUtf8(String origin) {
//盐值Salt加密
//origin = origin + PropertiesUtil.getProperty("password.salt", "");
return MD5Encode(origin, "utf-8");
}
private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
}

@ -0,0 +1,52 @@
package com.itheima.util;
/**
* @program: dormitorySystem
* @description:
* @author: Joyrocky
* @create: 2019-04-28 23:10
**/
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
public class PropertiesUtil {
private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);
private static Properties props;
static {
String fileName = "mmall.properties";
props = new Properties();
try {
props.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName),"UTF-8"));
} catch (IOException e) {
logger.error("配置文件读取异常",e);
}
}
public static String getProperty(String key){
String value = props.getProperty(key.trim());
if(StringUtils.isBlank(value)){
return null;
}
return value.trim();
}
public static String getProperty(String key,String defaultValue){
String value = props.getProperty(key.trim());
if(StringUtils.isBlank(value)){
value = defaultValue;
}
return value.trim();
}
}

@ -0,0 +1,7 @@
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/dormitory?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=zxk5211314
jdbc.maxTotal=30
jdbc.maxIdle=10
jdbc.initialSize=5

@ -0,0 +1,8 @@
# Global logging configuration
log4j.rootLogger=ERROR, stdout
# MyBatis logging configuration...
log4j.logger.com.itheima=DEBUG
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 别名定义 -->
<typeAliases>
<package name="com.itheima.po" />
</typeAliases>
</configuration>

@ -0,0 +1,31 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!-- 配置包扫描器,扫描@Controller注解的类 -->
<context:component-scan base-package="com.itheima.controller" />
<!-- 加载注解驱动 -->
<mvc:annotation-driven />
<!--配置静态资源的访问映射,此配置中的文件,将不被前端控制器拦截 -->
<mvc:resources location="/js/" mapping="/js/**"/>
<mvc:resources location="/css/" mapping="/css/**"/>
<mvc:resources location="/fonts/" mapping="/fonts/**"/>
<mvc:resources location="/images/" mapping="/images/**"/>
<mvc:resources location="/lib/" mapping="/lib/**"/>
<mvc:resources location="/layui_exts/" mapping="/layui_exts/**"/>
<!-- 配置视图解析器 -->
<bean class=
"org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Loading…
Cancel
Save