小程序开发说明
开发语言:Java 框架:ssm JDK版本:JDK1.8 服务器:tomcat7 数据库:mysql 5.7(一定要5.7版本) 数据库工具:Navicat11 开发软件:eclipse/myeclipse/idea Maven包:Maven3.3.9 浏览器:谷歌浏览器
小程序框架:uniapp 小程序开发软件:HBuilder X 小程序运行软件:微信开发者
关键逻辑代码:
/**
- 预约信息
- 后端接口
- @author
- @date 2022-03-04 19:59:21
*/
@RestController
@RequestMapping("/yuyuexinxi")
public class YuyuexinxiController {
@Autowired
private YuyuexinxiService yuyuexinxiService;
/**
- 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YuyuexinxiEntity yuyuexinxi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
yuyuexinxi.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yisheng")) {
yuyuexinxi.setYishenggonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper();
PageUtils page = yuyuexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuyuexinxi), params), params));
return R.ok().put("data", page); }
/**
- 前端列表 */ @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,YuyuexinxiEntity yuyuexinxi, HttpServletRequest request){ String tableName = request.getSession().getAttribute("tableName").toString(); if(tableName.equals("yonghu")) { yuyuexinxi.setYonghuzhanghao((String)request.getSession().getAttribute("username")); } if(tableName.equals("yisheng")) { yuyuexinxi.setYishenggonghao((String)request.getSession().getAttribute("username")); } EntityWrapper(); PageUtils page = yuyuexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuyuexinxi), params), params)); return R.ok().put("data", page); }
/**
- 列表 */ @RequestMapping("/lists") public R list( YuyuexinxiEntity yuyuexinxi){ EntityWrapper(); ew.allEq(MPUtil.allEQMapPre( yuyuexinxi, "yuyuexinxi")); return R.ok().put("data", yuyuexinxiService.selectListView(ew)); }
/**
- 查询 */ @RequestMapping("/query") public R query(YuyuexinxiEntity yuyuexinxi){ EntityWrapper< YuyuexinxiEntity> ew = new EntityWrapper< YuyuexinxiEntity>(); ew.allEq(MPUtil.allEQMapPre( yuyuexinxi, "yuyuexinxi")); YuyuexinxiView yuyuexinxiView = yuyuexinxiService.selectView(ew); return R.ok("查询预约信息成功").put("data", yuyuexinxiView); }
/**
- 后端详情 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ YuyuexinxiEntity yuyuexinxi = yuyuexinxiService.selectById(id); return R.ok().put("data", yuyuexinxi); }
/**
- 前端详情 */ @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") Long id){ YuyuexinxiEntity yuyuexinxi = yuyuexinxiService.selectById(id); return R.ok().put("data", yuyuexinxi); }
/**
- 后端保存 */ @RequestMapping("/save") public R save(@RequestBody YuyuexinxiEntity yuyuexinxi, HttpServletRequest request){ yuyuexinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(yuyuexinxi); yuyuexinxiService.insert(yuyuexinxi); return R.ok(); }
/**
- 前端保存 */ @RequestMapping("/add") public R add(@RequestBody YuyuexinxiEntity yuyuexinxi, HttpServletRequest request){ yuyuexinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(yuyuexinxi); yuyuexinxi.setUserid((Long)request.getSession().getAttribute("userId")); yuyuexinxiService.insert(yuyuexinxi); return R.ok(); }
/**
- 修改 */ @RequestMapping("/update") public R update(@RequestBody YuyuexinxiEntity yuyuexinxi, HttpServletRequest request){ //ValidatorUtils.validateEntity(yuyuexinxi); yuyuexinxiService.updateById(yuyuexinxi);//全部更新 return R.ok(); }