Compare commits
164 Commits
@ -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,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,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,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,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,57 @@
|
||||
package cn.edu.hactcm.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
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,46 @@
|
||||
package cn.edu.hactcm.util;
|
||||
|
||||
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,22 @@
|
||||
package cn.edu.hactcm.service;
|
||||
import cn.edu.hactcm.po.Admin;
|
||||
import cn.edu.hactcm.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 cn.edu.hactcm.service;
|
||||
import cn.edu.hactcm.po.Class;
|
||||
import cn.edu.hactcm.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,17 @@
|
||||
package cn.edu.hactcm.service;
|
||||
|
||||
import cn.edu.hactcm.po.DormClean;
|
||||
import cn.edu.hactcm.po.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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,18 @@
|
||||
package cn.edu.hactcm.service;
|
||||
|
||||
import cn.edu.hactcm.po.DormRepair;
|
||||
import cn.edu.hactcm.po.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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 cn.edu.hactcm.service;
|
||||
|
||||
import cn.edu.hactcm.po.Dormitory;
|
||||
import cn.edu.hactcm.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,17 @@
|
||||
package cn.edu.hactcm.service;
|
||||
|
||||
import cn.edu.hactcm.po.PageInfo;
|
||||
import cn.edu.hactcm.po.StudentClean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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,22 @@
|
||||
package cn.edu.hactcm.service;
|
||||
import cn.edu.hactcm.po.PageInfo;
|
||||
import cn.edu.hactcm.po.Student;
|
||||
|
||||
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,13 @@
|
||||
package cn.edu.hactcm.service;
|
||||
|
||||
import cn.edu.hactcm.po.PageInfo;
|
||||
import cn.edu.hactcm.po.Visitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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,57 @@
|
||||
package cn.edu.hactcm.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
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,46 @@
|
||||
package cn.edu.hactcm.util;
|
||||
|
||||
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,187 @@
|
||||
/** layui-v2.4.5 MIT License By https://www.layui.com */
|
||||
;!function (e) {
|
||||
"use strict";
|
||||
var t = document, o = {modules: {}, status: {}, timeout: 10, event: {}}, n = function () {
|
||||
this.v = "2.4.5"
|
||||
}, r = function () {
|
||||
var e = t.currentScript ? t.currentScript.src : function () {
|
||||
for (var e, o = t.scripts, n = o.length - 1, r = n; r > 0; r--) if ("interactive" === o[r].readyState) {
|
||||
e = o[r].src;
|
||||
break
|
||||
}
|
||||
return e || o[n].src
|
||||
}();
|
||||
return e.substring(0, e.lastIndexOf("/") + 1)
|
||||
}(), i = function (t) {
|
||||
e.console && console.error && console.error("Layui hint: " + t)
|
||||
}, a = "undefined" != typeof opera && "[object Opera]" === opera.toString(), u = {
|
||||
layer: "modules/layer",
|
||||
laydate: "modules/laydate",
|
||||
laypage: "modules/laypage",
|
||||
laytpl: "modules/laytpl",
|
||||
layim: "modules/layim",
|
||||
layedit: "modules/layedit",
|
||||
form: "modules/form",
|
||||
upload: "modules/upload",
|
||||
tree: "modules/tree",
|
||||
table: "modules/table",
|
||||
element: "modules/element",
|
||||
rate: "modules/rate",
|
||||
colorpicker: "modules/colorpicker",
|
||||
slider: "modules/slider",
|
||||
carousel: "modules/carousel",
|
||||
flow: "modules/flow",
|
||||
util: "modules/util",
|
||||
code: "modules/code",
|
||||
jquery: "modules/jquery",
|
||||
mobile: "modules/mobile",
|
||||
"layui.all": "../layui.all"
|
||||
};
|
||||
n.prototype.cache = o, n.prototype.define = function (e, t) {
|
||||
var n = this, r = "function" == typeof e, i = function () {
|
||||
var e = function (e, t) {
|
||||
layui[e] = t, o.status[e] = !0
|
||||
};
|
||||
return "function" == typeof t && t(function (n, r) {
|
||||
e(n, r), o.callback[n] = function () {
|
||||
t(e)
|
||||
}
|
||||
}), this
|
||||
};
|
||||
return r && (t = e, e = []), layui["layui.all"] || !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n)
|
||||
}, n.prototype.use = function (e, n, l) {
|
||||
function s(e, t) {
|
||||
var n = "PLaySTATION 3" === navigator.platform ? /^complete$/ : /^(complete|loaded)$/;
|
||||
("load" === e.type || n.test((e.currentTarget || e.srcElement).readyState)) && (o.modules[f] = t, d.removeChild(v), function r() {
|
||||
return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void (o.status[f] ? c() : setTimeout(r, 4))
|
||||
}())
|
||||
}
|
||||
|
||||
function c() {
|
||||
l.push(layui[f]), e.length > 1 ? y.use(e.slice(1), n, l) : "function" == typeof n && n.apply(layui, l)
|
||||
}
|
||||
|
||||
var y = this, p = o.dir = o.dir ? o.dir : r, d = t.getElementsByTagName("head")[0];
|
||||
e = "string" == typeof e ? [e] : e, window.jQuery && jQuery.fn.on && (y.each(e, function (t, o) {
|
||||
"jquery" === o && e.splice(t, 1)
|
||||
}), layui.jquery = layui.$ = jQuery);
|
||||
var f = e[0], m = 0;
|
||||
if (l = l || [], o.host = o.host || (p.match(/\/\/([\s\S]+?)\//) || ["//" + location.host + "/"])[0], 0 === e.length || layui["layui.all"] && u[f] || !layui["layui.all"] && layui["layui.mobile"] && u[f]) return c(), y;
|
||||
if (o.modules[f]) !function g() {
|
||||
return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void ("string" == typeof o.modules[f] && o.status[f] ? c() : setTimeout(g, 4))
|
||||
}(); else {
|
||||
var v = t.createElement("script"),
|
||||
h = (u[f] ? p + "lay/" : /^\{\/\}/.test(y.modules[f]) ? "" : o.base || "") + (y.modules[f] || f) + ".js";
|
||||
h = h.replace(/^\{\/\}/, ""), v.async = !0, v.charset = "utf-8", v.src = h + function () {
|
||||
var e = o.version === !0 ? o.v || (new Date).getTime() : o.version || "";
|
||||
return e ? "?v=" + e : ""
|
||||
}(), d.appendChild(v), !v.attachEvent || v.attachEvent.toString && v.attachEvent.toString().indexOf("[native code") < 0 || a ? v.addEventListener("load", function (e) {
|
||||
s(e, h)
|
||||
}, !1) : v.attachEvent("onreadystatechange", function (e) {
|
||||
s(e, h)
|
||||
}), o.modules[f] = h
|
||||
}
|
||||
return y
|
||||
}, n.prototype.getStyle = function (t, o) {
|
||||
var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
|
||||
return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](o)
|
||||
}, n.prototype.link = function (e, n, r) {
|
||||
var a = this, u = t.createElement("link"), l = t.getElementsByTagName("head")[0];
|
||||
"string" == typeof n && (r = n);
|
||||
var s = (r || e).replace(/\.|\//g, ""), c = u.id = "layuicss-" + s, y = 0;
|
||||
return u.rel = "stylesheet", u.href = e + (o.debug ? "?v=" + (new Date).getTime() : ""), u.media = "all", t.getElementById(c) || l.appendChild(u), "function" != typeof n ? a : (function p() {
|
||||
return ++y > 1e3 * o.timeout / 100 ? i(e + " timeout") : void (1989 === parseInt(a.getStyle(t.getElementById(c), "width")) ? function () {
|
||||
n()
|
||||
}() : setTimeout(p, 100))
|
||||
}(), a)
|
||||
}, o.callback = {}, n.prototype.factory = function (e) {
|
||||
if (layui[e]) return "function" == typeof o.callback[e] ? o.callback[e] : null
|
||||
}, n.prototype.addcss = function (e, t, n) {
|
||||
return layui.link(o.dir + "css/" + e, t, n)
|
||||
}, n.prototype.img = function (e, t, o) {
|
||||
var n = new Image;
|
||||
return n.src = e, n.complete ? t(n) : (n.onload = function () {
|
||||
n.onload = null, "function" == typeof t && t(n)
|
||||
}, void (n.onerror = function (e) {
|
||||
n.onerror = null, "function" == typeof o && o(e)
|
||||
}))
|
||||
}, n.prototype.config = function (e) {
|
||||
e = e || {};
|
||||
for (var t in e) o[t] = e[t];
|
||||
return this
|
||||
}, n.prototype.modules = function () {
|
||||
var e = {};
|
||||
for (var t in u) e[t] = u[t];
|
||||
return e
|
||||
}(), n.prototype.extend = function (e) {
|
||||
var t = this;
|
||||
e = e || {};
|
||||
for (var o in e) t[o] || t.modules[o] ? i("模块名 " + o + " 已被占用") : t.modules[o] = e[o];
|
||||
return t
|
||||
}, n.prototype.router = function (e) {
|
||||
var t = this, e = e || location.hash, o = {path: [], search: {}, hash: (e.match(/[^#](#.*$)/) || [])[1] || ""};
|
||||
return /^#\//.test(e) ? (e = e.replace(/^#\//, ""), o.href = "/" + e, e = e.replace(/([^#])(#.*$)/, "$1").split("/") || [], t.each(e, function (e, t) {
|
||||
/^\w+=/.test(t) ? function () {
|
||||
t = t.split("="), o.search[t[0]] = t[1]
|
||||
}() : o.path.push(t)
|
||||
}), o) : o
|
||||
}, n.prototype.data = function (t, o, n) {
|
||||
if (t = t || "layui", n = n || localStorage, e.JSON && e.JSON.parse) {
|
||||
if (null === o) return delete n[t];
|
||||
o = "object" == typeof o ? o : {key: o};
|
||||
try {
|
||||
var r = JSON.parse(n[t])
|
||||
} catch (i) {
|
||||
var r = {}
|
||||
}
|
||||
return "value" in o && (r[o.key] = o.value), o.remove && delete r[o.key], n[t] = JSON.stringify(r), o.key ? r[o.key] : r
|
||||
}
|
||||
}, n.prototype.sessionData = function (e, t) {
|
||||
return this.data(e, t, sessionStorage)
|
||||
}, n.prototype.device = function (t) {
|
||||
var o = navigator.userAgent.toLowerCase(), n = function (e) {
|
||||
var t = new RegExp(e + "/([^\\s\\_\\-]+)");
|
||||
return e = (o.match(t) || [])[1], e || !1
|
||||
}, r = {
|
||||
os: function () {
|
||||
return /windows/.test(o) ? "windows" : /linux/.test(o) ? "linux" : /iphone|ipod|ipad|ios/.test(o) ? "ios" : /mac/.test(o) ? "mac" : void 0
|
||||
}(), ie: function () {
|
||||
return !!(e.ActiveXObject || "ActiveXObject" in e) && ((o.match(/msie\s(\d+)/) || [])[1] || "11")
|
||||
}(), weixin: n("micromessenger")
|
||||
};
|
||||
return t && !r[t] && (r[t] = n(t)), r.android = /android/.test(o), r.ios = "ios" === r.os, r
|
||||
}, n.prototype.hint = function () {
|
||||
return {error: i}
|
||||
}, n.prototype.each = function (e, t) {
|
||||
var o, n = this;
|
||||
if ("function" != typeof t) return n;
|
||||
if (e = e || [], e.constructor === Object) {
|
||||
for (o in e) if (t.call(e[o], o, e[o])) break
|
||||
} else for (o = 0; o < e.length && !t.call(e[o], o, e[o]); o++) ;
|
||||
return n
|
||||
}, n.prototype.sort = function (e, t, o) {
|
||||
var n = JSON.parse(JSON.stringify(e || []));
|
||||
return t ? (n.sort(function (e, o) {
|
||||
var n = /^-?\d+$/, r = e[t], i = o[t];
|
||||
return n.test(r) && (r = parseFloat(r)), n.test(i) && (i = parseFloat(i)), r && !i ? 1 : !r && i ? -1 : r > i ? 1 : r < i ? -1 : 0
|
||||
}), o && n.reverse(), n) : n
|
||||
}, n.prototype.stope = function (t) {
|
||||
t = t || e.event;
|
||||
try {
|
||||
t.stopPropagation()
|
||||
} catch (o) {
|
||||
t.cancelBubble = !0
|
||||
}
|
||||
}, n.prototype.onevent = function (e, t, o) {
|
||||
return "string" != typeof e || "function" != typeof o ? this : n.event(e, t, null, o)
|
||||
}, n.prototype.event = n.event = function (e, t, n, r) {
|
||||
var i = this, a = null, u = t.match(/\((.*)\)$/) || [], l = (e + "." + t).replace(u[0], ""), s = u[1] || "",
|
||||
c = function (e, t) {
|
||||
var o = t && t.call(i, n);
|
||||
o === !1 && null === a && (a = !1)
|
||||
};
|
||||
return r ? (o.event[l] = o.event[l] || {}, o.event[l][s] = [r], this) : (layui.each(o.event[l], function (e, t) {
|
||||
return "{*}" === s ? void layui.each(t, c) : ("" === e && layui.each(t, c), void (s && e === s && layui.each(t, c)))
|
||||
}), a)
|
||||
}, e.layui = new n
|
||||
}(window);
|
@ -0,0 +1,147 @@
|
||||
layui.define(['jquery', 'layer'], function (exports){
|
||||
var $ = layui.jquery;
|
||||
var chekedArr = {};
|
||||
var layfilter = {
|
||||
render:function(options){
|
||||
var url = options.url;
|
||||
var flag = true;
|
||||
//传入了地址,则直接将此地址覆盖
|
||||
if(url){
|
||||
$.getJSON(url,options.where,function(res){
|
||||
if(res.code == 0){
|
||||
var data = res.data;
|
||||
flase = true;
|
||||
layfilter.init(options,data);
|
||||
}else{
|
||||
layer.msg(res.msg||'查询过滤组件数据异常',{icon:2});
|
||||
flag = false
|
||||
}
|
||||
})
|
||||
}
|
||||
if(!flag){
|
||||
return;
|
||||
}
|
||||
},
|
||||
init:function(options,dataSource){
|
||||
var elem = options.elem;
|
||||
var $dom = $(elem);
|
||||
var itemWidth = options.itemWidth
|
||||
var arr = {};
|
||||
var $table = $('<table class="filterTable"></table>');
|
||||
for(var i=0;i<dataSource.length;i++){
|
||||
var $tr =$('<tr></tr>');
|
||||
var $td1 = $('<td class="item-title">'+dataSource[i].title+':</td>');
|
||||
var $td2 = $('<td class="items"></td>');
|
||||
var type = dataSource[i].type;
|
||||
if(!type){
|
||||
console.warn('第'+(i+1)+'个元素的类型[type]为空设为默认值[radio]');
|
||||
type = 'radio';
|
||||
}
|
||||
var $ul = $('<ul class="layfilter-ul" type="'+type+'" name="'+dataSource[i].name+'"></ul>');
|
||||
var width = itemWidth && itemWidth.length>0 ? (itemWidth.length>i ? itemWidth[i]:itemWidth[itemWidth.length-1]):80;
|
||||
arr[dataSource[i].name]=[];
|
||||
for(var j=0;j<dataSource[i].data.length;j++){
|
||||
var item = dataSource[i].data;
|
||||
var className = 'layfilter-item';
|
||||
if(item[j].checked && item[j].checked=='true'){
|
||||
className = "layfilter-item layfilter-item-checked";
|
||||
arr[dataSource[i].name].push({name:item[j].name,value:item[j].value});
|
||||
}
|
||||
//判断是否禁用
|
||||
if(item[j].disabled && item[j].disabled=='true'){
|
||||
$ul.append('<li value="'+item[j].value+'" style="width:'+width+'px;height: 28px;line-height: 28px;" class="'+className+'"><a disabled="disabled" class="layui-disabled">'+item[j].name+'</a></li>');
|
||||
}else{
|
||||
$ul.append('<li value="'+item[j].value+'" style="width:'+width+'px;height: 28px;line-height: 28px;" class="'+className+'"><a>'+item[j].name+'</a></li>');
|
||||
}
|
||||
|
||||
}
|
||||
$td2.append($ul);
|
||||
$tr.append($td1).append($td2);
|
||||
$table.append($tr);
|
||||
}
|
||||
$dom.append($table);
|
||||
chekedArr=arr;
|
||||
//注册点击事件
|
||||
$('.filterTable tr td li a').bind('click',function(){
|
||||
if($(this).attr('disabled')){
|
||||
return;
|
||||
}
|
||||
var itemType = $(this).parent().parent().attr('type');
|
||||
var name = $(this).parent().parent().attr('name');
|
||||
//取消选择
|
||||
if($(this).parent().hasClass('layfilter-item-checked')){
|
||||
$(this).parent().removeClass('layfilter-item-checked');
|
||||
var obj = chekedArr[name]||[];
|
||||
for(var i=0;i<obj.length;i++){
|
||||
if(obj[i].value==$(this).parent().attr('value')){
|
||||
obj.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
chekedArr[name] = obj;
|
||||
}else{
|
||||
if(itemType && ('checbox' == itemType || 'radio' == itemType)){
|
||||
//判断类型
|
||||
if('radio' == itemType){
|
||||
var objs = $(this).parent().siblings();
|
||||
chekedArr[name]=[];
|
||||
for(var i=0;i<objs.length;i++){
|
||||
objs.eq(i).removeClass('layfilter-item-checked');
|
||||
}
|
||||
}
|
||||
var obj = chekedArr[name]||[];
|
||||
obj.push({name:$(this).text(),value:$(this).parent().attr('value')});
|
||||
chekedArr[name]=obj;
|
||||
$(this).parent().addClass('layfilter-item-checked');
|
||||
}else{
|
||||
console.error('复选或单选类型为空?');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getValue:function(callback){
|
||||
var obj = getCheckData();
|
||||
callback.call(this,obj);
|
||||
},
|
||||
on:function(filter,callback){
|
||||
var f = filter.substring(0,filter.indexOf('('));
|
||||
var e = filter.substring(filter.indexOf('(')+1,filter.length-1);
|
||||
if(typeof callback === "function"){
|
||||
$("[lay-filter='"+e+"']").on(f,function(){
|
||||
var obj = getCheckData();
|
||||
|
||||
callback.call(this,obj);
|
||||
});
|
||||
}else{
|
||||
console.error('传入的参数不是一个函数');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layui.link(layui.cache.base + 'layfilter/layfilter.css');
|
||||
|
||||
function getCheckData(){
|
||||
var valueJson = {};
|
||||
var nameJson = {};
|
||||
for(var name in chekedArr){
|
||||
var json = chekedArr[name];
|
||||
var values = '';
|
||||
var names = '';
|
||||
for(var i=0;i<json.length;i++){
|
||||
if(i!=json.length-1){
|
||||
values+=json[i].value+",";
|
||||
names +=json[i].name+",";
|
||||
}else{
|
||||
values+=json[i].value;
|
||||
names +=json[i].name;
|
||||
}
|
||||
|
||||
}
|
||||
valueJson[name]=values;
|
||||
nameJson[name]=names;
|
||||
}
|
||||
return {values:valueJson,names:nameJson};
|
||||
}
|
||||
|
||||
exports('layfilter', layfilter);
|
||||
})
|
@ -0,0 +1,12 @@
|
||||
$(function () {
|
||||
|
||||
//登陆表单css间距设置
|
||||
function editcss() {
|
||||
var input1 = document.getElementsByTagName("input")[0];
|
||||
var input2 = document.getElementsByTagName("input")[1];
|
||||
input1.style.paddingLeft=40;
|
||||
input2.style.paddingLeft=40;
|
||||
}
|
||||
editcss();
|
||||
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
/** layui-v2.4.5 MIT License By https://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 274 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.6 KiB |