|
|
@@ -0,0 +1,116 @@
|
|
|
+package org.dromara.system.service.impl;
|
|
|
+
|
|
|
+import org.dromara.common.core.utils.MapstructUtils;
|
|
|
+import org.dromara.common.core.utils.StringUtils;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.dromara.system.domain.bo.TblDzbcPathSchedulingBo;
|
|
|
+import org.dromara.system.domain.vo.TblDzbcPathSchedulingVo;
|
|
|
+import org.dromara.system.domain.TblDzbcPathScheduling;
|
|
|
+import org.dromara.system.mapper.TblDzbcPathSchedulingMapper;
|
|
|
+import org.dromara.system.service.ITblDzbcPathSchedulingService;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 定制班车-路线排班Service业务层处理
|
|
|
+ *
|
|
|
+ * @author Lion Li
|
|
|
+ * @date 2025-02-12
|
|
|
+ */
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class TblDzbcPathSchedulingServiceImpl implements ITblDzbcPathSchedulingService {
|
|
|
+
|
|
|
+ private final TblDzbcPathSchedulingMapper baseMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询定制班车-路线排班
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TblDzbcPathSchedulingVo queryById(Long id){
|
|
|
+ return baseMapper.selectVoById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询定制班车-路线排班列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<TblDzbcPathSchedulingVo> queryPageList(TblDzbcPathSchedulingBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<TblDzbcPathScheduling> lqw = buildQueryWrapper(bo);
|
|
|
+ Page<TblDzbcPathSchedulingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询定制班车-路线排班列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<TblDzbcPathSchedulingVo> queryList(TblDzbcPathSchedulingBo bo) {
|
|
|
+ LambdaQueryWrapper<TblDzbcPathScheduling> lqw = buildQueryWrapper(bo);
|
|
|
+ return baseMapper.selectVoList(lqw);
|
|
|
+ }
|
|
|
+
|
|
|
+ private LambdaQueryWrapper<TblDzbcPathScheduling> buildQueryWrapper(TblDzbcPathSchedulingBo bo) {
|
|
|
+ Map<String, Object> params = bo.getParams();
|
|
|
+ LambdaQueryWrapper<TblDzbcPathScheduling> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(bo.getPathId() != null, TblDzbcPathScheduling::getPathId, bo.getPathId());
|
|
|
+ lqw.eq(bo.getCarId() != null, TblDzbcPathScheduling::getCarId, bo.getCarId());
|
|
|
+ lqw.eq(bo.getMdate() != null, TblDzbcPathScheduling::getMdate, bo.getMdate());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getMtime()), TblDzbcPathScheduling::getMtime, bo.getMtime());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getStartSites()), TblDzbcPathScheduling::getStartSites, bo.getStartSites());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getEndSites()), TblDzbcPathScheduling::getEndSites, bo.getEndSites());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getExt1()), TblDzbcPathScheduling::getExt1, bo.getExt1());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getExt2()), TblDzbcPathScheduling::getExt2, bo.getExt2());
|
|
|
+ return lqw;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增定制班车-路线排班
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean insertByBo(TblDzbcPathSchedulingBo bo) {
|
|
|
+ TblDzbcPathScheduling add = MapstructUtils.convert(bo, TblDzbcPathScheduling.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ bo.setId(add.getId());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改定制班车-路线排班
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean updateByBo(TblDzbcPathSchedulingBo bo) {
|
|
|
+ TblDzbcPathScheduling update = MapstructUtils.convert(bo, TblDzbcPathScheduling.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存前的数据校验
|
|
|
+ */
|
|
|
+ private void validEntityBeforeSave(TblDzbcPathScheduling entity){
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除定制班车-路线排班
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
+ if(isValid){
|
|
|
+ //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
+ }
|
|
|
+ return baseMapper.deleteBatchIds(ids) > 0;
|
|
|
+ }
|
|
|
+}
|