• 大小: 15.4MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-26
  • 语言: Java
  • 标签: SSM  

资源简介

前两个系列我们介绍了Servlet+Jsp和SSH框架开发的Cupboard化学药品管理平台,此篇我们介绍以SSM框架(Spring+SpringMVC+Mybatis)对此项目的开发。

资源截图

代码片段和文件信息

package com.rclv.controller;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.rclv.pojo.Agents;
import com.rclv.pojo.PageBean;
import com.rclv.pojo.User;
import com.rclv.service.AgentsService;

@Controller
@RequestMapping(“/agents“)
public class AgentsController {

// @Autowired形式注入AgentsService。
@Autowired
private AgentsService agentsService;

// 分页查询药品。访问路径:http://localhost/cup_ssm/agents/list.action 
@RequestMapping(“/list“)
public String list(HttpServletRequest request) throws Exception {

int currPage = Integer.parseInt(request.getParameter(“currPage“));
int pageSize=12;

//2.调用agentsService中的方法, 返回一个PageBean
PageBean agentsBean=agentsService.findAgentsByPage(currPagepageSize);

//3.将结果放入request中,请求转发
request.setAttribute(“ab“ agentsBean);
return “agents_list“;
}

// 添加药品。访问路径:http://localhost/cup_ssm/agents/add.action 
@RequestMapping(“/add“)
public String add(User user Agents agents HttpServletRequest request) throws Exception {
// 1.获取session域中的User对象,若user为空,则跳转到msg.jsp页面
user = (User) request.getSession().getAttribute(“user“);
if(user == null) {
request.setAttribute(“msg“ “请先登录“);
return “msg“;
}

// 2.设置药品入库日期,并设置入库人
agents.setAdate(new Date());
agents.setUser(user);

// 3.调用service层方法,完成添加操作,并重定向到list.action
agentsService.add(agents);
return “redirect:/agents/list.action?currPage=1“;
}

// 损耗更新。访问路径:http://localhost/cup_ssm/agents/update.action 
@RequestMapping(“/update“)
public String update(HttpServletRequest request) throws Exception {
// 1.获取药品aid、药品原有数量、药品损耗数量
int oAid = Integer.parseInt(request.getParameter(“oAid“));
int oCount = Integer.parseInt(request.getParameter(“oCount“));
int dif = Integer.parseInt(request.getParameter(“dif“));

// 2。计算现有数量
int nCount = oCount - dif;

// 3.调用service层方法完成更新操作,并重定向到list.action
agentsService.update(oAid nCount);
return “redirect:/agents/list.action?currPage=1“;
}


}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        887  2018-06-11 21:34  cup_ssm\.classpath

     文件        907  2018-06-11 21:32  cup_ssm\.project

     文件        567  2018-06-11 21:32  cup_ssm\.settings\.jsdtscope

     文件        364  2018-06-11 21:32  cup_ssm\.settings\org.eclipse.jdt.core.prefs

     文件        550  2018-06-11 21:34  cup_ssm\.settings\org.eclipse.wst.common.component

     文件        345  2018-06-11 21:32  cup_ssm\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-06-11 21:32  cup_ssm\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-06-11 21:32  cup_ssm\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       2138  2018-07-27 15:57  cup_ssm\build\classes\ApplicationContext-dao.xml

     文件       1196  2018-07-27 15:57  cup_ssm\build\classes\ApplicationContext-service.xml

     文件       1874  2018-07-27 11:19  cup_ssm\build\classes\ApplicationContext-trans.xml

     文件       2649  2018-08-21 20:35  cup_ssm\build\classes\com\rclv\controller\AgentsController.class

     文件       1495  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\controller\converter\CustomGlobalStrToDateConverter.class

     文件       2541  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\controller\UserController.class

     文件        439  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\dao\AgentsMapper.class

     文件       2679  2018-08-21 20:58  cup_ssm\build\classes\com\rclv\dao\AgentsMapper.xml

     文件        249  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\dao\UserMapper.class

     文件        598  2018-07-27 16:19  cup_ssm\build\classes\com\rclv\dao\UserMapper.xml

     文件       3544  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\pojo\Agents.class

     文件       2189  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\pojo\PageBean.class

     文件       1859  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\pojo\User.class

     文件        420  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\service\AgentsService.class

     文件       1790  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\service\AgentsServiceImpl.class

     文件        288  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\service\UserService.class

     文件       1017  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\service\UserServiceImpl.class

     文件       1223  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\test\TimeTest.class

     文件       1561  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\utils\MD5Utils.class

     文件       2032  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\utils\UploadUtils.class

     文件        943  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\utils\UUIDUtils.class

     文件       1414  2018-08-21 09:22  cup_ssm\build\classes\com\rclv\web\filter\EncodingFilter.class

............此处省略150个文件信息

评论

共有 条评论