🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
目录
1.技术选型
2.数据库表结构
3.开发工具
4.功能
4.1【角色】
4.2【前台功能模块】
4.3【后台功能模块】
5.项目演示截图
5.1 首页
5.2 立即预订
5.3 预约详情
5.4 个人中心
5.5 车位管理
5.6 车位预订管理
5.7 违规管理
5.8 员工管理
5.9 车辆管理
5.10 基础数据管理
6.数据库文件设计
7.核心代码
7.1 车位预订Controller
7.2 车位预订Service
7.3 车位预订ServiceImpl
7.4 车位预订DAO
8.参考文档
1.技术选型
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
2.数据库表结构
11张
3.开发工具
idea、navicat、vscode
4.功能
4.1【角色】
超级管理员、管理员、用户
4.2【前台功能模块】
- 登录注册
- 首页
- 车位
- 公告
- 个人中心(个人中心、车辆、车位预定、违规)
4.3【后台功能模块】
- 登录
- 首页
- 个人中心
- 管理员管理
- 员工管理
- 用户管理
- 车辆管理
- 车位管理
- 车位预订管理
- 公告管理
- 违规管理
- 基础数据管理
- 轮播图管理
5.项目演示截图
5.1 首页
5.2 立即预订
5.3 预约详情
5.4 个人中心
5.5 车位管理
5.6 车位预订管理
5.7 违规管理
5.8 员工管理
5.9 车辆管理
5.10 基础数据管理
6.数据库文件设计
CREATE TABLE `cheliang` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`cheliang_name` varchar(200) DEFAULT NULL COMMENT '车辆名称 Search111 ',`cheliang_uuid_number` varchar(200) DEFAULT NULL COMMENT '车辆编号',`cheliang_photo` varchar(200) DEFAULT NULL COMMENT '车辆照片',`cheliang_paizhao` varchar(200) DEFAULT NULL COMMENT '车辆牌照',`cheliang_file` varchar(200) DEFAULT NULL COMMENT '车牌',`cheliang_types` int(11) DEFAULT NULL COMMENT '车辆类型 Search111',`cheliang_content` longtext COMMENT '车辆介绍 ',`cheliang_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='车辆';CREATE TABLE `chewei` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`chewei_name` varchar(200) DEFAULT NULL COMMENT '车位名称 Search111 ',`chewei_uuid_number` varchar(200) DEFAULT NULL COMMENT '车位编号',`chewei_photo` varchar(200) DEFAULT NULL COMMENT '车位照片',`chewei_address` varchar(200) DEFAULT NULL COMMENT '车位地点',`chewei_tingchefei` decimal(10,2) DEFAULT NULL COMMENT '金额/小时 ',`chewei_types` int(11) DEFAULT NULL COMMENT '车位类型 Search111',`chewei_content` longtext COMMENT '车位介绍 ',`shangxia_types` int(11) DEFAULT NULL COMMENT '是否上架 ',`chewei_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',PRIMARY KEY (`id`)
)CREATE TABLE `config` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`name` varchar(100) NOT NULL COMMENT '配置参数名称',`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';CREATE TABLE `dictionary` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`dic_code` varchar(200) DEFAULT NULL COMMENT '字段',`dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',`code_index` int(11) DEFAULT NULL COMMENT '编码',`index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',`super_id` int(11) DEFAULT NULL COMMENT '父字段id',`beizhu` varchar(200) DEFAULT NULL COMMENT '备注',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COMMENT='字典';CREATE TABLE `gonggao` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`gonggao_name` varchar(200) DEFAULT NULL COMMENT '公告名称 Search111 ',`gonggao_photo` varchar(200) DEFAULT NULL COMMENT '公告图片 ',`gonggao_types` int(11) NOT NULL COMMENT '公告类型 Search111 ',`insert_time` timestamp NULL DEFAULT NULL COMMENT '发布时间',`gonggao_content` longtext COMMENT '公告详情 ',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='公告';CREATE TABLE `token` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`userid` bigint(20) NOT NULL COMMENT '儿童id',`username` varchar(100) NOT NULL COMMENT '儿童名',`tablename` varchar(100) DEFAULT NULL COMMENT '表名',`role` varchar(100) DEFAULT NULL COMMENT '角色',`token` varchar(200) NOT NULL COMMENT '密码',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',`expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='token表';CREATE TABLE `users` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(100) NOT NULL COMMENT '儿童名',`password` varchar(100) NOT NULL COMMENT '密码',`role` varchar(100) DEFAULT '管理员' COMMENT '角色',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员';CREATE TABLE `weigui` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`cheliang_id` int(11) DEFAULT NULL COMMENT '车辆',`weigui_name` varchar(200) DEFAULT NULL COMMENT '违规名称 Search111 ',`weigui_uuid_number` varchar(200) DEFAULT NULL COMMENT '违规编号',`weigui_photo` varchar(200) DEFAULT NULL COMMENT '违规照片',`weigui_address` varchar(200) DEFAULT NULL COMMENT '违规地点',`weigui_types` int(11) DEFAULT NULL COMMENT '违规类型 Search111',`weigui_content` longtext COMMENT '违规介绍 ',`weigui_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='违规';CREATE TABLE `yonghu` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(200) DEFAULT NULL COMMENT '账户',`password` varchar(200) DEFAULT NULL COMMENT '密码',`yonghu_uuid_number` varchar(200) DEFAULT NULL COMMENT '用户编号 Search111 ',`yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',`yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',`yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',`yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',`sex_types` int(11) DEFAULT NULL COMMENT '性别',`yonghu_email` varchar(200) DEFAULT NULL COMMENT '用户邮箱',`new_money` decimal(10,2) DEFAULT NULL COMMENT '余额 ',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';CREATE TABLE `yuangong` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(200) DEFAULT NULL COMMENT '账户',`password` varchar(200) DEFAULT NULL COMMENT '密码',`yuangong_uuid_number` varchar(200) DEFAULT NULL COMMENT '员工编号 Search111 ',`yuangong_name` varchar(200) DEFAULT NULL COMMENT '员工姓名 Search111 ',`yuangong_phone` varchar(200) DEFAULT NULL COMMENT '员工手机号',`yuangong_id_number` varchar(200) DEFAULT NULL COMMENT '员工身份证号',`yuangong_photo` varchar(200) DEFAULT NULL COMMENT '员工头像',`sex_types` int(11) DEFAULT NULL COMMENT '性别',`yuangong_email` varchar(200) DEFAULT NULL COMMENT '员工邮箱',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 ',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='员工';
7.核心代码
7.1 车位预订Controller
package com.controller;/*** 车位预订* 后端接口* @author 计算机编程-吉哥* @email
*/
@RestController
@Controller
@RequestMapping("/cheweiYuyue")
public class CheweiYuyueController {private static final Logger logger = LoggerFactory.getLogger(CheweiYuyueController.class);private static final String TABLE_NAME = "cheweiYuyue";@Autowiredprivate CheweiYuyueService cheweiYuyueService;@Autowiredprivate TokenService tokenService;@Autowiredprivate CheliangService cheliangService;//车辆@Autowiredprivate CheweiService cheweiService;//车位@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate GonggaoService gonggaoService;//公告@Autowiredprivate WeiguiService weiguiService;//违规@Autowiredprivate YonghuService yonghuService;//用户@Autowiredprivate YuangongService yuangongService;//员工@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));else if("员工".equals(role))params.put("yuangongId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = cheweiYuyueService.queryPage(params);//字典表数据转换List<CheweiYuyueView> list =(List<CheweiYuyueView>)page.getList();for(CheweiYuyueView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);CheweiYuyueEntity cheweiYuyue = cheweiYuyueService.selectById(id);if(cheweiYuyue !=null){//entity转viewCheweiYuyueView view = new CheweiYuyueView();BeanUtils.copyProperties( cheweiYuyue , view );//把实体数据重构到view中//级联表 车位//级联表CheweiEntity chewei = cheweiService.selectById(cheweiYuyue.getCheweiId());if(chewei != null){BeanUtils.copyProperties( chewei , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setCheweiId(chewei.getId());}//级联表 车辆//级联表CheliangEntity cheliang = cheliangService.selectById(cheweiYuyue.getCheliangId());if(cheliang != null){BeanUtils.copyProperties( cheliang , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setCheliangId(cheliang.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody CheweiYuyueEntity cheweiYuyue, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,cheweiYuyue:{}",this.getClass().getName(),cheweiYuyue.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<CheweiYuyueEntity> queryWrapper = new EntityWrapper<CheweiYuyueEntity>().eq("chewei_id", cheweiYuyue.getCheweiId()).eq("cheliang_id", cheweiYuyue.getCheliangId()).eq("chewei_yuyue_shichang", cheweiYuyue.getCheweiYuyueShichang()).in("chewei_yuyue_yesno_types", new Integer[]{1,2});logger.info("sql语句:"+queryWrapper.getSqlSegment());CheweiYuyueEntity cheweiYuyueEntity = cheweiYuyueService.selectOne(queryWrapper);if(cheweiYuyueEntity==null){cheweiYuyue.setInsertTime(new Date());cheweiYuyue.setCheweiYuyueYesnoTypes(1);cheweiYuyue.setCreateTime(new Date());cheweiYuyueService.insert(cheweiYuyue);return R.ok();}else {if(cheweiYuyueEntity.getCheweiYuyueYesnoTypes()==1)return R.error(511,"有相同的待审核的数据");else if(cheweiYuyueEntity.getCheweiYuyueYesnoTypes()==2)return R.error(511,"有相同的审核通过的数据");elsereturn R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody CheweiYuyueEntity cheweiYuyue, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,cheweiYuyue:{}",this.getClass().getName(),cheweiYuyue.toString());CheweiYuyueEntity oldCheweiYuyueEntity = cheweiYuyueService.selectById(cheweiYuyue.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");if("".equals(cheweiYuyue.getCheweiYuyueText()) || "null".equals(cheweiYuyue.getCheweiYuyueText())){cheweiYuyue.setCheweiYuyueText(null);}if("".equals(cheweiYuyue.getCheweiYuyueFile()) || "null".equals(cheweiYuyue.getCheweiYuyueFile())){cheweiYuyue.setCheweiYuyueFile(null);}if("".equals(cheweiYuyue.getCheweiYuyueYesnoText()) || "null".equals(cheweiYuyue.getCheweiYuyueYesnoText())){cheweiYuyue.setCheweiYuyueYesnoText(null);}cheweiYuyueService.updateById(cheweiYuyue);//根据id更新return R.ok();}/*** 审核*/@RequestMapping("/shenhe")public R shenhe(@RequestBody CheweiYuyueEntity cheweiYuyueEntity, HttpServletRequest request){logger.debug("shenhe方法:,,Controller:{},,cheweiYuyueEntity:{}",this.getClass().getName(),cheweiYuyueEntity.toString());CheweiYuyueEntity oldCheweiYuyue = cheweiYuyueService.selectById(cheweiYuyueEntity.getId());//查询原先数据CheweiEntity cheweiEntity = cheweiService.selectById(oldCheweiYuyue.getCheweiId());if(cheweiYuyueEntity.getCheweiYuyueYesnoTypes() == 2){//通过cheweiEntity.setShangxiaTypes(2);cheweiService.updateById(cheweiEntity);cheweiYuyueEntity.setCheweiYuyueShenheTime(new Date());//审核时间cheweiYuyueService.updateById(cheweiYuyueEntity);//审核return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<CheweiYuyueEntity> oldCheweiYuyueList =cheweiYuyueService.selectBatchIds(Arrays.asList(ids));//要删除的数据cheweiYuyueService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<CheweiYuyueEntity> cheweiYuyueList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环CheweiYuyueEntity cheweiYuyueEntity = new CheweiYuyueEntity();//把要查询是否重复的字段放入map中//报名编号if(seachFields.containsKey("cheweiYuyueUuidNumber")){List<String> cheweiYuyueUuidNumber = seachFields.get("cheweiYuyueUuidNumber");cheweiYuyueUuidNumber.add(data.get(0));//要改的}else{List<String> cheweiYuyueUuidNumber = new ArrayList<>();cheweiYuyueUuidNumber.add(data.get(0));//要改的seachFields.put("cheweiYuyueUuidNumber",cheweiYuyueUuidNumber);}}//查询是否重复//报名编号List<CheweiYuyueEntity> cheweiYuyueEntities_cheweiYuyueUuidNumber = cheweiYuyueService.selectList(new EntityWrapper<CheweiYuyueEntity>().in("chewei_yuyue_uuid_number", seachFields.get("cheweiYuyueUuidNumber")));if(cheweiYuyueEntities_cheweiYuyueUuidNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(CheweiYuyueEntity s:cheweiYuyueEntities_cheweiYuyueUuidNumber){repeatFields.add(s.getCheweiYuyueUuidNumber());}return R.error(511,"数据库的该表中的 [报名编号] 字段已经存在 存在数据为:"+repeatFields.toString());}cheweiYuyueService.insertBatch(cheweiYuyueList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = cheweiYuyueService.queryPage(params);//字典表数据转换List<CheweiYuyueView> list =(List<CheweiYuyueView>)page.getList();for(CheweiYuyueView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Integer id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);CheweiYuyueEntity cheweiYuyue = cheweiYuyueService.selectById(id);if(cheweiYuyue !=null){//entity转viewCheweiYuyueView view = new CheweiYuyueView();BeanUtils.copyProperties( cheweiYuyue , view );//把实体数据重构到view中//级联表CheweiEntity chewei = cheweiService.selectById(cheweiYuyue.getCheweiId());if(chewei != null){BeanUtils.copyProperties( chewei , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney"});//把级联的数据添加到view中,并排除id和创建时间字段view.setCheweiId(chewei.getId());}//级联表CheliangEntity cheliang = cheliangService.selectById(cheweiYuyue.getCheliangId());if(cheliang != null){BeanUtils.copyProperties( cheliang , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney"});//把级联的数据添加到view中,并排除id和创建时间字段view.setCheliangId(cheliang.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody CheweiYuyueEntity cheweiYuyue, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,cheweiYuyue:{}",this.getClass().getName(),cheweiYuyue.toString());Wrapper<CheweiYuyueEntity> queryWrapper = new EntityWrapper<CheweiYuyueEntity>().eq("chewei_yuyue_uuid_number", cheweiYuyue.getCheweiYuyueUuidNumber()).eq("chewei_id", cheweiYuyue.getCheweiId()).eq("cheliang_id", cheweiYuyue.getCheliangId()).eq("chewei_yuyue_text", cheweiYuyue.getCheweiYuyueText()).eq("chewei_yuyue_shichang", cheweiYuyue.getCheweiYuyueShichang()).in("chewei_yuyue_yesno_types", new Integer[]{1,2}).eq("chewei_yuyue_yesno_text", cheweiYuyue.getCheweiYuyueYesnoText())cheweiYuyue.setInsertTime(new Date());cheweiYuyue.setCheweiYuyueYesnoTypes(1);cheweiYuyue.setCreateTime(new Date());cheweiYuyueService.insert(cheweiYuyue);return R.ok();}/*** 入库*/@RequestMapping("/ruku")public R ruku(Integer id , HttpServletRequest request){logger.debug("refund:,,Controller:{},,ids:{}",this.getClass().getName(),id.toString());CheweiYuyueEntity cheweiYuyueEntity = cheweiYuyueService.selectById(id);cheweiYuyueEntity.setCheweiYuyueYesnoTypes(4);cheweiYuyueService.updateById(cheweiYuyueEntity);return R.ok();}/*** 出库*/@RequestMapping("/chuku")public R chuku(Integer id , HttpServletRequest request){logger.debug("refund:,,Controller:{},,ids:{}",this.getClass().getName(),id.toString());CheweiYuyueEntity cheweiYuyueEntity = cheweiYuyueService.selectById(id);cheweiYuyueEntity.setCheweiYuyueYesnoTypes(5);cheweiYuyueService.updateById(cheweiYuyueEntity);return R.ok();}/*** 缴费*/@RequestMapping("/jiaofei")public R jiaofei(Integer id , HttpServletRequest request){logger.debug("refund:,,Controller:{},,ids:{}",this.getClass().getName(),id.toString());CheweiYuyueEntity cheweiYuyueEntity = cheweiYuyueService.selectById(id);CheweiEntity cheweiEntity = cheweiService.selectById(cheweiYuyueEntity.getCheweiId());CheliangEntity cheliangEntity = cheliangService.selectById(cheweiYuyueEntity.getCheliangId());YonghuEntity yonghuEntity = yonghuService.selectById(cheliangEntity.getYonghuId());Double newMoney = yonghuEntity.getNewMoney();Integer cheweiYuyueShichang = cheweiYuyueEntity.getCheweiYuyueShichang();Double cheweiTingchefei = cheweiEntity.getCheweiTingchefei();double v = cheweiTingchefei * cheweiYuyueShichang;if(newMoney<v)return R.error("用户余额不足请充值后在缴费");yonghuEntity.setNewMoney(newMoney-v);cheweiYuyueEntity.setCheweiYuyueYesnoTypes(6);cheweiEntity.setShangxiaTypes(1);cheweiService.updateById(cheweiEntity);cheweiYuyueService.updateById(cheweiYuyueEntity);yonghuService.updateById(yonghuEntity);return R.ok();}}
7.2 车位预订Service
package com.service;import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.CheweiYuyueEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;/*** 车位预订 服务类*/
public interface CheweiYuyueService extends IService<CheweiYuyueEntity> {/*** @param params 查询参数* @return 带分页的查询出来的数据*/PageUtils queryPage(Map<String, Object> params);}
7.3 车位预订ServiceImpl
package com.service.impl;/*** 车位预订 服务实现类* author 计算机编程-吉哥*/
@Service("cheweiYuyueService")
@Transactional
public class CheweiYuyueServiceImpl extends ServiceImpl<CheweiYuyueDao, CheweiYuyueEntity> implements CheweiYuyueService {@Overridepublic PageUtils queryPage(Map<String,Object> params) {Page<CheweiYuyueView> page =new Query<CheweiYuyueView>(params).getPage();page.setRecords(baseMapper.selectListView(page,params));return new PageUtils(page);}}
7.4 车位预订DAO
package com.dao;import com.entity.CheweiYuyueEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;import org.apache.ibatis.annotations.Param;
import com.entity.view.CheweiYuyueView;/*** 车位预订 Dao 接口** @author */
public interface CheweiYuyueDao extends BaseMapper<CheweiYuyueEntity> {List<CheweiYuyueView> selectListView(Pagination page,@Param("params")Map<String,Object> params);}
8.参考文档
你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论