SSH框架(spring+struts2+hibernate)+Mysql实现的会议管理系统(功能包含会议室管理、会议管理、用户管理、部门管理、设备管理、个人资料编辑等)

网友投稿 750 2022-10-28

SSH框架(spring+struts2+hibernate)+Mysql实现的会议管理系统(功能包含会议室管理、会议管理、用户管理、部门管理、设备管理、个人资料编辑等)

SSH框架(spring+struts2+hibernate)+Mysql实现的会议管理系统(功能包含会议室管理、会议管理、用户管理、部门管理、设备管理、个人资料编辑等)

@TOC

SSH(spring+struts2+hibernate)的会议室管理系统

本系统为了解决会议室预订会议冲突,以及更好的利用会议室资源,提高工作沟通效率,通过会议室管理、会议管理、设备管理、用户管理、部门管理等模块,实现了会议室利用的透明化管理。

实现功能截图

系统功能

本会议管理系统实现了以下功能:1、登录2、会议室管理3、会议管理4、设备管理5、用户管理6、部门管理7、个人资料编辑

使用技术

数据库:mysql开发工具:Eclipse(Myeclispe、Idea也可以)知识点:SSH(spring+struts2+hibernate)

代码

实体类Meet.java

package com.code2life.meet.entity; /** * 会议记录实体 * @author code2life2 * */ public class Meet { private Integer meetid; //会议id private String meetname; //会议名 private User user;//用户 private Boardroom room; //会议室 private Equipment equipment; //设备 private String starttime; //开始时间 private String endtime; //开始时间 public Meet() { } public Integer getMeetid() { return meetid; } public void setMeetid(Integer meetid) { this.meetid = meetid; } public String getMeetname() { return meetname; } public void setMeetname(String meetname) { this.meetname = meetname; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Boardroom getRoom() { return room; } public void setRoom(Boardroom room) { this.room = room; } public Equipment getEquipment() { return equipment; } public void setEquipment(Equipment equipment) { this.equipment = equipment; } public String getStarttime() { return starttime; } public void setStarttime(String starttime) { this.starttime = starttime; } public String getEndtime() { return endtime; } public void setEndtime(String endtime) { this.endtime = endtime; } }

Equipment.java

package com.code2life.meet.entity; import java.util.HashSet; import java.util.Set; /** * 设备实体 * @author Code2Life2 * */ public class Equipment { private Integer equipmentid; //设备id private String equipmentname; //设备名 private Set meet= new HashSet(); //会议记录 public Equipment() { } public Equipment(String equipmentname) { this.equipmentname = equipmentname; } public Equipment(Integer equipmentid, String equipmentname) { super(); this.equipmentid = equipmentid; this.equipmentname = equipmentname; } public Integer getEquipmentid() { return equipmentid; } public void setEquipmentid(Integer equipmentid) { this.equipmentid = equipmentid; } public String getEquipmentname() { return equipmentname; } public void setEquipmentname(String equipmentname) { this.equipmentname = equipmentname; } public Set getMeet() { return meet; } public void setMeet(Set meet) { this.meet = meet; } }

DAO层:MeetDaoImpl.java

package com.code2life.meet.dao.impl; import java.util.List; import com.code2life.meet.dao.IMeetDao; import org.apache.commons.lang.StringUtils; import org.hibernate.Query; import org.hibernate.Session; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.code2life.meet.entity.Meet; /** * 会议管理持久层dao接口实现 * @author Code2Life * */ public class MeetDaoImpl extends HibernateDaoSupport implements IMeetDao { /** * 添加 */ @Override public void addMeet(Meet meet) throws Exception { this.getHibernateTemplate().save(meet); } /** * 删除 */ @Override public void deleteMeet(int id) throws Exception { Meet meet=this.getHibernateTemplate().load(Meet.class, id); this.getHibernateTemplate().delete(meet); } /** * 更新 */ @Override public void updateMeet(Meet meet) throws Exception { this.getHibernateTemplate().update(meet); } /** * 查找所有 */ @Override public List findAllMeet() throws Exception { @SuppressWarnings("unchecked") List meetList=this.getHibernateTemplate().find("from Meet"); return meetList; } /** * 通过id查找 */ @Override public Meet findByIdMeet(int id) throws Exception { Meet meet=this.getHibernateTemplate().get(Meet.class, id); return meet; } /** * 分页查询 */ @Override public List queryForPage(String hql, int offset, int length) { Session session=this.getSession(); Query q=session.createQuery(hql); q.setFirstResult(offset); q.setMaxResults(length); List list=q.list(); //System.out.println(list.size()); session.close(); return list; } /** * 查询所有的记录数 */ @Override public int getAllRowCount(String hql) { return this.getHibernateTemplate().find("from Meet").size(); } /** * 所有记录数 */ @Override public int getAllRowCount(String hql, String name) { StringBuilder allRowCountHQL = new StringBuilder("from Meet where 1=1 "); if (StringUtils.isNotEmpty(name)) { allRowCountHQL.append(" and meetname like '%").append("%' "); } return this.getHibernateTemplate().find(allRowCountHQL.toString()).size(); } /** * 条件查询 */ @Override public List findByTJ(String hql, int offset, int length, String name) { Session session=this.getSession(); Query q=session.createQuery(hql); q.setFirstResult(offset); q.setMaxResults(length); List list=q.list(); //System.out.println(list.size()); session.close(); return list; } // queryString HQL语句 // pageSize每页显示多少条 // page当前所在页 public List queryListObjectAllForPage(String queryString, int pageSize, int page) { Session session = this.getHibernateTemplate().getSessionFactory().openSession(); Query query = session.createQuery(queryString); query.setFirstResult((page - 1) * pageSize); query.setMaxResults(pageSize); List list = (List) query.list(); session.close(); return list; } }

EquipmentDaoImpl.java

package com.code2life.meet.dao.impl; import java.util.List; import com.code2life.meet.dao.IEquipmentDao; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.code2life.meet.entity.Equipment; /** * 设备持久层dao接口实现 * @author Code2Life * */ public class EquipmentDaoImpl extends HibernateDaoSupport implements IEquipmentDao { /** * 添加 */ @Override public void addEquipment(Equipment equipment) throws Exception { this.getHibernateTemplate().save(equipment); } /** * 删除 */ @Override public void deleteEquipment(int id) throws Exception { Equipment equipment=this.getHibernateTemplate().load(Equipment.class, id); this.getHibernateTemplate().delete(equipment); } /** * 更新 */ @Override public void updateEquipment(Equipment equipment) throws Exception { this.getHibernateTemplate().update(equipment); } /** * 查找所有 */ @Override public List findAllEquipment() throws Exception { @SuppressWarnings("unchecked") List equipmentList=this.getHibernateTemplate().find("from Equipment"); return equipmentList; } /** * 查找单个 */ @Override public Equipment findByIdEquipment(int id) throws Exception { Equipment equipment=this.getHibernateTemplate().get(Equipment.class, id); return equipment; } }

services(业务)层MeetServiceImpl.java

package com.code2life.meet.service.impl; import java.util.List; import com.code2life.meet.dao.IMeetDao; import org.apache.commons.lang.StringUtils; import com.code2life.meet.entity.Meet; import com.code2life.meet.service.IMeetService; import com.code2life.meet.util.MeetPageBean; /** * 会议管理服务层service接口实现 * @author Code2Life * */ public class MeetServiceImpl implements IMeetService { private IMeetDao meetDao; /** * 添加 */ @Override public void addMeet(Meet meet) throws Exception { meetDao.addMeet(meet); } /** * 删除 */ @Override public void deleteMeet(int id) throws Exception { meetDao.deleteMeet(id); } /** * 更新 */ @Override public void updateMeet(Meet meet) throws Exception { meetDao.updateMeet(meet); } /** * 查找所有 */ @Override public List findAllMeet() throws Exception { return meetDao.findAllMeet(); } /** * 通过id查找 */ @Override public Meet findByIdMeet(int id) throws Exception { return meetDao.findByIdMeet(id); } public void setMeetDao(IMeetDao meetDao) { this.meetDao = meetDao; } /** * 分页查询 */ @Override public MeetPageBean queryForPage(int pageSize, int page) { // select * from user where oid not in (7) final String hql = "from Meet "; // 查询语句 int allRow = meetDao.getAllRowCount(hql); // 总记录数 int totalPage = MeetPageBean.countTatalPage(pageSize, allRow); // 总页数 final int offset = MeetPageBean.countOffset(pageSize, page); // 当前页开始记录 final int length = pageSize; // 每页记录数 final int currentPage = MeetPageBean.countCurrentPage(page); // 当前页 List list = meetDao.queryForPage(hql, offset, length); // // 把分页信息保存到Bean当中 MeetPageBean pageBean = new MeetPageBean(); pageBean.setPageSize(pageSize); pageBean.setCurrentPage(currentPage); pageBean.setAllRow(allRow); pageBean.setTotalPage(totalPage); pageBean.setList(list); pageBean.init(); return pageBean; } /** * 分页条件 */ @Override public MeetPageBean findByTJ(int pageSize, int page, String name) { StringBuilder hql = new StringBuilder("from Meet meet where 1=1 "); //查询语句 if (!StringUtils.isEmpty(name)) { hql.append(" and meet.meetname like '").append(name).append("%' "); } int allRow = meetDao.getAllRowCount(hql.toString(),name); //总记录数 int totalPage = MeetPageBean.countTatalPage(pageSize, allRow); //总页数 final int offset = MeetPageBean.countOffset(pageSize, page); //当前页开始记录 final int length = offset + pageSize; // 每页记录数 final int currentPage = MeetPageBean.countCurrentPage(page); // 当前页 List list = meetDao.findByTJ(hql.toString(), offset, length, name); // //把分页信息保存到Bean当中 MeetPageBean pageBean = new MeetPageBean(); pageBean.setPageSize(pageSize); pageBean.setCurrentPage(currentPage); pageBean.setAllRow(allRow); pageBean.setTotalPage(totalPage); pageBean.setList(list); pageBean.init(); return pageBean; } }

EquipmentServiceImpl.java

package com.code2life.meet.service.impl; import java.util.List; import com.code2life.meet.dao.IEquipmentDao; import com.code2life.meet.entity.Equipment; import com.code2life.meet.service.IEquipmentService; /** * 设备服务层service接口实现 * @author Code2Life * */ public class EquipmentServiceImpl implements IEquipmentService { private IEquipmentDao equipmentDao; /** * 添加 */ @Override public void addEquipment(Equipment equipment) throws Exception { equipmentDao.addEquipment(equipment); } /** * 删除 */ @Override public void deleteEquipment(int id) throws Exception { equipmentDao.deleteEquipment(id); } /** * 更新 */ @Override public void updateEquipment(Equipment equipment) throws Exception { equipmentDao.updateEquipment(equipment); } /** * 查找所有 */ @Override public List findAllEquipment() throws Exception { return equipmentDao.findAllEquipment(); } /** * 查找单个 */ @Override public Equipment findByIdEquipment(int id) throws Exception { return equipmentDao.findByIdEquipment(id); } public void setEquipmentDao(IEquipmentDao equipmentDao) { this.equipmentDao = equipmentDao; } }

action(控制)层:MeetAction.java

package com.code2life.meet.action; import java.util.List; import java.util.Map; import com.code2life.meet.service.IMeetService; import com.code2life.meet.util.MeetPageBean; import org.apache.struts2.interceptor.SessionAware; import com.code2life.meet.entity.Meet; import com.opensymphony.xwork2.ActionSupport; /** * 会议管理控制层 * @author Code2life * */ public class MeetAction extends ActionSupport implements SessionAware { /** * */ private static final long serialVersionUID = 1L; private IMeetService meetService; private Meet meet; private Map sessionMap; private int page = 1; //表示从网页中返回的当前页的值 默认为1 表示默认显示第一页内容 private MeetPageBean meetpageBean; //封装了分页信息和数据内容的pageBean private List listMeet;//用于储存pageBean当中被封装的User信息 /** * 添加 * @return * @throws Exception */ public String addMeet() throws Exception{ meetService.addMeet(meet); return "addMeet"; } /** * 删除 * @return * @throws Exception */ public String deleteMeet() throws Exception{ meetService.deleteMeet(meet.getMeetid()); return "deleteMeet"; } /** * 更新 * @return * @throws Exception */ public String updateMeet() throws Exception{ meetService.updateMeet(meet); return "updateMeet"; } /** * 通过id查找 * @return * @throws Exception */ public String findByIdMeet() throws Exception{ this.meet=meetService.findByIdMeet(meet.getMeetid()); return "findByIdMeet"; } /** * 查找所有 * @return * @throws Exception */ public String findAllMeet() throws Exception{ //List meetList=meetService.findAllMeet(); //sessionMap.put("meetList", meetList); this.meetpageBean = meetService.queryForPage(5, page);//获取封装了分页信息和数据的pageBean List meetList= this.meetpageBean.getList(); //获取数据 sessionMap.put("meetList", meetList); sessionMap.put("meetpageBean", meetpageBean); return "findAllMeet"; } /** * 条件查询 * @return * @throws Exception */ public String findByTJ() throws Exception{ this.meetpageBean=meetService.findByTJ(5, page, null == meet ? null : meet.getMeetname()); this.listMeet=this.meetpageBean.getList(); sessionMap.put("meetpageBean", meetpageBean); sessionMap.put("meetList", listMeet); return "findByTJ"; } public void setMeetService(IMeetService meetService) { this.meetService = meetService; } public Meet getMeet() { return meet; } public void setMeet(Meet meet) { this.meet = meet; } @Override public void setSession(Map sessionMap) { this.sessionMap=sessionMap; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public MeetPageBean getMeetpageBean() { return meetpageBean; } public void setMeetpageBean(MeetPageBean meetpageBean) { this.meetpageBean = meetpageBean; } public List getListMeet() { return listMeet; } public void setListMeet(List listMeet) { this.listMeet = listMeet; } }

EquipmentAction.java

package com.code2life.meet.action; import java.util.List; import java.util.Map; import com.code2life.meet.entity.Equipment; import com.code2life.meet.service.IEquipmentService; import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; /** * 设备控制层 * @author Code2life * */ public class EquipmentAction extends ActionSupport implements SessionAware { /** * */ private static final long serialVersionUID = 1L; private Map sessionMap; private Equipment equipment; private IEquipmentService equipmentService; /** * 添加 * @return * @throws Exception */ public String addEquipment() throws Exception{ if(equipment.getEquipmentid()==null){ equipmentService.addEquipment(equipment); }else{ updateEquipment(); } return "addEquipment"; } /** * 修改 * @return * @throws Exception */ public String updateEquipment() throws Exception{ equipmentService.updateEquipment(equipment); return "updateEquipment"; } /** * 删除 * @return * @throws Exception */ public String deleteEquipment() throws Exception{ equipmentService.deleteEquipment(equipment.getEquipmentid()); return "deleteEquipment"; } /** * 查找所有 * @return * @throws Exception */ public String findAllEquipment() throws Exception{ List equipmentList=equipmentService.findAllEquipment(); sessionMap.put("equipmentList", equipmentList); return "findAllEquipment"; } /** * 通过id查找 * @return * @throws Exception */ public String findByIdEquipment() throws Exception{ this.equipment=equipmentService.findByIdEquipment(equipment.getEquipmentid()); return "findByIdEquipment"; } public Equipment getEquipment() { return equipment; } public void setEquipment(Equipment equipment) { this.equipment = equipment; } public void setEquipmentService(IEquipmentService equipmentService) { this.equipmentService = equipmentService; } @Override public void setSession(Map sessionMap) { this.sessionMap=sessionMap; } }

structs配置文件:structs.xml

structs_meet.xml

/meetList.jsp /meet_findAllMeet.action /meet_findAllMeet.action /meet.jsp /meet_findAllMeet.action /meetList.jsp

写在最后

如果运行代码中遇到问题,欢迎和博主V交流

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Django中间件能够可视化应用程序的流量在Kibana中
下一篇:本框架结合了系统、微信、微博的提醒对话框各自的优点
相关文章

 发表评论

暂时没有评论,来抢沙发吧~