赞
踩
本系统为了解决客户的科学化管理,实现了基于客户的产品管理、销售订单管理以及公司员工管理,后台管理员管理等功能。
首页
产品列表
订单列表
员工列表
管理员列表
客户信息列表
本会议管理系统实现了以下功能:
1、首页统计可视化
2、员工管理
3、订单管理
4、客户管理
5、管理员列表
6、产品管理
数据库:mysql
开发工具:Eclipse(Myeclispe、Idea也可以)
知识点:SSM(spring+struts2+mybatis)
实体类
Customer.java
package com.chinasoft.ssm.domain; public class Customer { private String cus_no; private String cus_name; private String cus_birthday; private String cus_sex; private String cus_phone; private String cus_address; private String link_id; private String cus_rank; private String cus_company; private String emp_name; private String pro_name; public String getLink_id() { return link_id; } public void setLink_id(String link_id) { this.link_id = link_id; } public String getEmp_name() { return emp_name; } public void setEmp_name(String emp_name) { this.emp_name = emp_name; } public String getPro_name() { return pro_name; } public void setPro_name(String pro_name) { this.pro_name = pro_name; } public String getCus_no() { return cus_no; } public void setCus_no(String cus_no) { this.cus_no = cus_no; } public String getCus_name() { return cus_name; } public void setCus_name(String cus_name) { this.cus_name = cus_name; } public String getCus_birthday() { return cus_birthday; } public void setCus_birthday(String cus_birthday) { this.cus_birthday = cus_birthday; } public String getCus_sex() { return cus_sex; } public void setCus_sex(String cus_sex) { this.cus_sex = cus_sex; } public String getCus_phone() { return cus_phone; } public void setCus_phone(String cus_phone) { this.cus_phone = cus_phone; } public String getCus_address() { return cus_address; } public void setCus_address(String cus_address) { this.cus_address = cus_address; } public String getLink_no() { return link_id; } public void setLink_no(String link_no) { this.link_id = link_no; } public String getCus_rank() { return cus_rank; } public void setCus_rank(String cus_rank) { this.cus_rank = cus_rank; } public String getCus_company() { return cus_company; } public void setCus_company(String cus_company) { this.cus_company = cus_company; } }
Employee.java
package com.chinasoft.ssm.domain; public class Employee { private int id; private String emp_no; private String emp_name; private String emp_birthday; private String emp_sex; private String emp_dept; private String emp_sal; private String emp_phone; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getEmp_no() { return emp_no; } public void setEmp_no(String emp_no) { this.emp_no = emp_no; } public String getEmp_name() { return emp_name; } public void setEmp_name(String emp_name) { this.emp_name = emp_name; } public String getEmp_birthday() { return emp_birthday; } public void setEmp_birthday(String emp_birthday) { this.emp_birthday = emp_birthday; } public String getEmp_sex() { return emp_sex; } public void setEmp_sex(String emp_sex) { this.emp_sex = emp_sex; } public String getEmp_dept() { return emp_dept; } public void setEmp_dept(String emp_dept) { this.emp_dept = emp_dept; } public String getEmp_sal() { return emp_sal; } public void setEmp_sal(String emp_sal) { this.emp_sal = emp_sal; } public String getEmp_phone() { return emp_phone; } public void setEmp_phone(String emp_phone) { this.emp_phone = emp_phone; } @Override public String toString() { return "Employee [id=" + id + ", emp_no=" + emp_no + ", emp_name=" + emp_name + ", emp_birthday=" + emp_birthday + ", emp_sex=" + emp_sex + ", emp_dept=" + emp_dept + ", emp_sal=" + emp_sal + ", emp_phone=" + emp_phone + "]"; } }
Product.java
package com.chinasoft.ssm.domain; public class Product { private String pro_no; private String pro_name; private String pro_price; private String pro_discount; private String pro_desc; public String getPro_no() { return pro_no; } public void setPro_no(String pro_no) { this.pro_no = pro_no; } public String getPro_name() { return pro_name; } public void setPro_name(String pro_name) { this.pro_name = pro_name; } public String getPro_price() { return pro_price; } public void setPro_price(String pro_price) { this.pro_price = pro_price; } public String getPro_discount() { return pro_discount; } public void setPro_discount(String pro_discount) { this.pro_discount = pro_discount; } public String getPro_desc() { return pro_desc; } public void setPro_desc(String pro_desc) { this.pro_desc = pro_desc; } }
service
AdminManageServiceImpl.java
package com.chinasoft.ssm.admin.service.impl; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.chinasoft.ssm.admin.dao.IAdminManageDao; import com.chinasoft.ssm.admin.service.IAdminManageService; import com.chinasoft.ssm.domain.Customer; import com.chinasoft.ssm.domain.Orders; import com.chinasoft.ssm.domain.PageBean; import com.chinasoft.ssm.domain.Product; import com.chinasoft.ssm.domain.adminUser; /*声明 此处 是mvc模式中的 service中转层*/ @Service public class AdminManageServiceImpl implements IAdminManageService{ /*与往常一样 service要与dao层 起关系*/ @Autowired private IAdminManageDao adminDao; /*成员变量注解 就不用new实例化了*/ @Override public List<Map<String, Object>> selectUserAll() { return adminDao.selectUserAll(); } @Override public adminUser login(adminUser aUser) { // TODO Auto-generated method stub return adminDao.login(aUser); } /*获取客户信息分页*/ @Override public PageBean findUserByPage(Map<String, Object> map) { int currentPage = Integer.parseInt((String) map.get("currentPage")); int rows = Integer.parseInt((String) map.get("rows")); if(currentPage <=0) { currentPage = 1; } if(currentPage >=8) { currentPage = 8; } //3.调用dao查询总记录数 int totalCount = adminDao.findCustomerCount(map); // System.out.println("总数:"+totalCount); //5.计算总页码 int totalPage=1; if(totalCount!=0){ totalPage = (totalCount % rows) == 0 ? totalCount/rows : (totalCount/rows) + 1; } if(currentPage>=totalPage){ currentPage = totalPage; } //1.创建空的PageBean对象 PageBean pb = new PageBean(); //2.设置参数 pb.setCurrentPage(currentPage); pb.setRows(rows); //4.调用dao查询List集合 //计算开始的记录索引 int start = (currentPage - 1) * rows; map.put("start", start); List<Map<String,Object>> list = adminDao.findCustomerByPage(map); pb.setList(list); //5.计算总页码 pb.setTotalPage(totalPage); pb.setTotalCount(totalCount); return pb; } /*添加客户信息*/ @Override public void addCustomer(Map<String, Object> CustomerMap) { adminDao.addCustomer(CustomerMap); } /*通过客户编号获取信息,判断该用户是否已存在*/ @Override public int selectCus(String cusNo) { // TODO Auto-generated method stub return adminDao.selectCus(cusNo); } /*获取需要修改的用户的用户信息*/ @Override public Customer getEditCustomer(String cus_no) { // TODO Auto-generated method stub return adminDao.getEditCustomer(cus_no); } /*获取需要修改的管理员信息*/ @Override public adminUser getEditAdminInfo(String id) { // TODO Auto-generated method stub return adminDao.getEditAdminInfo(id); } /*获取需要修改的订单的信息*/ @Override public Orders getEditOrder(String order_no) { // TODO Auto-generated method stub return adminDao.getEditOrder(order_no); } /*修改用户信息*/ @Override public void updateCustomer(Map<String, Object> map) { // TODO Auto-generated method stub adminDao.updateCustomer(map); } /*修改管理员信息*/ @Override public void updateAdmin(Map<String, Object> map) { // TODO Auto-generated method stub adminDao.updateAdmin(map); } /*获取管理员信息*/ @Override public PageBean findAdminByPage(Map<String, Object> map) { int currentPage = Integer.parseInt((String) map.get("currentPage")); int rows = Integer.parseInt((String) map.get("rows")); if(currentPage <=0) { currentPage = 1; } if(currentPage >=8) { currentPage = 8; } //3.调用dao查询总记录数 int totalCount = adminDao.findAdminCount(map); // System.out.println("总数:"+totalCount); //5.计算总页码 int totalPage=1; if(totalCount!=0){ totalPage = (totalCount % rows) == 0 ? totalCount/rows : (totalCount/rows) + 1; } if(currentPage>=totalPage){ currentPage = totalPage; } //1.创建空的PageBean对象 PageBean pb = new PageBean(); //2.设置参数 pb.setCurrentPage(currentPage); pb.setRows(rows); //4.调用dao查询List集合 //计算开始的记录索引 int start = (currentPage - 1) * rows; map.put("start", start); List<Map<String,Object>> list = adminDao.findAdminByPage(map); pb.setList(list); //5.计算总页码 pb.setTotalPage(totalPage); pb.setTotalCount(totalCount); return pb; } /*添加管理员*/ @Override public void addAdmin(Map<String, Object> map) { // TODO Auto-generated method stub adminDao.addAdmin(map); } /*获取订单分页*/ @Override public PageBean findOrderByPage(Map<String, Object> map) { int currentPage = Integer.parseInt((String) map.get("currentPage")); int rows = Integer.parseInt((String) map.get("rows")); if(currentPage <=0) { currentPage = 1; } if(currentPage >=8) { currentPage = 8; } //3.调用dao查询总记录数 int totalCount = adminDao.findOrderCount(map); // System.out.println("总数:"+totalCount); //5.计算总页码 int totalPage=1; if(totalCount!=0){ totalPage = (totalCount % rows) == 0 ? totalCount/rows : (totalCount/rows) + 1; } if(currentPage>=totalPage){ currentPage = totalPage; } //1.创建空的PageBean对象 PageBean pb = new PageBean(); //2.设置参数 pb.setCurrentPage(currentPage); pb.setRows(rows); //4.调用dao查询List集合 //计算开始的记录索引 int start = (currentPage - 1) * rows; map.put("start", start); List<Map<String,Object>> list = adminDao.findOrderByPage(map); pb.setList(list); //5.计算总页码 pb.setTotalPage(totalPage); pb.setTotalCount(totalCount); return pb; } /* 获取修改产品信息 */ @Override public Product getEditProduct(String pro_no) { // TODO Auto-generated method stub return adminDao.getEditProduct(pro_no); } /* 修改产品信息 */ @Override public void updateProduct(Map<String, Object> map) { // TODO Auto-generated method stub adminDao.updateProduct(map); } /*添加产品信息*/ @Override public void addProduct(Map<String, Object> ProductMap) { adminDao.addProduct(ProductMap); } /*通过产品编号获取信息,判断该产品是否已存在*/ @Override public int selectPro(String proNo) { // TODO Auto-generated method stub return adminDao.selectPro(proNo); } @Override public void addOrder(Map<String, Object> map) { adminDao.addOrder(map); } /*更新订单*/ @Override public void updateOrder(Map<String, Object> map) { adminDao.updateOrder(map); } @Override public void delOrder(Map<String, Object> map) { // TODO Auto-generated method stub adminDao.delOrder(map); } /*获取产品信息 */ @Override public PageBean findProByPage(Map<String, Object> map) { int currentPage = Integer.parseInt((String) map.get("currentPage")); int rows = Integer.parseInt((String) map.get("rows")); if(currentPage <=0) { currentPage = 1; } if(currentPage >=8) { currentPage = 8; } //3.调用dao查询总记录数 int totalCount = adminDao.findProCount(map); // System.out.println("总数:"+totalCount); //5.计算总页码 int totalPage=1; if(totalCount!=0){ totalPage = (totalCount % rows) == 0 ? totalCount/rows : (totalCount/rows) + 1; } if(currentPage>=totalPage){ currentPage = totalPage; } //1.创建空的PageBean对象 PageBean pb = new PageBean(); //2.设置参数 pb.setCurrentPage(currentPage); pb.setRows(rows); //4.调用dao查询List集合 //计算开始的记录索引 int start = (currentPage - 1) * rows; map.put("start", start); List<Map<String,Object>> list = adminDao.findProByPage(map); pb.setList(list); //5.计算总页码 pb.setTotalPage(totalPage); pb.setTotalCount(totalCount); return pb; } }
EmployeeServiceImpl.java
package com.chinasoft.ssm.admin.service.impl; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.chinasoft.ssm.admin.dao.EmployeeDao; import com.chinasoft.ssm.admin.service.EmployeeService; import com.chinasoft.ssm.domain.Employee; import com.chinasoft.ssm.domain.PageBean; /*声明 此处 是mvc模式中的 service中转层*/ @Service public class EmployeeServiceImpl implements EmployeeService { @Autowired private EmployeeDao empDao; // 分页 @Override public PageBean findEmpByPage(Map<String, Object> map) { int currentPage = Integer.parseInt((String) map.get("currentPage")); int rows = Integer.parseInt((String) map.get("rows")); if (currentPage <= 0) { currentPage = 1; } if (currentPage >= 8) { currentPage = 8; } int start = (currentPage - 1) * rows; map.put("start", start); // 创建空的pagebean PageBean pb = new PageBean(); // 调用Dao查询总记录数 int totalCount = empDao.getTotalCount(map); pb.setTotalCount(totalCount); // 计算总页码数 int totalPage = 1; if (totalPage != 0) { totalPage = (totalCount % rows == 0) ? totalCount / rows : (totalCount / rows) + 1; } if (currentPage > totalPage) { currentPage = totalPage; } pb.setTotalPage(totalPage); // 调用Dao查询list集合 // 记录开始索引 List<Map<String, Object>> list = empDao.findEmpByPage(map); pb.setList(list); // 设置参数 pb.setCurrentPage(currentPage); pb.setRows(rows); return pb; } //添加客户 @Override public void addEmp(Map<String, Object> map) { empDao.addEmp(map); } //验证员工编号是否重复 @Override public int checkEmpno(String emp_no) { return empDao.checkEmpNo(emp_no); } //修改员工信息 @Override public void updateEmp(Map<String, Object> map) { empDao.updateEmp(map); } //获取将要编辑员工信息 @Override public Employee getEmpInfo(String emp_no) { return empDao.getEmpInfo(emp_no); } //删除员工 @Override public void delEmp(String id) { empDao.delEmp(id); } }
action
addAdminAction.java
package com.chinasoft.ssm.admin.action; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.ServletActionContext; import org.springframework.beans.factory.annotation.Autowired; import com.chinasoft.ssm.admin.service.IAdminManageService; import com.chinasoft.ssm.domain.PageBean; import com.opensymphony.xwork2.ActionSupport; public class addAdminAction extends ActionSupport{ @Autowired private IAdminManageService adminService; private HttpServletRequest request = ServletActionContext.getRequest(); public String addAdmin(){ //request.setCharacterEncoding("utf-8"); Map<String, String[]> parameterMap = request.getParameterMap(); Map<String ,Object> map=new HashMap<String ,Object>(); for (String i : parameterMap.keySet()) { //System.out.println(i+"===="+parameterMap.get(i)[0]); map.put(i, parameterMap.get(i)[0]); } adminService.addAdmin(map); request.setAttribute("mes", "添加成功"); return "addSucess"; } }
editCtmInfoAction.java
package com.chinasoft.ssm.admin.action; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.ServletActionContext; import org.springframework.beans.factory.annotation.Autowired; import com.chinasoft.ssm.admin.service.IAdminManageService; import com.chinasoft.ssm.domain.Customer; import com.opensymphony.xwork2.ActionSupport; public class editCtmInfoAction extends ActionSupport{ @Autowired private IAdminManageService adminService; private HttpServletRequest request = ServletActionContext.getRequest(); public String getInfo(){ String cus_no = request.getParameter("cus_no"); Customer customer=adminService.getEditCustomer(cus_no); request.getSession().setAttribute("editCtm", customer); return "toEditCtm"; } }
如果运行代码中遇到问题,或者需要完整源码和报告,可以加博主V交流:Code2Life2
觉得有用,记得一键三连哦!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。