怎么样做在电脑买电(基于微信小程序的学生购电系统-计算机毕业设计源码+LW文档)
小程序开发说明
开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
小程序框架:uniapp
小程序开发软件:HBuilderX
小程序运行软件:微信开发者
关键逻辑代码:
/**
*电量信息
*后端接口
*@author
*@date2022-05-0912:09:29
*/
@RestController
@RequestMapping("/dianliangxinxi")
publicclassDianliangxinxiController{
@Autowired
privateDianliangxinxiServicedianliangxinxiService;
/**
*后端列表
*/
@RequestMapping("/page")
publicRpage(@RequestParamMap
HttpServletRequestrequest){
StringtableName=request.getSession().getAttribute("tableName").toString();
if(tableName.equals("xuesheng")){
dianliangxinxi.setXuehao((String)request.getSession().getAttribute("username"));
}
EntityWrapper
PageUtilspage=dianliangxinxiService.queryPage(params,MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew,dianliangxinxi),params),params));
returnR.ok().put("data",page);
}
/**
*前端列表
*/
@RequestMapping("/list")
publicRlist(@RequestParamMap
HttpServletRequestrequest){
StringtableName=request.getSession().getAttribute("tableName").toString();
if(tableName.equals("xuesheng")){
dianliangxinxi.setXuehao((String)request.getSession().getAttribute("username"));
}
EntityWrapper
PageUtilspage=dianliangxinxiService.queryPage(params,MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew,dianliangxinxi),params),params));
returnR.ok().put("data",page);
}
/**
*列表
*/
@RequestMapping("/lists")
publicRlist(DianliangxinxiEntitydianliangxinxi){
EntityWrapper
ew.allEq(MPUtil.allEQMapPre(dianliangxinxi,"dianliangxinxi"));
returnR.ok().put("data",dianliangxinxiService.selectListView(ew));
}
/**
*查询
*/
@RequestMapping("/query")
publicRquery(DianliangxinxiEntitydianliangxinxi){
EntityWrapper< DianliangxinxiEntity>ew=newEntityWrapper< DianliangxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre(dianliangxinxi,"dianliangxinxi"));
DianliangxinxiViewdianliangxinxiView=dianliangxinxiService.selectView(ew);
returnR.ok("查询电量信息成功").put("data",dianliangxinxiView);
}
/**
*后端详情
*/
@RequestMapping("/info/{id}")
publicRinfo(@PathVariable("id")Longid){
DianliangxinxiEntitydianliangxinxi=dianliangxinxiService.selectById(id);
returnR.ok().put("data",dianliangxinxi);
}
/**
*前端详情
*/
@RequestMapping("/detail/{id}")
publicRdetail(@PathVariable("id")Longid){
DianliangxinxiEntitydianliangxinxi=dianliangxinxiService.selectById(id);
returnR.ok().put("data",dianliangxinxi);
}
/**
*后端保存
*/
@RequestMapping("/save")
publicRsave(@RequestBodyDianliangxinxiEntitydianliangxinxi,HttpServletRequestrequest){
dianliangxinxi.setId(newDate().getTime()+newDouble(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(dianliangxinxi);
dianliangxinxiService.insert(dianliangxinxi);
returnR.ok();
}
/**
*前端保存
*/
@RequestMapping("/add")
publicRadd(@RequestBodyDianliangxinxiEntitydianliangxinxi,HttpServletRequestrequest){
dianliangxinxi.setId(newDate().getTime()+newDouble(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(dianliangxinxi);
dianliangxinxi.setUserid((Long)request.getSession().getAttribute("userId"));
dianliangxinxiService.insert(dianliangxinxi);
returnR.ok();
}
/**
*修改
*/
@RequestMapping("/update")
@Transactional
publicRupdate(@RequestBodyDianliangxinxiEntitydianliangxinxi,HttpServletRequestrequest){
//ValidatorUtils.validateEntity(dianliangxinxi);
dianliangxinxiService.updateById(dianliangxinxi);//全部更新
returnR.ok();
}
/**
*删除
*/
@RequestMapping("/delete")
publicRdelete(@RequestBodyLong[]ids){
dianliangxinxiService.deleteBatchIds(Arrays.asList(ids));
returnR.ok();
}