您好,登錄后才能下訂單哦!
這篇“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。