这篇“Java怎么实现药店信息管理系统”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“Java怎么实现药店信息管理系统”文章吧。
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
药品相关的controller:
/** * 药品相关的controller */ @Controller @RequestMapping(value = "/druginfo") public class DruginfoController { @Autowired private IDruginfoService druginfoService; /** * 转向药品页面 */ @RequestMapping public String druginfo(){ return "/druginfo"; } /** * 分页查询药品列表 */ @RequestMapping(value = "/druginfoQueryPage") @ResponseBody public Object druginfoQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){ try{ IPage<Druginfo> iPage = druginfoService.selectDruginfoPage(pageNum,pageSize,param); return ResultMapUtil.getHashMapMysqlPage(iPage); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 转向药品新增页面 */ @RequestMapping(value = "/druginfoPage") public String druginfoPage(){ return "/druginfoPage"; } /** * 添加一个药品 */ @RequestMapping(value = "/druginfoAdd") @ResponseBody public Object druginfoAdd(Druginfo druginfo){ try{ int i = druginfoService.addDruginfo(druginfo); return ResultMapUtil.getHashMapSave(i); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 转向药品编辑页面 */ @RequestMapping(value = "/druginfoQueryById") public String druginfoQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){ Druginfo druginfo = druginfoService.queryDruginfoById(id); model.addAttribute("obj",druginfo); return "/druginfoPage"; } /** * 修改一个药品 */ @RequestMapping(value = "/druginfoEdit") @ResponseBody public Object druginfoEdit(Druginfo druginfo){ try{ int i = druginfoService.editDruginfo(druginfo); return ResultMapUtil.getHashMapSave(i); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 删除一个药品 */ @RequestMapping(value = "/druginfoDelById") @ResponseBody public Object druginfoDelById(Integer id){ try{ int i = druginfoService.delDruginfoById(id); return ResultMapUtil.getHashMapDel(i); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 获取所有药品 */ @RequestMapping(value = "/druginfoList") @ResponseBody public Object druginfoList(){ List<Druginfo> druginfoList = druginfoService.queryDruginfoList(); return ResultMapUtil.getHashMapList(druginfoList); } /** * 转向药品保质期检查页面 */ @RequestMapping(value = "/warranty") public String warranty(){ return "/warranty"; } }
用户相关的controller:
/** * 用户相关的controller */ @Controller public class UserController { /** * 转向登录页面 */ @RequestMapping(value = "/login") public String login(){ return "/login"; } /** * 判断用户登录是否成功 */ @RequestMapping(value = "/toLogin") @ResponseBody public Object toLogin(String username,String password){ if(username==null||password==null){ return ResultMapUtil.getHashMapLogin("用户名密码不能为空","2"); } Subject subject = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username,password); try{ subject.login(token); }catch (UnknownAccountException e){ return ResultMapUtil.getHashMapLogin("用户名不存在","2"); }catch (IncorrectCredentialsException e){ return ResultMapUtil.getHashMapLogin("密码错误","2"); } return ResultMapUtil.getHashMapLogin("验证成功","1"); } /** * 转向后台管理首页 */ @RequestMapping(value = "/index") public String index(){ return "/index"; } /** * 退出登录 */ @RequestMapping(value = "/logout") public String logout(){ Subject subject = SecurityUtils.getSubject(); subject.logout(); return "redirect:/login"; } }
药品出入库相关的controller:
/** * 药品出入库相关的controller */ @Controller @RequestMapping(value = "/owinfo") public class OwinfoController { @Autowired private IOwinfoService owinfoService; /** * 转向药品出入库页面 */ @RequestMapping public String owinfo(){ return "/owinfo"; } /** * 分页查询药品出入库列表 */ @RequestMapping(value = "/owinfoQueryPage") @ResponseBody public Object owinfoQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){ try{ IPage<Owinfo> iPage = owinfoService.selectOwinfoPage(pageNum,pageSize,param); return ResultMapUtil.getHashMapMysqlPage(iPage); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 转向药品出入库新增页面 */ @RequestMapping(value = "/owinfoPage") public String owinfoPage(){ return "/owinfoPage"; } /** * 添加一个药品出入库 */ @RequestMapping(value = "/owinfoAdd") @ResponseBody public Object owinfoAdd(Owinfo owinfo){ try{ owinfo.setCreatetime(new Date()); int i = owinfoService.addOwinfo(owinfo); return ResultMapUtil.getHashMapSave(i); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 转向药品出入库编辑页面 */ @RequestMapping(value = "/owinfoQueryById") public String owinfoQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){ Owinfo owinfo = owinfoService.queryOwinfoById(id); model.addAttribute("obj",owinfo); return "/owinfoPage"; } /** * 修改一个药品出入库 */ @RequestMapping(value = "/owinfoEdit") @ResponseBody public Object owinfoEdit(Owinfo owinfo){ try{ int i = owinfoService.editOwinfo(owinfo); return ResultMapUtil.getHashMapSave(i); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } /** * 删除一个药品出入库 */ @RequestMapping(value = "/owinfoDelById") @ResponseBody public Object owinfoDelById(Integer id){ try{ int i = owinfoService.delOwinfoById(id); return ResultMapUtil.getHashMapDel(i); } catch (Exception e){ return ResultMapUtil.getHashMapException(e); } } }
以上就是关于“Java怎么实现药店信息管理系统”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。