需求
接到一个单子,要求完成一个课设网站,前后端都要有,收费300元。
需求分析
用到的技术栈:
前端:springboot+vue+layui+maven+mysql
后台:spring+jsp+tomcat8+mysql
1.前端选择已经开发好的模版直接改几处细节就行
2.创建一个并点击勾选志愿者管理系统后台的各种属性,代码生成器勾选增删改查等条件,然后自动生成即可。
部分代码
controller层:
/** * 新闻资讯 * 后端接口 * @author * @email * @date 2022-03-15 20:26:16 */ @RestController @RequestMapping("/news") public class NewsController { @Autowired private NewsService newsService; /** * 后端列表 */ @RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){ EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); return R.ok().put("data", page); } /** * 前端列表 */ @IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){ EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); return R.ok().put("data", page); } /** * 列表 */ @RequestMapping("/lists") public R list( NewsEntity news){ EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); ew.allEq(MPUtil.allEQMapPre( news, "news")); return R.ok().put("data", newsService.selectListView(ew)); } /** * 查询 */ @RequestMapping("/query") public R query(NewsEntity news){ EntityWrapper< NewsEntity> ew = new EntityWrapper< NewsEntity>(); ew.allEq(MPUtil.allEQMapPre( news, "news")); NewsView newsView = newsService.selectView(ew); return R.ok("查询新闻资讯成功").put("data", newsView); } /** * 后端详情 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ NewsEntity news = newsService.selectById(id); return R.ok().put("data", news); } /** * 前端详情 */ @IgnoreAuth @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") Long id){ NewsEntity news = newsService.selectById(id); return R.ok().put("data", news); } /** * 后端保存 */ @RequestMapping("/save") public R save(@RequestBody NewsEntity news, HttpServletRequest request){ news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(news); newsService.insert(news); return R.ok(); } /** * 前端保存 */ @RequestMapping("/add") public R add(@RequestBody NewsEntity news, HttpServletRequest request){ news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(news); newsService.insert(news); return R.ok(); } /** * 修改 */ @RequestMapping("/update") public R update(@RequestBody NewsEntity news, HttpServletRequest request){ //ValidatorUtils.validateEntity(news); newsService.updateById(news);//全部更新 return R.ok(); } /** * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ newsService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } /** * 提醒接口 */ @RequestMapping("/remind/{columnName}/{type}") public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) { map.put("column", columnName); map.put("type", type); if(type.equals("2")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); Date remindStartDate = null; Date remindEndDate = null; if(map.get("remindstart")!=null) { Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart); remindStartDate = c.getTime(); map.put("remindstart", sdf.format(remindStartDate)); } if(map.get("remindend")!=null) { Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindEnd); remindEndDate = c.getTime(); map.put("remindend", sdf.format(remindEndDate)); } } Wrapper<NewsEntity> wrapper = new EntityWrapper<NewsEntity>(); if(map.get("remindstart")!=null) { wrapper.ge(columnName, map.get("remindstart")); } if(map.get("remindend")!=null) { wrapper.le(columnName, map.get("remindend")); } int count = newsService.selectCount(wrapper); return R.ok().put("count", count); } }
<!-- 首页 --> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>首页</title> <link rel="stylesheet" href="./layui/css/layui.css"> <!-- 样式 --> <link rel="stylesheet" href="./css/style.css" /> <!-- 主题(主要颜色设置) --> <link rel="stylesheet" href="./css/theme.css" /> <!-- 通用的css --> <link rel="stylesheet" href="./css/common.css" /> </head> <body scrolling="no" style="overflow-y: hidden;overflow-x: hidden;"> <!-- 顶部导航栏 --> <header id="header"> <div class="top"> <div class="logo"> <a href="#"> {{systemName}} </a> </div> <div class="tel-container"> <img style="margin-right: 30px;" src="img/index_icon.png" > <div class="tel"> <div>全国服务热线:</div> <div>9999-888-999</div> </div> </div> </div> <ul class="layui-nav nav"> <li class="layui-nav-item"><a href="javascript:navPage('./pages/home/home.html')">首页</a></li> <li v-for="(item,index) in indexNav" v-bind:key="index" class="layui-nav-item"><a :href="'javascript:navPage(\''+item.url+'\')'">{{item.name}}</a></li> <li class="layui-nav-item"> <a href="javascript:centerPage();">我的</a
效果
视频演示
志愿者管理网站前端+后端
回应质疑:
在第一篇我说的200元接了一单HDFS文件管理器的私活,在文章中就有说之前做了类似直接拿了交付就是了,200元算是白捡的,当然这也是需要用时间积累做过那么多单,总有几单拿成品转手直接卖定制的价格,这也是接单的小技巧,下方有原文链接:
https://blog.csdn.net/xianyu120/article/details/125508845
总结
以上就是用代码生成器生成志愿者管理系统后台的分享,用代码生成器自动化完成不需要你懂的敲代码,还是那句话接私活不能让你大富大贵,平时赚点零花钱还是很轻松的,想要接私活或者对代码生成器有想法的小伙伴可以点击下方的卡片与我联系。