数据访问层

main
taoxiao 11 months ago
parent 0e68ed626b
commit dacc850fa6

@ -0,0 +1,135 @@
package com.cya.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.type.IntegerTypeHandler;
import com.cya.entity.Admin;
import com.cya.entity.DormBuild;
import com.cya.entity.DormManage;
import com.cya.entity.Notice;
import com.cya.entity.PunchClock;
import com.cya.entity.PunchClockRecord;
import com.cya.entity.Record;
import com.cya.entity.Student;
import com.sun.org.glassfish.gmbal.ParameterNames;
public interface IAdminMapper {
/*-------------------------宿管---------------------------*/
public List<DormManage>getDormManage(@Param("filter")String filter,@Param("key")String key);
public void addDormManage(DormManage dormManage);
public DormManage getDormMangerById(@Param("dormManId") int dormManId);
public void updataDormManageById(DormManage dormManage);
public void deleteDormManageById(@Param("dormManId") Integer dormManId);
/*-------------------------宿管---------------------------*/
/*-------------------------学生---------------------------*/
public List<Student>getStudentManage(@Param("filter")String filter,@Param("key")String key);
public void addStudentManage(Student student);
public Student getStudentMangerById(@Param("studentId") int studentId);
public void updataStudentManageById(Student student);
public void studentManagerDeleteById(@Param("studentId") int studentId);
/*-------------------------学生---------------------------*/
/*-------------------------宿舍楼---------------------------*/
public List<DormBuild>getBuildManage(@Param("filter")String filter,@Param("key")String key);
public void addBuildManage(DormBuild dormBuild);
public DormBuild getBuildMangerById(@Param("dormBuildId") int dormBuildId);
public void updataBuildManageById(DormBuild dormBuild);
public void buildManagerDeleteById(@Param("dormBuildId") Integer dormBuildId);
public List<DormManage> getDormMangerByBuildId(@Param("dormBuildId") Integer dormBuildId);
public List<DormManage> getDormManage2();
public void addDormManageToBuild(@Param("dormBuildId")Integer dormBuildId,@Param("dormManId")Integer dormManId);
public void removeaDormManageToBuild(@Param("dormManId")Integer dormManId);
/*-------------------------宿舍楼---------------------------*/
/*-------------------------考勤---------------------------*/
public List<Record>getRecordManage(@Param("filter")String filter,@Param("key")String key);
public void recordManagerDeleteById(@Param("recordId")Integer recordId);
/*-------------------------考勤---------------------------*/
/*-------------------------公告---------------------------*/
public List<Notice>getNoticeManage(@Param("filter")String filter,@Param("key")String key);
public void addNoticeManage(Notice notice);
public Notice getNoticeMangerById(@Param("noticeId") Integer noticeId);
public void updataNoticeManageById(Notice notice);
public void noticeManagerDeleteById(@Param("noticeId") Integer noticeId);
/*-------------------------公告---------------------------*/
/*-------------------------我的---------------------------*/
public Admin getMyMsgById(@Param("adminId") Integer adminId);
public void updateMyMsgById(Admin admin);
public void updatePsd(Admin admin);
/*-------------------------我的---------------------------*/
/*-------------------------打卡---------------------------*/
public List<PunchClock>getPunchClockManage(@Param("filter")String filter,@Param("key")String key);
public void addPunchClockManageMsg(PunchClock punchClock);
public PunchClock getPunchClockMangerById(@Param("id") String id);
public void updataPunchClockManageMsgById(PunchClock punchClock);
public void punchClockManagerDeleteById(@Param("id") String id);
public List<Student> getStudentMsg();
public void insertIntoPunchClockRecord(PunchClockRecord punchClockRecord);
public void updateIntoPunchClockRecordById(PunchClock punchClock);
public void deletePunchClockRecordById(String id);
/*-------------------------打卡---------------------------*/
}

