目录
1.按发车时间排序。
2.排班日期默认当天时间。
3.编辑不可修改线路和排班日期。
4.线路、车号、司机是否匹配,不匹配不可入库(和其他表比),线路、发车时间、司机、车号、日期、上下行相同不可入库(和自己表比),只要数据入库就需验证,无论增加修改
1.按发车时间排序。
default PageResult<HandSchedDO> selectPage(HandSchedPageReqVO reqVO) {return selectPage(reqVO, new LambdaQueryWrapperX<HandSchedDO>().eqIfPresent(HandSchedDO::getBanCi, reqVO.getBanCi()).eqIfPresent(HandSchedDO::getBanXing, reqVO.getBanXing()).eqIfPresent(HandSchedDO::getLineId, reqVO.getLineId()).likeIfPresent(HandSchedDO::getLineName, reqVO.getLineName()).eqIfPresent(HandSchedDO::getFixedType, reqVO.getFixedType()).eqIfPresent(HandSchedDO::getUpDown, reqVO.getUpDown()).eqIfPresent(HandSchedDO::getPlanMouth, reqVO.getPlanMouth()).betweenIfPresent(HandSchedDO::getStartTime, reqVO.getStartTime()).eqIfPresent(HandSchedDO::getDriverNum, reqVO.getDriverNum()).likeIfPresent(HandSchedDO::getDriverName, reqVO.getDriverName()).eqIfPresent(HandSchedDO::getBusId, reqVO.getBusId()).eqIfPresent(HandSchedDO::getOnePoint, reqVO.getOnePoint()).betweenIfPresent(HandSchedDO::getCreateTime, reqVO.getCreateTime()).orderByAsc(HandSchedDO::getStartTime)); //按发车时间排序}
HandSchedMapper中.orderByAsc(HandSchedDO::getStartTime));将结果根据StartTime升序排序
2.排班日期默认当天时间。
default PageResult<HandSchedDO> selectPage(HandSchedPageReqVO reqVO) {return selectPage(reqVO, new LambdaQueryWrapperX<HandSchedDO>().eqIfPresent(HandSchedDO::getBanCi, reqVO.getBanCi()).eqIfPresent(HandSchedDO::getBanXing, reqVO.getBanXing()).eqIfPresent(HandSchedDO::getLineId, reqVO.getLineId()).likeIfPresent(HandSchedDO::getLineName, reqVO.getLineName()).eqIfPresent(HandSchedDO::getFixedType, reqVO.getFixedType()).eqIfPresent(HandSchedDO::getUpDown, reqVO.getUpDown()).eqIfPresent(HandSchedDO::getPlanMouth, DateUtil.format(new Date(), "yyyy-MM-dd")) //排班日期默认当天时间.betweenIfPresent(HandSchedDO::getStartTime, reqVO.getStartTime()).eqIfPresent(HandSchedDO::getDriverNum, reqVO.getDriverNum()).likeIfPresent(HandSchedDO::getDriverName, reqVO.getDriverName()).eqIfPresent(HandSchedDO::getBusId, reqVO.getBusId()).eqIfPresent(HandSchedDO::getOnePoint, reqVO.getOnePoint()).betweenIfPresent(HandSchedDO::getCreateTime, reqVO.getCreateTime()).orderByAsc(HandSchedDO::getStartTime)); //按发车时间排序}
DateUtil.format(new Date(), "yyyy-MM-dd")将展示的排版日期设置为当天日期
3.编辑不可修改线路和排班日期。
HandSchedMapper.xml
<!-- 编辑不可修改线路和排班日期 --><select id="updateList" resultType="com.sunwiseinfo.bus.module.manage.dal.dataobject.handsched.HandSchedDO" parameterType="com.sunwiseinfo.bus.module.manage.controller.admin.handsched.vo.HandSchedBaseVO">SELECT * FROM manage_hand_sched sWHERE line_id=#{lineId} and plan_mouth=#{planMouth} and id=#{id}</select>
HandSchedMapper.java
List<HandSchedDO> updateList(HandSchedUpdateReqVO updateReqVO);
HandSchedService.java
List<HandSchedDO> updateList(HandSchedUpdateReqVO updateReqVO);
HandSchedServiceImpl.java
@Overridepublic List<HandSchedDO> updateList(HandSchedUpdateReqVO updateReqVO) {return handSchedMapper.updateList(updateReqVO);}
HandSchedController.java
//编辑不可修改线路和排班日期LambdaQueryWrapper<HandSchedDO> updateQueryWrapper = new LambdaQueryWrapper();updateQueryWrapper.eq(HandSchedDO::getLineId,updateReqVO.getLineId());updateQueryWrapper.eq(HandSchedDO::getPlanMouth,updateReqVO.getPlanMouth());List<HandSchedDO> handSchedDOS = handSchedService.updateList(updateReqVO);if(handSchedDOS != null && handSchedDOS.size() > 0){...当LineId线路id、PlanMouth计划日期不变时,进入判断中}return success("不可修改");
4.线路、车号、司机是否匹配,不匹配不可入库(和其他表比),线路、发车时间、司机、车号、日期、上下行相同不可入库(和自己表比),只要数据入库就需验证,无论增加修改
<!-- 查询线路、车号、司机是否匹配 --><select id="handSchedList" resultType="com.sunwiseinfo.bus.module.manage.dal.dataobject.handsched.HandSchedDO" parameterType="com.sunwiseinfo.bus.module.manage.controller.admin.handsched.vo.HandSchedBaseVO">SELECTml.*FROMmanage_line mlLEFT JOIN manage_bus mb ON mb.line_id = ml.idLEFT JOIN manage_passenger mp ON mp.line_id = ml.idWHEREml.id = #{lineId}AND mb.id=#{busId}AND mp.job_num=#{driverNum}</select>
List<HandSchedDO> handSchedList(HandSchedCreateReqVO createReqVO);List<HandSchedDO> handSchedList(HandSchedUpdateReqVO updateReqVO);
List<HandSchedDO> getManageHandSched(HandSchedCreateReqVO createReqVO);List<HandSchedDO> getManageHandSched(HandSchedUpdateReqVO updateReqVO);
@Overridepublic List<HandSchedDO> getManageHandSched(HandSchedCreateReqVO createReqVO) {return handSchedMapper.handSchedList(createReqVO);}@Overridepublic List<HandSchedDO> getManageHandSched(HandSchedUpdateReqVO updateReqVO) {return handSchedMapper.handSchedList(updateReqVO);}
//线路、发车时间、司机、车号、日期、上下行相同不可入库LambdaQueryWrapper<HandSchedDO> queryWrapper = new LambdaQueryWrapper();queryWrapper.eq(HandSchedDO::getLineId,createReqVO.getLineId());queryWrapper.eq(HandSchedDO::getStartTime,createReqVO.getStartTime());queryWrapper.eq(HandSchedDO::getDriverNum,createReqVO.getDriverNum());queryWrapper.eq(HandSchedDO::getBusId,createReqVO.getBusId());queryWrapper.eq(HandSchedDO::getPlanMouth,createReqVO.getPlanMouth());queryWrapper.eq(HandSchedDO::getUpDown,createReqVO.getUpDown());List<HandSchedDO> handSchedDOList = handSchedService.getSelectList(queryWrapper);if (handSchedDOList != null && handSchedDOList.size() > 0){return success("表中已存在此数据!");}//线路、车号、司机是否匹配,不匹配不可入库List<HandSchedDO> List=handSchedService.getManageHandSched(createReqVO);if (List != null && List.size() > 0){createReqVO.setFixedId(IdWorker.getIdStr());handSchedService.createHandSched(createReqVO);return success("true");}return success("数据不匹配,不能入库");
//线路、发车时间、司机、车号、日期、上下行相同不可入库LambdaQueryWrapper<HandSchedDO> queryWrapper = new LambdaQueryWrapper();queryWrapper.eq(HandSchedDO::getLineId,updateReqVO.getLineId());queryWrapper.eq(HandSchedDO::getStartTime,updateReqVO.getStartTime());queryWrapper.eq(HandSchedDO::getDriverNum,updateReqVO.getDriverNum());queryWrapper.eq(HandSchedDO::getBusId,updateReqVO.getBusId());queryWrapper.eq(HandSchedDO::getPlanMouth,updateReqVO.getPlanMouth());queryWrapper.eq(HandSchedDO::getUpDown,updateReqVO.getUpDown());List<HandSchedDO> handSchedDOList = handSchedService.getSelectList(queryWrapper);if (handSchedDOList != null && handSchedDOList.size() > 0) {return success("表中已存在此数据!");}//线路、车号、司机是否匹配,不匹配不可入库List<HandSchedDO> List=handSchedService.getManageHandSched(updateReqVO);if (List != null && List.size() > 0){updateReqVO.setFixedId(IdWorker.getIdStr());handSchedService.updateHandSched(updateReqVO);return success("true");}return success("数据不匹配,不能入库");