分享一个餐饮连锁店点餐系统 餐馆食材采购系统Java、python、php三个版本(源码、调试、LW、开题、PPT)
/**
* 材料出库
* 后端接口
* @author
* @email
*/
@RestController
@RequestMapping("/cailiaochuku")
public class CailiaochukuController {
@Autowired
private CailiaochukuService cailiaochukuService;
/**
* 后台列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,CailiaochukuEntity cailiaochuku,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
cailiaochuku.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
PageUtils page = cailiaochukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cailiaochuku), params), params));
return R.ok().put("data", page);
}
/**
* 前台列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,CailiaochukuEntity cailiaochuku,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
cailiaochuku.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
PageUtils page = cailiaochukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cailiaochuku), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( CailiaochukuEntity cailiaochuku){
EntityWrapper<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
ew.allEq(MPUtil.allEQMapPre( cailiaochuku, "cailiaochuku"));
return R.ok().put("data", cailiaochukuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(CailiaochukuEntity cailiaochuku){
EntityWrapper< CailiaochukuEntity> ew = new EntityWrapper< CailiaochukuEntity>();
ew.allEq(MPUtil.allEQMapPre( cailiaochuku, "cailiaochuku"));
CailiaochukuView cailiaochukuView = cailiaochukuService.selectView(ew);
return R.ok("查询材料出库成功").put("data", cailiaochukuView);
}
/**
* 后台详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
CailiaochukuEntity cailiaochuku = cailiaochukuService.selectById(id);
return R.ok().put("data", cailiaochuku);
}
/**
* 前台详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
CailiaochukuEntity cailiaochuku = cailiaochukuService.selectById(id);
return R.ok().put("data", cailiaochuku);
}
/**
* 后台保存
*/
@RequestMapping("/save")
public R save(@RequestBody CailiaochukuEntity cailiaochuku, HttpServletRequest request){
//ValidatorUtils.validateEntity(cailiaochuku);
cailiaochuku.setUserid((Long)request.getSession().getAttribute("userId"));
cailiaochukuService.insert(cailiaochuku);
return R.ok();
}
/**
* 前台保存
*/
@RequestMapping("/add")
public R add(@RequestBody CailiaochukuEntity cailiaochuku, HttpServletRequest request){
//ValidatorUtils.validateEntity(cailiaochuku);
cailiaochuku.setUserid((Long)request.getSession().getAttribute("userId"));
cailiaochukuService.insert(cailiaochuku);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody CailiaochukuEntity cailiaochuku, HttpServletRequest request){
//ValidatorUtils.validateEntity(cailiaochuku);
cailiaochukuService.updateById(cailiaochuku);//全部更新
return R.ok();
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
cailiaochukuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}