@ -0,0 +1,249 @@
<?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.cya.mapper.IAdminMapper">
<!-- ******************** 宿管 ******************* -->
<!-- 获取宿管信息 -->
<select id="getDormManage" resultType="com.cya.entity.DormManage">
select dormManId,userName,dormBuildId,name,sex,tel from t_dormmanager
<where>
<if test="filter=='name' and key !='' ">
name like concat("%",#{key},"%")
</if>
<if test="filter=='userName' and key !='' ">
userName like concat("%",#{key},"%")
</if>
</where>
</select>
<insert id="addDormManage" parameterType="com.cya.entity.DormManage">
insert into t_dormmanager(userName,password,name,sex,tel) values(#{userName},#{password},#{name},#{sex},#{tel})
</insert>
<select id="getDormMangerById" parameterType="Integer" resultType="com.cya.entity.DormManage">
select * from t_dormmanager where dormManId=#{dormManId}
</select>
<update id="updataDormManageById" parameterType="com.cya.entity.DormManage">
update t_dormmanager set userName=#{userName},password=#{password},name=#{name},sex=#{sex},tel=#{tel} where dormManId=#{dormManId}
</update>
<delete id="deleteDormManageById" parameterType="Integer">
delete from t_dormmanager where dormManId=#{dormManId}
</delete>
<!-- ******************** 宿管 ******************* -->
<!-- ******************** 学生 ******************* -->
<!-- 获取学生信息 -->
<select id="getStudentManage" resultType="com.cya.entity.Student">
select studentId,stuNum,name,dormBuildId,dormName,sex,tel
from t_student
<where>
<if test="filter=='name' and key !='' ">
name like concat("%",#{key},"%")
</if>
<if test="filter=='stuNum' and key !='' ">
stuNum like concat("%",#{key},"%")
</if>
<if test="filter=='dormName' and key !='' ">
dormName like concat("%",#{key},"%")
</if>
</where>
</select>
<insert id="addStudentManage" parameterType="com.cya.entity.Student">
insert into t_student(stuNum,password,name,dormBuildId,dormName,sex,tel) values(#{stuNum},#{password},#{name},#{dormBuildId},#{dormName},#{sex},#{tel})
</insert>
<select id="getStudentMangerById" parameterType="Integer" resultType="com.cya.entity.Student">
select * from t_student where studentId=#{studentId}
</select>
<update id="updataStudentManageById" parameterType="com.cya.entity.Student">
update t_student set stuNum=#{stuNum},password=#{password},name=#{name},sex=#{sex},dormBuildId=#{dormBuildId},dormName=#{dormName},tel=#{tel} where studentId=#{studentId}
</update>
<delete id="studentManagerDeleteById" parameterType="Integer">
delete from t_student where studentId=#{studentId}
</delete>
<!-- ******************** 学生 ******************* -->
<!-- ******************** 宿舍楼 ******************* -->
<select id="getBuildManage" resultType="com.cya.entity.DormBuild">
select * from t_dormbuild
<where>
<if test="filter=='dormBuildName' and key !='' ">
dormBuildName like concat("%",#{key},"%")
</if>
</where>
</select>
<insert id="addBuildManage" parameterType="com.cya.entity.DormBuild">
insert into t_dormbuild(dormBuildName,dormBuildDetail) values(#{dormBuildName},#{dormBuildDetail})
</insert>
<select id="getBuildMangerById" parameterType="Integer" resultType="com.cya.entity.DormBuild">
select * from t_dormbuild where dormBuildId=#{dormBuildId}
</select>
<update id="updataBuildManageById" parameterType="com.cya.entity.DormBuild">
update t_dormbuild set dormBuildName=#{dormBuildName},dormBuildDetail=#{dormBuildDetail} where dormBuildId=#{dormBuildId}
</update>
<delete id="buildManagerDeleteById" parameterType="Integer">
delete from t_dormbuild where dormBuildId=#{dormBuildId}
</delete>
<select id="getDormMangerByBuildId" resultType="com.cya.entity.DormManage">
select dormManId,name,sex,tel from t_dormmanager where dormBuildId=#{dormBuildId}
</select>
<select id="getDormManage2" resultType="com.cya.entity.DormManage">
select dormManId,name from t_dormmanager
</select>
<update id="addDormManageToBuild" parameterType="Integer">
update t_dormmanager set dormBuildId=#{dormBuildId} where dormManId=#{dormManId}
</update>
<update id="removeaDormManageToBuild" parameterType="Integer">
update t_dormmanager set dormBuildId=0 where dormManId=#{dormManId}
</update>
<!-- ******************** 宿舍楼 ******************* -->
<!-- ******************** 考勤 ******************* -->
<select id="getRecordManage" resultType="com.cya.entity.Record">
select * from t_record
<where>
<if test="filter=='studentName' and key !='' ">
studentName like concat("%",#{key},"%")
</if>
<if test="filter=='studentNumber' and key !='' ">
studentNumber like concat("%",#{key},"%")
</if>
<if test="filter=='dormName' and key !='' ">
dormName like concat("%",#{key},"%")
</if>
</where>
</select>
<delete id="recordManagerDeleteById" parameterType="Integer">
delete from t_record where recordId=#{recordId}
</delete>
<!-- ******************** 考勤 ******************* -->
<!-- ******************** 公告 ******************* -->
<select id="getNoticeManage" resultType="com.cya.entity.Notice">
select * from t_notice
<where>
<if test="filter=='date' and key !='' ">
date like concat("%",#{key},"%")
</if>
</where>
</select>
<insert id="addNoticeManage" parameterType="com.cya.entity.Notice">
insert into t_notice(noticePerson,date,content) values(#{noticePerson},current_date,#{content})
</insert>
<select id="getNoticeMangerById" parameterType="Integer" resultType="com.cya.entity.Notice">
select * from t_notice where noticeId=#{noticeId}
</select>
<update id="updataNoticeManageById" parameterType="com.cya.entity.Notice">
update t_notice set noticePerson=#{noticePerson},content=#{content} where noticeId=#{noticeId}
</update>
<delete id="noticeManagerDeleteById" parameterType="Integer">
delete from t_notice where noticeId=#{noticeId}
</delete>
<!-- ******************** 公告 ******************* -->
<!-- ******************** 我的 ******************* -->
<select id="getMyMsgById" resultType="com.cya.entity.Admin">
select * from t_admin where adminId=#{adminId}
</select>
<update id="updateMyMsgById" parameterType="com.cya.entity.Admin">
update t_admin set userName=#{userName},name=#{name},tel=#{tel} where adminId=#{adminId}
</update>
<update id="updatePsd" parameterType="com.cya.entity.Admin">
update t_admin set password=#{password} where adminId=#{adminId}
</update>
<!-- ******************** 我的 ******************* -->
<!-- ******************** 打卡 ******************* -->
<select id="getPunchClockManage" resultType="com.cya.entity.PunchClock">
select * from t_punchclock
<where>
<if test="filter=='date' and key !='' ">
date like concat("%",#{key},"%")
</if>
</where>
</select>
<insert id="addPunchClockManageMsg" parameterType="com.cya.entity.PunchClock">
insert into t_punchclock(id,theme,detail,date,person) values(#{id},#{theme},#{detail},current_date,#{person})
</insert>
<select id="getPunchClockMangerById" parameterType="java.lang.String" resultType="com.cya.entity.PunchClock">
select * from t_punchclock where id=#{id}
</select>
<update id="updataPunchClockManageMsgById" parameterType="com.cya.entity.PunchClock">
update t_punchclock set theme=#{theme},detail=#{detail} where id=#{id}
</update>
<delete id="punchClockManagerDeleteById" parameterType="java.lang.String">
delete from t_punchclock where id=#{id}
</delete>
<select id="getStudentMsg" resultType="com.cya.entity.Student">
select * from t_student where studentId in(select min(studentId) from t_student group by stuNum)
</select>
<insert id="insertIntoPunchClockRecord" parameterType="com.cya.entity.PunchClockRecord">
insert into t_punchclockrecord
(punchClock_id,punchClock_date,punchClock_theme,punchClock_detail,punchClock_person,name,dormName,tel,stuNum,dormBuildId,isRecord,punckClock_content)
values(#{punchClockId},#{punchClockDate},#{punchClockTheme},#{punchClockDetail},#{punchClockPerson},#{name},#{dormName},#{tel},#{stuNum},#{dormBuildId},#{isRecord},#{punckClockContent})
</insert>
<update id="updateIntoPunchClockRecordById" parameterType="com.cya.entity.PunchClock">
update t_punchclockrecord set punchClock_theme=#{theme},punchClock_detail=#{detail} where punchClock_id=#{id}
</update>
<delete id="deletePunchClockRecordById" parameterType="java.lang.String">
delete from t_punchclockrecord where punchClock_id=#{id}
</delete>
<!-- ******************** 打卡 ******************* -->
</mapper>

@ -0,0 +1,45 @@
package com.cya.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.cya.entity.Admin;
import com.cya.entity.DormManage;
import com.cya.entity.Notice;
import com.cya.entity.PunchClockRecord;
import com.cya.entity.Record;
import com.cya.entity.Student;
public interface IDormManageMapper {
public List<Student>getStudentMsgByBuildId(@Param("filter")String filter,@Param("key")String key,@Param("dormBuildId") Integer dormBuildId);
public void studentMsgDeleteById(@Param("studentId") int studentId);
public List<Record>getRecordMsg(@Param("filter")String filter,@Param("key")String key,@Param("dormBuildId") Integer dormBuildId);
public Record getRecordById(@Param("recordId") int recordId);
public void updataRecordMsg(Record record);
public void addRecordMsg(Record record);
public void recordManagerDeleteById1(@Param("recordId") Integer recordId);
public DormManage dorm_getMyMsgById(@Param("dormManId") Integer dormManId);
public void dorm_updateMyMsgById(DormManage dormManage);
public void dorm_updatePsd(DormManage dormManage);
public List<Notice> getNoticeAll();
public List<PunchClockRecord>getPunchClockRecordMsgByDormBuildId(@Param("filter")String filter,@Param("key")String key,@Param("dormBuildId") Integer dormBuildId);
}

@ -0,0 +1,103 @@
<?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.cya.mapper.IDormManageMapper">
<select id="getStudentMsgByBuildId" resultType="com.cya.entity.Student">
select studentId,stuNum,name,dormBuildId,dormName,sex,tel
from t_student where 1=1
<if test="filter=='name' and key !='' ">
and name like concat("%",#{key},"%")
</if>
<if test="filter=='stuNum' and key !='' ">
and stuNum like concat("%",#{key},"%")
</if>
<if test="filter=='dormName' and key !='' ">
and dormName like concat("%",#{key},"%")
</if>
<if test="dormBuildId!=null" >
and dormBuildId=#{dormBuildId}
</if>
</select>
<delete id="studentMsgDeleteById" parameterType="Integer">
delete from t_student where studentId=#{studentId}
</delete>
<select id="getRecordMsg" resultType="com.cya.entity.Record">
select * from t_record where 1=1
<if test="filter=='studentName' and key !='' ">
and studentName like concat("%",#{key},"%")
</if>
<if test="filter=='studentNumber' and key !='' ">
and studentNumber like concat("%",#{key},"%")
</if>
<if test="filter=='dormName' and key !='' ">
and dormName like concat("%",#{key},"%")
</if>
<if test="dormBuildId!=null" >
and dormBuildId=#{dormBuildId}
</if>
</select>
<select id="getRecordById" parameterType="Integer" resultType="com.cya.entity.Record">
select * from t_record where recordId=#{recordId}
</select>
<update id="updataRecordMsg" parameterType="com.cya.entity.Record">
update t_record set detail=#{detail} where recordId=#{recordId}
</update>
<insert id="addRecordMsg" parameterType="com.cya.entity.Record">
insert into t_record(studentNumber,studentName,dormBuildId,dormName,date,detail) values(#{studentNumber},#{studentName},#{dormBuildId},#{dormName},current_date,#{detail})
</insert>
<delete id="recordManagerDeleteById1" parameterType="Integer">
delete from t_record where recordId=#{recordId}
</delete>
<!-- ******************** 我的 ******************* -->
<select id="dorm_getMyMsgById" resultType="com.cya.entity.DormManage">
select * from t_dormmanager where dormManId=#{dormManId}
</select>
<update id="dorm_updateMyMsgById" parameterType="com.cya.entity.DormManage">
update t_dormmanager set userName=#{userName},name=#{name},tel=#{tel} where dormManId=#{dormManId}
</update>
<update id="dorm_updatePsd" parameterType="com.cya.entity.DormManage">
update t_dormmanager set password=#{password} where dormManId=#{dormManId}
</update>
<!-- ******************** 我的 ******************* -->
<select id="getNoticeAll" resultType="com.cya.entity.Notice">
select * from t_notice
</select>
<!-- ******************** 打卡 ******************* -->
<select id="getPunchClockRecordMsgByDormBuildId" resultType="com.cya.entity.PunchClockRecord">
select * from t_punchclockrecord where 1=1
<if test="filter=='date' and key !='' ">
and punchClock_date like concat("%",#{key},"%")
</if>
<if test="dormBuildId!=null" >
and dormBuildId=#{dormBuildId}
</if>
</select>
<!-- ******************** 打卡 ******************* -->
</mapper>

@ -0,0 +1,17 @@
package com.cya.mapper;
import java.util.List;
import com.cya.entity.Admin;
import com.cya.entity.DormManage;
import com.cya.entity.Login;
import com.cya.entity.Student;
public interface ILoginMapper {
public List<Admin> loginToAdmin(Login login);
public List<DormManage> loginToDormManage(Login login);
public List<Student> loginToStudent(Login login);
}

@ -0,0 +1,16 @@
<?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.cya.mapper.ILoginMapper">
<select id="loginToAdmin" resultType="com.cya.entity.Admin">
select * from t_admin where userName=#{userName} and password=#{password}
</select>
<select id="loginToDormManage" resultType="com.cya.entity.DormManage">
select * from t_dormmanager where userName=#{userName} and password=#{password}
</select>
<select id="loginToStudent" resultType="com.cya.entity.Student">
select * from t_student where stuNum=#{userName} and password=#{password}
</select>
</mapper>

@ -0,0 +1,28 @@
package com.cya.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.cya.entity.PunchClockRecord;
import com.cya.entity.Record;
import com.cya.entity.Student;
public interface IStudentMapper {
public List<Record>getRecordMsgByStuNum(@Param("filter") String filter,@Param("key")String key,@Param("studentNumber") String studentNumber);
public Student student_getMyMsgById(@Param("studentId") Integer studentId);
public void student_updateMyMsgById(Student student);
public void student_updatePsd(Student student);
public List<PunchClockRecord>getPunchClockRecordMsgByStuNum(@Param("filter") String filter,@Param("key")String key,@Param("studentNumber") String studentNumber);
public PunchClockRecord getPunckColcokRecordById(@Param("id")Integer id);
public void updataPunchClockRecordMsg(PunchClockRecord punchClockRecord);
}

@ -0,0 +1,54 @@
<?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.cya.mapper.IStudentMapper">
<select id="getRecordMsgByStuNum" resultType="com.cya.entity.Record">
select * from t_record where 1=1
<if test="filter=='date' and key !='' ">
and date like concat("%",#{key},"%")
</if>
<if test="studentNumber!=null" >
and studentNumber=#{studentNumber}
</if>
</select>
<!-- ******************** 我的 ******************* -->
<select id="student_getMyMsgById" resultType="com.cya.entity.Student">
select * from t_student where studentId=#{studentId}
</select>
<update id="student_updateMyMsgById" parameterType="com.cya.entity.Student">
update t_student set name=#{name},tel=#{tel} where studentId=#{studentId}
</update>
<update id="student_updatePsd" parameterType="com.cya.entity.Student">
update t_student set password=#{password} where studentId=#{studentId}
</update>
<!-- ******************** 我的 ******************* -->
<!-- ******************** 打卡 ******************* -->
<select id="getPunchClockRecordMsgByStuNum" resultType="com.cya.entity.PunchClockRecord">
select * from t_punchclockrecord where 1=1
<if test="filter=='date' and key !='' ">
and punchClock_date like concat("%",#{key},"%")
</if>
<if test="studentNumber!=null" >
and stuNum=#{studentNumber}
</if>
</select>
<select id="getPunckColcokRecordById" resultType="com.cya.entity.PunchClockRecord">
select * from t_punchclockrecord where id=#{id}
</select>
<update id="updataPunchClockRecordMsg" parameterType="com.cya.entity.PunchClockRecord">
update t_punchclockrecord set isRecord=true,punckClock_content=#{punckClockContent} where id=#{id}
</update>
<!-- ******************** 打卡 ******************* -->
</mapper>
Loading…
Cancel
Save