項目描述
臨近學期結束,開始畢業設計制作,你還在做java程序網絡編程,期末作業,老師的作業要求覺的困難嗎?不知道畢業設計該怎么辦?網頁功能的數量是否太多?沒有合適的類型或系統?等等。今天給大家介紹一篇基于Java的民宿管理系統設計與實現。
功能需求
系統分為用戶系統和后臺管理系統,兩個系統分別部署提高安全性。為了讓系統的編碼可以順利進行,特意對本系統功能進行細分設計,設計的系統功能結構見下圖。
部分效果圖
部分代碼
/*** 用戶* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/yonghu")
public class YonghuController {private static final Logger logger = LoggerFactory.getLogger(YonghuController.class);@Autowiredprivate YonghuService yonghuService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//級聯表service/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不會進入");else if("用戶".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));params.put("yonghuDeleteStart",1);params.put("yonghuDeleteEnd",1);if(params.get("orderBy")==null || params.get("orderBy")==""){params.put("orderBy","id");}PageUtils page = yonghuService.queryPage(params);//字典表數據轉換List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list){//修改對應字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端詳情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity轉viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把實體數據重構到view中//修改對應字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到數據");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永遠不會進入");Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).andNew().eq("yonghu_delete", 1);logger.info("sql語句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setYonghuDelete(1);yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"賬戶或者手機號已經被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永遠不會進入");//根據字段查詢是否有相同數據Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().notIn("id",yonghu.getId()).andNew().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).andNew().eq("yonghu_delete", 1);logger.info("sql語句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if("".equals(yonghu.getYonghuPhoto()) || "null".equals(yonghu.getYonghuPhoto())){yonghu.setYonghuPhoto(null);}if(yonghuEntity==null){yonghuService.updateById(yonghu);//根據id更新return R.ok();}else {return R.error(511,"賬戶或者手機號已經被使用");}}/*** 刪除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());ArrayList<YonghuEntity> list = new ArrayList<>();for(Integer id:ids){YonghuEntity yonghuEntity = new YonghuEntity();yonghuEntity.setId(id);yonghuEntity.setYonghuDelete(2);list.add(yonghuEntity);}if(list != null && list.size() >0){yonghuService.updateBatchById(list);}return R.ok();}
安裝部署需求
idea運行啟動
系統部署
系統開發后,在生產環境配置項目運行環境,具體步驟如下:
安裝linux或者windows10操作系統;
安裝JDK1.8并配置環境變量;
安裝MySQL5.7版本以上版本數據庫,創建數據庫并執行腳本創建表;
在idea中運行打包;
本項目用到的技術和框架
1.開發語言:Java
2.開發模式:B/S
3.數據庫:MySQL5.7
4.框架:SpringBoot+vue
本項目中的關鍵點
此系統的開發采用java語言開發,基于B/S結構,這些開發環境使系統更加完善。使用到的工具和技術都是開源免費的。
環境工具
開發工具 IDEA
語言 JDK1.8 、SpringBoot、vue
硬件:筆記本電腦;
軟件:Tomcat8.0 Web服務器、Navicat數據庫客戶端、MySQL;
操作系統:Windows 10;
其它軟件:截圖工具、常用瀏覽器;
以上是本系統的部分功能展示,如果你的選題正好相符,那么可以做畢業設計或課程設計使用。