




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
附錄附錄A用戶控制器代碼@RestController@RequestMapping("/yonghu")publicclassYonghuController{@AutowiredprivateYonghuServiceyonghuService;@AutowiredprivateTokenServicetokenService;/登錄/@IgnoreAuth@RequestMapping(value="/login")publicRlogin(Stringusername,Stringpassword,Stringcaptcha,HttpServletRequestrequest){YonghuEntityuser=yonghuService.selectOne(newEntityWrapper<YonghuEntity>().eq("zhanghao",username));if(user==null||!user.getMima().equals(password)){returnR.error("賬號或密碼不正確");}Stringtoken=tokenService.generateToken(user.getId(),username,"yonghu","用戶");returnR.ok().put("token",token);}/注冊/@IgnoreAuth@RequestMapping("/register")publicRregister(@RequestBodyYonghuEntityyonghu){//ValidatorUtils.validateEntity(yonghu);YonghuEntityuser=yonghuService.selectOne(newEntityWrapper<YonghuEntity>().eq("zhanghao",yonghu.getZhanghao()));if(user!=null){returnR.error("注冊用戶已存在");}LonguId=newDate().getTime();yonghu.setId(uId);yonghuService.insert(yonghu);returnR.ok();}/退出/@RequestMapping("/logout")publicRlogout(HttpServletRequestrequest){request.getSession().invalidate();returnR.ok("退出成功");}/獲取用戶的session用戶信息/@RequestMapping("/session")publicRgetCurrUser(HttpServletRequestrequest){Longid=(Long)request.getSession().getAttribute("userId");YonghuEntityuser=yonghuService.selectById(id);returnR.ok().put("data",user);}/密碼重置/@IgnoreAuth@RequestMapping(value="/resetPass")publicRresetPass(Stringusername,HttpServletRequestrequest){YonghuEntityuser=yonghuService.selectOne(newEntityWrapper<YonghuEntity>().eq("zhanghao",username));if(user==null){returnR.error("賬號不存在");}user.setMima("123456");yonghuService.updateById(user);returnR.ok("密碼已重置為:123456");}/后端列表/@RequestMapping("/page")publicRpage(@RequestParamMap<String,Object>params,YonghuEntityyonghu,HttpServletRequestrequest){EntityWrapper<YonghuEntity>ew=newEntityWrapper<YonghuEntity>();PageUtilspage=yonghuService.queryPage(params,MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew,yonghu),params),params));returnR.ok().put("data",page);}/前端列表/@RequestMapping("/list")publicRlist(@RequestParamMap<String,Object>params,YonghuEntityyonghu,HttpServletRequestrequest){EntityWrapper<YonghuEntity>ew=newEntityWrapper<YonghuEntity>();PageUtilspage=yonghuService.queryPage(params,MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew,yonghu),params),params));returnR.ok().put("data",page);}/列表/@RequestMapping("/lists")publicRlist(YonghuEntityyonghu){EntityWrapper<YonghuEntity>ew=newEntityWrapper<YonghuEntity>();ew.allEq(MPUtil.allEQMapPre(yonghu,"yonghu"));returnR.ok().put("data",yonghuService.selectListView(ew));}/查詢/@RequestMapping("/query")publicRquery(YonghuEntityyonghu){EntityWrapper<YonghuEntity>ew=newEntityWrapper<YonghuEntity>();ew.allEq(MPUtil.allEQMapPre(yonghu,"yonghu"));YonghuViewyonghuView=yonghuService.selectView(ew);returnR.ok("查詢用戶成功").put("data",yonghuView);}/后端詳情/@RequestMapping("/info/{id}")publicRinfo(@PathVariable("id")Longid){YonghuEntityyonghu=yonghuService.selectById(id);returnR.ok().put("data",yonghu);}/前端詳情/@RequestMapping("/detail/{id}")publicRdetail(@PathVariable("id")Longid){YonghuEntityyonghu=yonghuService.selectById(id);returnR.ok().put("data",yonghu);}/后端保存/@RequestMapping("/save")publicRsave(@RequestBodyYonghuEntityyonghu,HttpServletRequestrequest){yonghu.setId(newDate().getTime()+newDouble(Math.floor(Math.random()1000)).longValue());//ValidatorUtils.validateEntity(yonghu);YonghuEntityuser=yonghuService.selectOne(newEntityWrapper<YonghuEntity>().eq("zhanghao",yonghu.getZhanghao()));if(user!=null){returnR.error("用戶已存在");}yonghu.setId(newDate().getTime());yonghuService.insert(yonghu);returnR.ok();}/前端保存/@RequestMapping("/add")publicRadd(@RequestBodyYonghuEntityyonghu,HttpServletRequestrequest){yonghu.setId(newDate().getTime()+newDouble(Math.floor(Math.random()1000)).longValue());//ValidatorUtils.validateEntity(yonghu);YonghuEntityuser=yonghuService.selectOne(newEntityWrapper<YonghuEntity>().eq("zhanghao",yonghu.getZhanghao()));if(user!=null){returnR.error("用戶已存在");}yonghu.setId(newDate().getTime());yonghuService.insert(yonghu);returnR.ok();}/修改/@RequestMapping("/update")publicRupdate(@RequestBodyYonghuEntityyonghu,HttpServletRequestrequest){//ValidatorUtils.validateEntity(yonghu);yonghuService.updateById(yonghu);//全部更新returnR.ok();}/刪除/@RequestMapping("/delete")publicRdelete(@RequestBodyLong[]ids){yonghuService.deleteBatchIds(Arrays.asList(ids));returnR.ok();}/提醒接口/@RequestMapping("/remind/{columnName}/{type}")publicRremindCount(@PathVariable("columnName")StringcolumnName,HttpServletRequestrequest,@PathVariable("type")Stringtype,@RequestParamMap<String,Object>map){map.put("column",columnName);map.put("type",type);if(type.equals("2")){SimpleDateFormatsdf=newSimpleDateFormat("yyyy-MM-dd");Calendarc=Calendar.getInstance();DateremindStartDate=null;DateremindEndDate=null;if(map.get("remindstart")!=null){IntegerremindStart=Integer.parseInt(map.get("remindstart").toString());c.setTime(newDate());c.add(Calendar.DAY_OF_MONTH,remindStart);remindStartDate=c.getTime();map.put("remindstart",sdf.format(remindStartDate));}
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 腦血管造影術簡介及術后護理
- 口服藥相關知識培訓課件
- 2025年度企業(yè)研發(fā)項目保密協(xié)議與技術成果權歸屬合同
- 2025年學生校園體育設施租賃與使用合作協(xié)議
- 2025年跨境電商全程物流與供應鏈綜合管理服務協(xié)議書
- 2025年農產品溯源體系建設與采購合作合同模板
- 2025年學生托管與心理輔導一體化服務合同
- 2025年度特色酒店客房租賃管理服務合同
- 2025年度科技企業(yè)融資策劃及服務合同范本
- 2025年度新能源電動汽車租賃服務合同
- 新學期-啟航出發(fā)-2025-2026學年初一上學期新生開學第一課主題班會
- 節(jié)假日值班人員安排管理制度
- 2025年新版《食品安全法》知識競賽試題(附答案)
- 2025至2030中國保護器行業(yè)發(fā)展趨勢分析與未來投資戰(zhàn)略咨詢研究報告
- 學堂在線 高職實綜合英語 章節(jié)測試答案
- 勞動教育主題活動課說課稿
- 八年級英語備課組教學工作計劃范文
- 2025年電商行業(yè)直播帶貨研究報告:直播電商產業(yè)鏈分析
- 企業(yè)工程管理辦法
- 小學生美術國畫課件
- 2025年秋數學(新)人教版三年級上課件:第1課時 觀察物體
評論
0/150
提交評論