xuyang_branch
徐扬 5 months ago
parent b616be0e4a
commit b0d403429e

@ -23,9 +23,22 @@ public interface AdminDao {
//获取用户列表
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);
<<<<<<< HEAD
public int addAdmin(Admin admin);
//添加管理员信息
public int deleteAdmin(Integer a_id);
//删除管理员信息
public int updateAdmin(Admin admin);
//修改管理员信息
public Admin findAdminById(Integer a_id);
// 根据ID查询管理员信息
public List<Admin> getAll();
// 获取所有管理员信息
=======
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();
public Admin findAdminById(Integer a_id);// 根据ID查询管理员信息
public List<Admin> getAll();// 获取所有管理员信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,93 +3,114 @@
"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}
a_username = #{a_username}
</if>
<!-- 如果密码不为空且不为空字符串,则按密码查询,并与用户名查询结果进行交集 -->
<if test="a_password!=null and a_password!='' ">
and a_password = #{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}%'
and a_username like '%${a_username}%'
</if>
<!-- 如果描述不为空且不为空字符串,则按描述模糊查询 -->
<if test="a_describe!=null and a_describe!=''">
and a_describe like '%${a_describe}%'
and a_describe like '%${a_describe}%'
</if>
<!-- 如果ID不为空且不为0则按ID模糊查询 -->
<if test="a_id!=null and a_id!=0">
and a_id like '%${a_id}%'
and a_id like '%${a_id}%'
</if>
</where>
ORDER BY a_id asc
<!-- 按ID升序排序 -->
ORDER BY a_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询管理员总数 -->
<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}%'
and a_username like '%${a_username}%'
</if>
<!-- 如果描述不为空且不为空字符串,则按描述模糊查询 -->
<if test="a_describe!=null and a_describe!=''">
and a_describe like '%${a_describe}%'
and a_describe like '%${a_describe}%'
</if>
<!-- 如果ID不为空且不为0则按ID模糊查询 -->
<if test="a_id!=null and a_id!=0">
and a_id like '%${a_id}%'
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" >
<!-- 通过ID删除管理员信息 -->
<delete id="deleteAdmin" parameterType="Integer">
delete from d_admin where a_id=#{a_id}
</delete>
<select id="findAdminById" parameterType="Integer" resultType="Admin" >
<!-- 通过ID查询管理员信息 -->
<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>
<!-- 如果电话不为空且不为0则更新电话 -->
<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>

