——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Node.js≥14
开发工具 后端:eclipse/idea/myeclipse/sts等均可配置运行 前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot民宿在线预定平台(java+springboot+maven+mybaits+vue+elementui+mysql)
技术栈
后端:SpringBoot+Mybaits
前端:Vue+elementui
管理员: admin 123456
用户: zhangwei 123456 wangfang 123456 liming 123456 chenyu 123456 liuyang 123456 zhaoxin 123456
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 } @RequestMapping("/detail/{id}") public R detail (@PathVariable("id") Long id) { CartEntity cart = cartService.selectById(id); return R.ok().put("data" , cart); } @RequestMapping("/save") public R save (@RequestBody CartEntity cart, HttpServletRequest request) { cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000 )).longValue()); cart.setUserid((Long)request.getSession().getAttribute("userId" )); cartService.insert(cart); return R.ok(); } @RequestMapping("/add") public R add (@RequestBody CartEntity cart, HttpServletRequest request) { cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000 )).longValue()); cartService.insert(cart); return R.ok(); } @RequestMapping("/update")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 @RequestMapping("/info/{id}") public R info (@PathVariable("id") String id) { UserEntity user = userService.selectById(id); return R.ok().put("data" , user); } @RequestMapping("/session") public R getCurrUser (HttpServletRequest request) { Long id = (Long)request.getSession().getAttribute("userId" ); UserEntity user = userService.selectById(id); return R.ok().put("data" , user); } @PostMapping("/save") public R save (@RequestBody UserEntity user) { if (userService.selectOne(new EntityWrapper<UserEntity>().eq("username" , user.getUsername())) !=null ) { return R.error("用户已存在" ); } userService.insert(user); return R.ok(); } @RequestMapping("/update") public R update (@RequestBody UserEntity user) { UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username" , user.getUsername())); if (u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) { return R.error("用户名已存在。" ); } userService.updateById(user); return R.ok();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 @RequestMapping("config") @RestController public class ConfigController { @Autowired private ConfigService configService; @RequestMapping("/page") public R page (@RequestParam Map<String, Object> params,ConfigEntity config) { EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); PageUtils page = configService.queryPage(params); return R.ok().put("data" , page); } @IgnoreAuth @RequestMapping("/list") public R list (@RequestParam Map<String, Object> params,ConfigEntity config) { EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); PageUtils page = configService.queryPage(params); return R.ok().put("data" , page); } @RequestMapping("/info/{id}") public R info (@PathVariable("id") String id) { ConfigEntity config = configService.selectById(id); return R.ok().put("data" , config);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 EntityWrapper< MinsufenleiEntity> ew = new EntityWrapper< MinsufenleiEntity>(); ew.allEq(MPUtil.allEQMapPre( minsufenlei, "minsufenlei" )); MinsufenleiView minsufenleiView = minsufenleiService.selectView(ew); return R.ok("查询民宿分类成功" ).put("data" , minsufenleiView); } @RequestMapping("/info/{id}") public R info (@PathVariable("id") Long id) { MinsufenleiEntity minsufenlei = minsufenleiService.selectById(id); return R.ok().put("data" , minsufenlei); } @RequestMapping("/detail/{id}") public R detail (@PathVariable("id") Long id) { MinsufenleiEntity minsufenlei = minsufenleiService.selectById(id); return R.ok().put("data" , minsufenlei); } @RequestMapping("/save") public R save (@RequestBody MinsufenleiEntity minsufenlei, HttpServletRequest request) { minsufenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000 )).longValue()); minsufenleiService.insert(minsufenlei); return R.ok(); } @RequestMapping("/add") public R add (@RequestBody MinsufenleiEntity minsufenlei, HttpServletRequest request) { minsufenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000 )).longValue()); minsufenleiService.insert(minsufenlei); return R.ok(); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Map<String, Object> param = new HashMap<String, Object>(); Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Object> entry = it.next(); String key = entry.getKey(); String newKey = entry.getKey(); if (pre.endsWith("." )) { newMap.put(pre + newKey, entry.getValue()); } else if (StringUtils.isEmpty(pre)) { newMap.put(newKey, entry.getValue()); } else { newMap.put(pre + "." + newKey, entry.getValue()); } } params.put("sort" , "clicknum" ); params.put("order" , "desc" ); PageUtils page = minsuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, minsuxinxi), params), params)); return R.ok().put("data" , page); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 public R list ( MinsufenleiEntity minsufenlei) { EntityWrapper<MinsufenleiEntity> ew = new EntityWrapper<MinsufenleiEntity>(); ew.allEq(MPUtil.allEQMapPre( minsufenlei, "minsufenlei" )); return R.ok().put("data" , minsufenleiService.selectListView(ew)); } @RequestMapping("/query") public R query (MinsufenleiEntity minsufenlei) { EntityWrapper< MinsufenleiEntity> ew = new EntityWrapper< MinsufenleiEntity>(); ew.allEq(MPUtil.allEQMapPre( minsufenlei, "minsufenlei" )); MinsufenleiView minsufenleiView = minsufenleiService.selectView(ew); return R.ok("查询民宿分类成功" ).put("data" , minsufenleiView); } @RequestMapping("/info/{id}") public R info (@PathVariable("id") Long id) { MinsufenleiEntity minsufenlei = minsufenleiService.selectById(id); return R.ok().put("data" , minsufenlei); } @RequestMapping("/detail/{id}") public R detail (@PathVariable("id") Long id) { MinsufenleiEntity minsufenlei = minsufenleiService.selectById(id); return R.ok().put("data" , minsufenlei); } @RequestMapping("/save") public R save (@RequestBody MinsufenleiEntity minsufenlei, HttpServletRequest request) {
——————————PayStart——————————
项目链接: https://javayms.github.io?id=101125140706201ru https://javayms.pages.dev?id=101125140706201ru