——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Node.js≥14
开发工具 后端:eclipse/idea/myeclipse/sts等均可配置运行 前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot旅游推荐系统旅游信息管理系统(java+springboot+maven+vue+elementui+mysql)
/TravelSystem
管理员: admin 123456
用户: a1 123456 a2 123456 a3 123456
后端启动类:StartApplication 前端启动命令:npm run serve
——————————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 42 43 44 45 46 47 48 49 50 @IgnoreAuth @RequestMapping("/list") public R list (@RequestParam Map<String, Object> params, HttpServletRequest request) { logger.debug("list方法:,,Controller:{},,params:{}" ,this .getClass().getName(),JSONObject.toJSONString(params)); if (StringUtil.isEmpty(String.valueOf(params.get("orderBy" )))){ params.put("orderBy" ,"id" ); } PageUtils page = forumService.queryPage(params); List<ForumView> list =(List<ForumView>)page.getList(); for (ForumView c:list) dictionaryService.dictionaryConvert(c, request); return R.ok().put("data" , page); } @RequestMapping("/detail/{id}") public R detail (@PathVariable("id") Long id, HttpServletRequest request) { logger.debug("detail方法:,,Controller:{},,id:{}" ,this .getClass().getName(),id); ForumEntity forum = forumService.selectById(id); if (forum !=null ){ ForumView view = new ForumView(); BeanUtils.copyProperties( forum , view ); YonghuEntity yonghu = yonghuService.selectById(forum.getYonghuId()); if (yonghu != null ){ BeanUtils.copyProperties( yonghu , view ,new String[]{ "id" , "createDate" }); view.setYonghuId(yonghu.getId()); } UsersEntity users = usersService.selectById(forum.getUsersId()); if (users != null ){ view.setUsersId(users.getId()); view.setUusername(users.getUsername()); view.setUpassword(users.getPassword()); view.setUrole(users.getRole()); view.setUaddtime(users.getAddtime()); }
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 @Autowired private TokenService tokenService;@Autowired private DictionaryService dictionaryService;@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 ){ YonghuView view = new YonghuView(); BeanUtils.copyProperties( yonghu , view ); dictionaryService.dictionaryConvert(view, request);
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 51 52 53 * 批量上传 */ @RequestMapping("/batchInsert") public R save ( String fileName) { logger.debug("batchInsert方法:,,Controller:{},,fileName:{}" ,this .getClass().getName(),fileName); try { List<NewsEntity> newsList = new ArrayList<>(); Map<String, List<String>> seachFields= new HashMap<>(); Date date = new Date(); int lastIndexOf = fileName.lastIndexOf("." ); if (lastIndexOf == -1 ){ return R.error(511 ,"该文件没有后缀" ); }else { String suffix = fileName.substring(lastIndexOf); if (!".xls" .equals(suffix)){ return R.error(511 ,"只支持后缀为xls的excel文件" ); }else { URL resource = this .getClass().getClassLoader().getResource("static/upload/" + fileName); File file = new File(resource.getFile()); if (!file.exists()){ return R.error(511 ,"找不到上传文件,请联系管理员" ); }else { List<List<String>> dataList = PoiUtil.poiImport(file.getPath()); dataList.remove(0 ); for (List<String> data:dataList){ NewsEntity newsEntity = new NewsEntity(); newsList.add(newsEntity); } newsService.insertBatch(newsList); return R.ok(); } } } }catch (Exception e){ return R.error(511 ,"批量插入数据异常,请联系管理员" ); } }
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 * 后端接口 * @email */ @RestController @Controller @RequestMapping("/lvyouluxianLiuyan") public class LvyouluxianLiuyanController { private static final Logger logger = LoggerFactory.getLogger(LvyouluxianLiuyanController.class); @Autowired private LvyouluxianLiuyanService lvyouluxianLiuyanService; @Autowired private TokenService tokenService; @Autowired private DictionaryService dictionaryService; @Autowired private LvyouluxianService lvyouluxianService; @Autowired private YonghuService yonghuService; @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" )); if (params.get("orderBy" )==null || params.get("orderBy" )=="" ){ params.put("orderBy" ,"id" ); } PageUtils page = lvyouluxianLiuyanService.queryPage(params); List<LvyouluxianLiuyanView> list =(List<LvyouluxianLiuyanView>)page.getList(); for (LvyouluxianLiuyanView c:list){ dictionaryService.dictionaryConvert(c, request); } 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 44 45 46 47 48 49 logger.info("sql语句:" +queryWrapper.getSqlSegment()); LvyouluxianEntity lvyouluxianEntity = lvyouluxianService.selectOne(queryWrapper); if ("" .equals(lvyouluxian.getLvyouluxianPhoto()) || "null" .equals(lvyouluxian.getLvyouluxianPhoto())){ lvyouluxian.setLvyouluxianPhoto(null ); } if (lvyouluxianEntity==null ){ lvyouluxianService.updateById(lvyouluxian); 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()); lvyouluxianService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } @RequestMapping("/batchInsert") public R save ( String fileName) { logger.debug("batchInsert方法:,,Controller:{},,fileName:{}" ,this .getClass().getName(),fileName); try { List<LvyouluxianEntity> lvyouluxianList = new ArrayList<>(); Map<String, List<String>> seachFields= new HashMap<>(); Date date = new Date(); int lastIndexOf = fileName.lastIndexOf("." ); if (lastIndexOf == -1 ){ return R.error(511 ,"该文件没有后缀" ); }else { String suffix = fileName.substring(lastIndexOf); if (!".xls" .equals(suffix)){ return R.error(511 ,"只支持后缀为xls的excel文件" ); }else { URL resource = this .getClass().getClassLoader().getResource("static/upload/" + fileName); File file = new File(resource.getFile()); if (!file.exists()){ return R.error(511 ,"找不到上传文件,请联系管理员" ); }else { List<List<String>> dataList = PoiUtil.poiImport(file.getPath()); dataList.remove(0 );
——————————PayStart——————————
项目链接: https://javayms.github.io?id=330925580706201qc https://javayms.pages.dev?id=330925580706201qc