基于javaweb+mysql的ssm校园快递物流管理系统(java+jsp+ssm+javabean+mysql+tomcat)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
内容:源码+数据库脚本+论文
本系统采用SSM框架和MySQL数据库进行开发实现。
本系统实现了三大模块:
管理员模块具备快递人员管理、物流订单管理、取件发件管理以及系统其他配置功能;
用户模块具备发布代取件、送件信息管理、评价功能和查询订单功能等;
快递员模块具备物流订单管理功能和公告功能。
管理员
用户
快递员
技术框架
JavaBean JSP SSM(Spring SpringMVC MyBatis) MySQL Bootstrap JavaScript CSS
基于javaweb+mysql的SSM校园快递物流管理系统(java+jsp+ssm+javabean+mysql+tomcat)
// --------------------------------------- 华丽分割线 ------------------------------//
/**
* 分页查询 返回list对象(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/list.action")
public String list(User user, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
Pager<User> pagers = userDao.findByEntity(user);
model.addAttribute("pagers", pagers);
return "admin/user/user_list";
}
/**
* 跳转添加页面
*/
@RequestMapping(value = "/add.action")
public String add(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
return "admin/user/user_add";
}
/**
* 跳至修改页面
*
* @return
*/
@RequestMapping(value = "/edit.action")
public String edit(Integer id, Model model) {
User bean = userDao.load(id);
model.addAttribute("bean", bean);
return "admin/user/user_edit";
}
/**
* 添加信息保存
*/
@RequestMapping(value = "/save.action")
public String save(User user, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
userDao.insert(user);
return "redirect:/user/list.action";
}
return "common/succ";
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Order order, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Order> pagers = orderDao.findByEntity(order);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", order);
return jsonObject.toString();
}
// --------------------------------------- 华丽分割线------------------------------ //
}
@Controller
@RequestMapping(value = "/gonggao")
public class GonggaoController extends BaseController{
/**
* 依赖注入 start dao/===
@Controller
@RequestMapping(value = "/yuangong")
public class YuangongController extends BaseController{
/**
* 依赖注入 start dao/===
*/
@Autowired
private YuangongDaoImpl yuangongDao;
public YuangongDaoImpl getYuangongDao() {
return yuangongDao;
}
public void setYuangongDao(YuangongDaoImpl yuangongDao) {
this.yuangongDao = yuangongDao;
}
// --------------------------------------- 华丽分割线 ------------------------------//
/**
* 分页查询 返回list对象(通过对象)
admin.setUsername(userName);
admin.setUserpwd(userPw);
Pager<Admin> pagers = adminDao.findByEntity(admin);
if (pagers.getTotal() == 0) {
request.setAttribute("msg", "用户名或者密码错误!");
return "login";
} else {
admin = (Admin) pagers.getDatas().get(0);
session.setAttribute("userType", 0);
session.setAttribute("admin", admin);
return "admin/index";
}
}
if (userType == 1)//用户登录
{
Yuangong user = new Yuangong();
user.setLoginname(userName);
user.setPwd(userPw);
Pager<Yuangong> pagers = yuangongDao.findByEntity(user);
if (pagers.getTotal() == 0) {
request.setAttribute("msg", "用户名或者密码错误!");
return "login";
} else {
user = (Yuangong) pagers.getDatas().get(0);
session.setAttribute("userType", 1);
session.setAttribute("yuangong", user);
return "admin/index";
}
}
if (userType == 2)//用户登录
{
User user = new User();
user.setLoginname(userName);
user.setPwd(userPw);
Pager<User> pagers = userDao.findByEntity(user);
if (pagers.getTotal() == 0) {
request.setAttribute("msg", "用户名或者密码错误!");
return "login";
} else {
user = (User) pagers.getDatas().get(0);
session.setAttribute("userType", 2);
/**
* 保存修改信息
*/
@RequestMapping(value = "/update.action")
public String update(Yuangong yuangong, Model model, HttpServletRequest request, HttpServletResponse response) {
yuangongDao.update(yuangong);
return "redirect:/yuangong/list.action";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/del.action")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
// 真正删除
yuangongDao.deleteById(id);
// 状态删除
// Yuangong yuangong = yuangongDao.load(id);
// load.setDel(1);
// yuangongDao.update(load);
return "redirect:/yuangong/list.action";
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Yuangong yuangong, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Yuangong> pagers = yuangongDao.findByEntity(yuangong);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", yuangong);
return jsonObject.toString();
}
}
@Controller
@RequestMapping(value = "/dqorder")
public class DqorderController extends BaseController{
/**
* 依赖注入 start dao/===
*/
@Autowired
private DqorderDaoImpl dqorderDao;
public DqorderDaoImpl getDqorderDao() {
return dqorderDao;
}
public void setDqorderDao(DqorderDaoImpl dqorderDao) {
this.dqorderDao = dqorderDao;
}
// --------------------------------------- 华丽分割线 ------------------------------//
/**
* 分页查询 返回list对象(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/list.action")
public String list(Dqorder dqorder, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
Pager<Dqorder> pagers = dqorderDao.findByEntity(dqorder);
model.addAttribute("pagers", pagers);
return "admin/dqorder/dqorder_list";
}
/**
* 分页查询 返回list对象(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/list2.action")
public String list2(Dqorder dqorder, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
Pager<Dqorder> pagers = dqorderDao.findByEntity(dqorder);
model.addAttribute("pagers", pagers);
return "admin/dqorder/dqorder_list2";
}
/**
@Controller
@RequestMapping(value = "/order")
public class OrderController extends BaseController{
/**
* 依赖注入 start dao/===
*/
@Autowired
private OrderDaoImpl orderDao;
public OrderDaoImpl getOrderDao() {
return orderDao;
}
public void setOrderDao(OrderDaoImpl orderDao) {
this.orderDao = orderDao;
}
// --------------------------------------- 华丽分割线 ------------------------------//
/**
* 分页查询 返回list对象(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/list.action")
public String list(Order order, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
Pager<Order> pagers = orderDao.findByEntity(order);
model.addAttribute("pagers", pagers);
return "admin/order/order_list";
}
/**
* 跳转添加页面
*/
@RequestMapping(value = "/add.action")
/**
* 保存修改信息
*/
@RequestMapping(value = "/update1.action")
public String update1(Dqorder dqorder, Model model, HttpServletRequest request, HttpServletResponse response) {
Dqorder dqordertt = new Dqorder();
dqordertt.setYid(dqorder.getYid());
dqordertt.setYname(dqorder.getYname());
Pager<Dqorder> pagers = dqorderDao.findByEntity1(dqordertt);
if(pagers.getDatas().size() > 0){
model.addAttribute("msg", "用户评分太低不能接单");
return "common/succ";
}
dqorderDao.update(dqorder);
model.addAttribute("msg", "操作成功");
return "common/succ";
}
/**
* 保存修改信息
*/
@RequestMapping(value = "/update.action")
public String update(Dqorder dqorder, Model model, HttpServletRequest request, HttpServletResponse response) {
dqorderDao.update(dqorder);
// return "redirect:/dqorder/list.action";
model.addAttribute("msg", "操作成功");
return "common/succ";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/del.action")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
// 真正删除
dqorderDao.deleteById(id);
// 状态删除
// Dqorder dqorder = dqorderDao.load(id);
admin.setUsername(userName);
admin.setUserpwd(userPw);
Pager<Admin> pagers = adminDao.findByEntity(admin);
if (pagers.getTotal() == 0) {
request.setAttribute("msg", "用户名或者密码错误!");
return "login";
} else {
admin = (Admin) pagers.getDatas().get(0);
session.setAttribute("userType", 0);
session.setAttribute("admin", admin);
return "admin/index";
}
}
if (userType == 1)//用户登录
{
Yuangong user = new Yuangong();
user.setLoginname(userName);
user.setPwd(userPw);
Pager<Yuangong> pagers = yuangongDao.findByEntity(user);
if (pagers.getTotal() == 0) {
request.setAttribute("msg", "用户名或者密码错误!");
return "login";
} else {
user = (Yuangong) pagers.getDatas().get(0);
session.setAttribute("userType", 1);
session.setAttribute("yuangong", user);
return "admin/index";
}
}
if (userType == 2)//用户登录
{
User user = new User();
user.setLoginname(userName);
user.setPwd(userPw);
Pager<User> pagers = userDao.findByEntity(user);
if (pagers.getTotal() == 0) {
request.setAttribute("msg", "用户名或者密码错误!");
return "login";
} else {
user = (User) pagers.getDatas().get(0);
session.setAttribute("userType", 2);
session.setAttribute("user", user);
return "admin/index";
}
}
return "admin/index";
return "admin/order/order_list";
}
/**
* 跳转添加页面
*/
@RequestMapping(value = "/add.action")
public String add(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
return "admin/order/order_add";
}
/**
* 跳至修改页面
*
* @return
*/
@RequestMapping(value = "/edit.action")
public String edit(Integer id, Model model) {
Order bean = orderDao.load(id);
model.addAttribute("bean", bean);
return "admin/order/order_edit";
}
/**
* 添加信息保存
*/
@RequestMapping(value = "/save.action")
public String save(Order order, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
orderDao.insert(order);
model.addAttribute("msg", "订单创建成功");
return "common/succ";
}
/**
* 保存修改信息
*/
@RequestMapping(value = "/update.action")
public String update(Order order, Model model, HttpServletRequest request, HttpServletResponse response) {
orderDao.update(order);
model.addAttribute("msg", "订单修改成功");
return "common/succ";
}
/**
* 删除通过主键
* @return
*/
// --------------------------------------- 华丽分割线------------------------------ //
}
@Controller
@RequestMapping(value = "/order")
public class OrderController extends BaseController{
/**
* 依赖注入 start dao/===
*/
@Autowired
private OrderDaoImpl orderDao;
public OrderDaoImpl getOrderDao() {
return orderDao;
}
public void setOrderDao(OrderDaoImpl orderDao) {
this.orderDao = orderDao;
}
// --------------------------------------- 华丽分割线 ------------------------------//
/**
* 分页查询 返回list对象(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/list.action")
public String list(Order order, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
Pager<Order> pagers = orderDao.findByEntity(order);
/**
* 保存修改信息
*/
@RequestMapping(value = "/update.action")
public String update(Yuangong yuangong, Model model, HttpServletRequest request, HttpServletResponse response) {
yuangongDao.update(yuangong);
return "redirect:/yuangong/list.action";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/del.action")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
// 真正删除
yuangongDao.deleteById(id);
// 状态删除
// Yuangong yuangong = yuangongDao.load(id);
// load.setDel(1);
// yuangongDao.update(load);
return "redirect:/yuangong/list.action";
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Yuangong yuangong, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Yuangong> pagers = yuangongDao.findByEntity(yuangong);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", yuangong);
return jsonObject.toString();
}
}
// load.setDel(1);
// orderDao.update(load);
// return "redirect:/order/list.action";
model.addAttribute("msg", "订单删除成功");
return "common/succ";
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Order order, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Order> pagers = orderDao.findByEntity(order);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", order);
return jsonObject.toString();
}
// --------------------------------------- 华丽分割线------------------------------ //
}
@Controller
@RequestMapping(value = "/gonggao")
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/del.action")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
// 真正删除
dqorderDao.deleteById(id);
// 状态删除
// Dqorder dqorder = dqorderDao.load(id);
// load.setDel(1);
// dqorderDao.update(load);
return "redirect:/dqorder/list.action";
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Dqorder dqorder, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Dqorder> pagers = dqorderDao.findByEntity(dqorder);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", dqorder);
return jsonObject.toString();
}
// --------------------------------------- 华丽分割线------------------------------ //
}
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", admin);
return jsonObject.toString();
}
}
@Controller
@RequestMapping(value = "/user")
public class UserController extends BaseController{
/**
* 依赖注入 start dao/===
*/
@Autowired
private UserDaoImpl userDao;
public UserDaoImpl getUserDao() {
return userDao;
}
public void setUserDao(UserDaoImpl userDao) {
this.userDao = userDao;
}
// --------------------------------------- 华丽分割线 ------------------------------//
/**
* 分页查询 返回list对象(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/list.action")
public String list(User user, Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
Pager<User> pagers = userDao.findByEntity(user);
model.addAttribute("pagers", pagers);
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Yuangong yuangong, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Yuangong> pagers = yuangongDao.findByEntity(yuangong);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", yuangong);
return jsonObject.toString();
}
}
@Controller
public class LoginController extends BaseController{
@Autowired
private AdminDaoImpl adminDao;
public AdminDaoImpl getAdminDao() {
return adminDao;
}
gonggaoDao.deleteById(id);
// 状态删除
// Gonggao gonggao = gonggaoDao.load(id);
// load.setDel(1);
// gonggaoDao.update(load);
return "redirect:/gonggao/list.action";
}
// --------------------------------------- 华丽分割线------------------------------------------------------//
/**
* 分页查询 返回list json(通过对象)
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj.json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntity(Gonggao gonggao, Model model, HttpServletRequest request, HttpServletResponse response) {
// 分页查询
Pager<Gonggao> pagers = gonggaoDao.findByEntity(gonggao);
JSONObject jsonObject = JsonUtil2.getJsonObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", gonggao);
return jsonObject.toString();
}
// --------------------------------------- 华丽分割线------------------------------ //
}