基于java SpringBoot框架和Vue的智能停车场管理系统icon
来源:安防百科 /
时间: 2024-05-24
public class CarManageController { @Autowired private CarManageService carManageService; @Autowired private CarManageRepository carManageRepository; /** * 列表 */ @PostMapping("list") @RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) public Result list(CarManage entity){ return carManageService.list(entity); } /** * 获取 */ @PostMapping("get") @RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) public Result get(Long id){ CarManage entity = carManageRepository.findById(id).orElse(new CarManage()); return Result.ok(entity); } /** * 保存 */ @PostMapping("save") @RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) public Result save(@RequestBody CarManage entity){ return carManageService.save(entity); } /** * 删除 */ @PostMapping("delete") @RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) public Result delete(Long id){ carManageRepository.deleteById(id); return Result.ok(); } /** * 续租 */ @PostMapping("renew") @RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) public Result renew(@RequestBody Order entity){ return carManageService.renew(entity); } /** * 导出 */ @PostMapping("export") @RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) public void export(Long orgId,Long parkManageId,HttpServletRequest request, HttpServletResponse response){ try{ ExcelExport excelExport = carManageService.exportData(orgId,parkManageId); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); excelExport.writeTemplate(response, request, "车辆信息-" + sdf.format(new Date()) + ".xls"); }catch (Exception e){ e.printStackTrace(); } }}