@ -18,10 +18,25 @@ public interface ClassDao {
//获取用户列表
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);
<<<<<<< HEAD
public int deleteClass(Integer c_id);
//删除班级信息
public int addClass(Class ucalss);
//添加班级信息
public int updateClass(Class uclass);
//修改班级信息
public Class findClassById(Integer c_id);
// 根据ID查询班级信息
public List<Class> findClassStudent(Class uclass);
//查询班级人员信息
public List<Class> getAll();
// 获取所有班级信息
=======
public int deleteClass(Integer c_id); //删除班级信息
public int addClass(Class ucalss); //添加班级信息
public int updateClass(Class uclass); //修改班级信息
public Class findClassById(Integer c_id);
public Class findClassById(Integer c_id);// 根据ID查询班级信息
public List<Class> findClassStudent(Class uclass);//查询班级人员信息
public List<Class> getAll();
public List<Class> getAll();// 获取所有班级信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,62 +3,78 @@
"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
select * from d_class
<where>
<!-- 如果班级名称不为空且不为空字符串,则按班级名称模糊查询 -->
<if test="c_classname!=null and c_classname!='' ">
and c_classname like '%${c_classname}%'
and c_classname like '%${c_classname}%'
</if>
<!-- 如果辅导员不为空且不为空字符串,则按辅导员模糊查询 -->
<if test="c_counsellor!=null and c_counsellor!=''">
and c_counsellor like '%${c_counsellor}%'
and c_counsellor like '%${c_counsellor}%'
</if>
<!-- 如果班级ID不为空且不为0则按班级ID模糊查询 -->
<if test="c_classid!=null and c_classid!=0">
and c_classid like '%${c_classid}%'
and c_classid like '%${c_classid}%'
</if>
</where>
ORDER BY c_id asc
<!-- 按ID升序排序 -->
ORDER BY c_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询班级总数 -->
<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}%'
and c_classname like '%${c_classname}%'
</if>
<!-- 如果辅导员不为空且不为空字符串,则按辅导员模糊查询 -->
<if test="c_counsellor!=null and c_counsellor!=''">
and c_counsellor like '%${c_counsellor}%'
and c_counsellor like '%${c_counsellor}%'
</if>
<!-- 如果班级ID不为空且不为0则按班级ID模糊查询 -->
<if test="c_classid!=null and c_classid!=0">
and c_classid like '%${c_classid}%'
and c_classid like '%${c_classid}%'
</if>
</where>
</where>
</select>
<!--通过id删除班级信息-->
<delete id="deleteClass" parameterType="Integer" >
<!-- 通过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 into d_class (c_classid, c_classname, c_counsellor)
values(#{c_classid}, #{c_classname}, #{c_counsellor})
</insert>
<select id="findClassById" parameterType="Integer" resultType="Class" >
<!-- 通过ID查询班级信息 -->
<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>
<!-- 如果班级ID不为空且不为0则更新班级ID -->
<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>
@ -66,6 +82,7 @@
where c_id = #{c_id}
</update>
<!--Mybatis使用Collection进行表关联查询关联一对多数据类型(class为一student为多)且需要有id-->
<!--Association关联一对一类型-->
<!--班级人员信息查询信息-->

@ -20,10 +20,23 @@ public interface DormCleanDao {
//获取用户列表
public List<DormClean> getDormCleanList(@Param("d_id") Integer d_id, @Param("d_dormbuilding") String d_dormbuilding, @Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);
<<<<<<< HEAD
public int addDormClean(DormClean dormclean);
//添加宿舍卫生信息
public int deleteDormClean(Integer g_id);
//删除宿舍卫生信息
public int updateDormClean(DormClean dormclean);
//修改宿舍卫生信息
public DormClean findDormCleanById(Integer g_id);
// 根据ID查询宿舍卫生信息
public List<DormClean> getAll();
// 获取所有宿舍卫生信息
=======
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();
public DormClean findDormCleanById(Integer g_id); // 根据ID查询宿舍卫生信息
public List<DormClean> getAll();// 获取所有宿舍卫生信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,78 +3,93 @@
"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
select * from d_dormgrade
<where>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
and d_id like '%${d_id}%'
</if>
<!-- 如果宿舍楼不为空且不为空字符串,则按宿舍楼模糊查询 -->
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
ORDER BY g_id asc
<!-- 按ID升序排序 -->
ORDER BY g_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询宿舍卫生信息总数 -->
<select id="totalCount" resultType="Integer">
select count(g_id) from d_dormgrade
<where>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
and d_id like '%${d_id}%'
</if>
<!-- 如果宿舍楼不为空且不为空字符串,则按宿舍楼模糊查询 -->
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${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 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" >
<!-- 通过ID删除宿舍卫生信息 -->
<delete id="deleteDormClean" parameterType="Integer">
delete from d_dormgrade where g_id=#{g_id}
</delete>
<select id="findDormCleanById" parameterType="Integer" resultType="DormClean" >
<!-- 通过ID查询宿舍卫生信息 -->
<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>
<!-- 如果宿舍ID不为空且不为0则更新宿舍ID -->
<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>
<!-- 如果卫生评分不为空且不为0则更新卫生评分 -->
<if test="d_grade!=null and d_grade!=0">
d_grade=#{d_grade},
</if>
<if test="update_time != null" >
<!-- 如果更新时间不为空,则更新时间为当前时间 -->
<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映射 -->
<id property="d_id" column="d_id"/>
<!-- 宿舍楼映射 -->
<result property="d_dormbuilding" column="d_dormbuilding" />
</resultMap>
</mapper>

@ -22,10 +22,23 @@ public interface DormRepairDao {
//获取用户列表
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); //修改宿舍信息
<<<<<<< HEAD
public int addDormRepair(DormRepair dormrepair);
//添加宿舍维修信息
public int deleteDormRepair(Integer r_id);
//删除宿舍维修信息
public int updateDormRepair(DormRepair dormrepair);
//修改宿舍维修信息
public DormRepair findDormRepairById(Integer r_id);
// 根据ID查询宿舍维修信息
public List<DormRepair> getAll();
// 获取所有宿舍维修信息
=======
public int addDormRepair(DormRepair dormrepair); //添加宿舍维修信息
public int deleteDormRepair(Integer r_id); //删除宿舍维修信息
public int updateDormRepair(DormRepair dormrepair); //修改宿舍维修信息
public DormRepair findDormRepairById(Integer r_id);// 根据ID查询宿舍维修信息
public List<DormRepair> getAll();// 获取所有宿舍维修信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,68 +3,82 @@
"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
select * from d_dormrepair
<where>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
and d_id like '%${d_id}%'
</if>
<!-- 如果宿舍楼不为空且不为空字符串,则按宿舍楼模糊查询 -->
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
ORDER BY r_id asc
<!-- 按维修ID升序排序 -->
ORDER BY r_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询宿舍维修信息总数 -->
<select id="totalCount" resultType="Integer">
select count(r_id) from d_dormrepair
<where>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="d_id!=null and d_id!=0">
and d_id like '%${d_id}%'
and d_id like '%${d_id}%'
</if>
<!-- 如果宿舍楼不为空且不为空字符串,则按宿舍楼模糊查询 -->
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${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 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" >
<!-- 通过ID删除宿舍维修信息 -->
<delete id="deleteDormRepair" parameterType="Integer">
delete from d_dormrepair where r_id=#{r_id}
</delete>
<select id="findDormRepairById" parameterType="Integer" resultType="DormRepair" >
<!-- 通过ID查询宿舍维修信息 -->
<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>
<!-- 如果宿舍ID不为空且不为0则更新宿舍ID -->
<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>
@ -72,6 +86,7 @@
where r_id = #{r_id}
</update>
<!--宿舍人员信息查询信息-->
<resultMap type="com.itheima.po.DormRepair" id="cardAndInfo2">
<id property="r_id" column="r_id"/>

@ -18,12 +18,28 @@ public interface DormitoryDao {
//获取用户列表
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);
<<<<<<< HEAD
public int addDormitory(Dormitory dormitory);
//添加宿舍信息
public int deleteDormitory(Integer d_id);
//删除宿舍信息
public int updateDormitory(Dormitory dormitory);
//修改宿舍信息
public Dormitory findDormitoryById(Integer d_id);
// 根据ID查询宿舍信息
public List<Dormitory> findDormitoryStudent(Dormitory dormitory);
//查询宿舍人员信息
public List<Dormitory> getAll();
// 获取所有宿舍信息
=======
public int addDormitory(Dormitory dormitory); //添加宿舍信息
public int deleteDormitory(Integer d_id); //删除宿舍信息
public int updateDormitory(Dormitory dormitory); //修改宿舍信息
public Dormitory findDormitoryById(Integer d_id);
public Dormitory findDormitoryById(Integer d_id); // 根据ID查询宿舍信息
public List<Dormitory> findDormitoryStudent(Dormitory dormitory);//查询宿舍人员信息
public List<Dormitory> getAll();
public List<Dormitory> getAll();// 获取所有宿舍信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,70 +3,85 @@
"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
select * from d_dormitoryinfo
<where>
<!-- 如果管理员姓名不为空且不为空字符串,则按管理员姓名模糊查询 -->
<if test="a_name!=null and a_name!=''">
and a_name like '%${a_name}%'
and a_name like '%${a_name}%'
</if>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
<!-- 如果宿舍楼不为空且不为空字符串,则按宿舍楼模糊查询 -->
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
ORDER BY d_id asc
<!-- 按ID升序排序 -->
ORDER BY d_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询宿舍信息总数 -->
<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}%'
and a_name like '%${a_name}%'
</if>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
<!-- 如果宿舍楼不为空且不为空字符串,则按宿舍楼模糊查询 -->
<if test="d_dormbuilding !=null and d_dormbuilding !=''">
and d_dormbuilding like '%${d_dormbuilding}%'
and d_dormbuilding like '%${d_dormbuilding}%'
</if>
</where>
</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 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" >
<!-- 通过ID删除宿舍信息 -->
<delete id="deleteDormitory" parameterType="Integer">
delete from d_dormitoryinfo where d_id=#{d_id}
</delete>
<select id="findDormitoryById" parameterType="Integer" resultType="Dormitory" >
<!-- 通过ID查询宿舍信息 -->
<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>
<!-- 如果宿舍ID不为空且不为0则更新宿舍ID -->
<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>
@ -74,6 +89,7 @@
where d_id = #{d_id}
</update>
<!--宿舍人员信息查询信息-->
<resultMap type="com.itheima.po.Dormitory" id="cardAndInfo2">
<id property="d_id" column="d_id"/>

@ -20,10 +20,24 @@ public interface StudentCleanDao {
//获取用户列表
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); //修改宿舍卫生信息
<<<<<<< HEAD
public int addStudentClean(StudentClean studentclean);
//添加学生卫生信息
public int deleteStudentClean(Integer g_id);
//删除学生卫生信息
public int updateStudentClean(StudentClean studentclean);
//修改学生卫生信息
public StudentClean findStudentCleanById(Integer g_id);
// 根据ID查询学生卫生信息
public List<StudentClean> getAll();
// 获取所有学生卫生信息
=======
public int addStudentClean(StudentClean studentclean); //添加学生卫生信息
public int deleteStudentClean(Integer g_id); //删除学生卫生信息
public int updateStudentClean(StudentClean studentclean); //修改学生卫生信息
public StudentClean findStudentCleanById(Integer g_id);// 根据ID查询学生卫生信息
public List<StudentClean> getAll();// 获取所有学生卫生信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,85 +3,102 @@
"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
select * from d_stgrade
<where>
<!-- 如果学生ID不为空且不为0则按学生ID模糊查询 -->
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
and s_studentid like '%${s_studentid}%'
</if>
<!-- 如果学生姓名不为空且不为空字符串,则按学生姓名模糊查询 -->
<if test="s_name !=null and s_name !=''">
and s_name like '%${s_name}%'
and s_name like '%${s_name}%'
</if>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
and s_dormitoryid like '%${s_dormitoryid}%'
</if>
</where>
ORDER BY g_id asc
<!-- 按卫生评分ID升序排序 -->
ORDER BY g_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询学生卫生信息总数 -->
<select id="totalCount" resultType="Integer">
select count(g_id) from d_stgrade
<where>
<!-- 如果学生ID不为空且不为0则按学生ID模糊查询 -->
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
and s_studentid like '%${s_studentid}%'
</if>
<!-- 如果学生姓名不为空且不为空字符串,则按学生姓名模糊查询 -->
<if test="s_name !=null and s_name !=''">
and s_name like '%${s_name}%'
and s_name like '%${s_name}%'
</if>
<!-- 如果宿舍ID不为空且不为0则按宿舍ID模糊查询 -->
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
and s_dormitoryid like '%${s_dormitoryid}%'
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 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" >
<!-- 通过ID删除学生卫生信息 -->
<delete id="deleteStudentClean" parameterType="Integer">
delete from d_stgrade where g_id=#{g_id}
</delete>
<select id="findStudentCleanById" parameterType="Integer" resultType="StudentClean" >
<!-- 通过ID查询学生卫生信息 -->
<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>
<!-- 如果学生ID不为空且不为0则更新学生ID -->
<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>
<!-- 如果卫生评分不为空且不为0则更新卫生评分 -->
<if test="s_grade!=null and s_grade!=0">
s_grade=#{s_grade},
</if>
<!-- 如果班级ID不为空且不为0则更新班级ID -->
<if test="s_classid!=null and s_classid!=0">
s_classid=#{s_classid},
</if>
<!-- 如果宿舍ID不为空且不为0则更新宿舍ID -->
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
s_dormitoryid=#{s_dormitoryid},
</if>
<if test="update_time != null" >
<!-- 如果更新时间不为空,则更新时间为当前时间 -->
<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"/>

@ -20,9 +20,22 @@ public interface StudentDao {
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);
<<<<<<< HEAD
public int deleteStudent(Integer s_id);
//删除学生信息
public int addStudent(Student student);
//添加学生信息
public int updateStudent(Student student);
//修改学生信息
public Student findStudentById(Integer s_id);
// 根据ID查询学生信息
public List<Student> getAll();
// 获取所有学生信息
=======
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();
public Student findStudentById(Integer s_id);// 根据ID查询学生信息
public List<Student> getAll();// 获取所有学生信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,83 +3,105 @@
"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
select * from d_student
<where>
<!-- 如果学生姓名不为空且不为空字符串,则按学生姓名模糊查询 -->
<if test="s_name!=null and s_name!='' ">
and s_name like '%${s_name}%'
and s_name like '%${s_name}%'
</if>
<!-- 如果学生ID不为空且不为0则按学生ID模糊查询 -->
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
and s_studentid like '%${s_studentid}%'
</if>
<!-- 如果班级ID不为空且不为0则按班级ID模糊查询 -->
<if test="s_classid!=null and s_classid!=0">
and s_classid like '%${s_classid}%'
and s_classid like '%${s_classid}%'
</if>
<!-- 如果班级名称不为空且不为空字符串,则按班级名称模糊查询 -->
<if test="s_classname!=null and s_classname!='' ">
and s_classname like '%${s_classname}%'
and s_classname like '%${s_classname}%'
</if>
</where>
ORDER BY s_id asc
<!-- 按学生ID升序排序 -->
ORDER BY s_id asc
<!-- 分页参数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询学生总数 -->
<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>
<!-- 如果学生姓名不为空且不为空字符串,则按学生姓名模糊查询 -->
<if test="s_name!=null and s_name!='' ">
and s_name like '%${s_name}%'
</if>
<!-- 如果学生ID不为空且不为0则按学生ID模糊查询 -->
<if test="s_studentid!=null and s_studentid!=0">
and s_studentid like '%${s_studentid}%'
</if>
<!-- 如果班级ID不为空且不为0则按班级ID模糊查询 -->
<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" >
<!-- 通过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 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}
<!-- 通过ID查询学生信息 -->
<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>
<!-- 如果学生ID不为空且不为0则更新学生ID -->
<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>
<!-- 如果学生年龄不为空且不为0则更新学生年龄 -->
<if test="s_age !=null and s_age !=0">
s_age=#{s_age},
</if>
<!-- 如果学生电话不为空且不为0则更新学生电话 -->
<if test="s_phone !=null and s_phone !=0">
s_phone=#{s_phone},
</if>
<!-- 如果班级ID不为空且不为0则更新班级ID -->
<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>
<!-- 如果宿舍ID不为空且不为0则更新宿舍ID -->
<if test="s_dormitoryid!=null and s_dormitoryid!=0">
s_dormitoryid=#{s_dormitoryid},
</if>
@ -87,6 +109,7 @@
where s_id = #{s_id}
</update>
<!-- 获取所有学生信息 -->
<select id="getAll" resultType="Student">
select * from d_student;
</select>

@ -21,7 +21,14 @@ public interface VisitorDao {
//获取用户列表
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); //添加学生信息
<<<<<<< HEAD
public int addVisitor(Visitor visitor);
//添加访客信息
public List<Visitor> getAll();
//获取所有访客信息
=======
public int addVisitor(Visitor visitor); //添加访客信息
public List<Visitor> getAll();//获取所有访客信息
>>>>>>> 5a268e17dc083cddf695d0a8f5feff0d7e289ef4
}

@ -3,42 +3,50 @@
"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}%'
and v_name like '%${v_name}%'
</if>
<!-- 如果访客电话不为空且不为0则按访客电话模糊查询 -->
<if test="v_phone!=null and v_phone!=0">
and v_phone like '%${v_phone}%'
and v_phone like '%${v_phone}%'
</if>
</where>
ORDER BY v_id asc
<!-- 按访客ID升序排序 -->
ORDER BY v_id asc
<!-- 分页参数,限制返回的记录数 -->
limit #{currentPage},#{pageSize}
</select>
<!--查询数据总数-->
<select id="totalCount" resultType="Integer">
<!-- 查询访客总数 -->
<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}%'
and v_name like '%${v_name}%'
</if>
<!-- 如果访客电话不为空且不为0则按访客电话模糊查询 -->
<if test="v_phone!=null and v_phone!=0">
and v_phone like '%${v_phone}%'
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 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>

Loading…
Cancel
Save