|
@@ -0,0 +1,120 @@
|
|
|
+package com.ruoyi.zdsz.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.core.domain.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 com.ruoyi.zdsz.domain.bo.ZEngineeringInfoBo;
|
|
|
+import com.ruoyi.zdsz.domain.vo.ZEngineeringInfoVo;
|
|
|
+import com.ruoyi.zdsz.domain.ZEngineeringInfo;
|
|
|
+import com.ruoyi.zdsz.mapper.ZEngineeringInfoMapper;
|
|
|
+import com.ruoyi.zdsz.service.IZEngineeringInfoService;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 工程详情Service业务层处理
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ * @date 2023-12-27
|
|
|
+ */
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
|
|
|
+
|
|
|
+ private final ZEngineeringInfoMapper baseMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询工程详情
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ZEngineeringInfoVo queryById(String id){
|
|
|
+ return baseMapper.selectVoById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询工程详情列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<ZEngineeringInfoVo> queryPageList(ZEngineeringInfoBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<ZEngineeringInfo> lqw = buildQueryWrapper(bo);
|
|
|
+ Page<ZEngineeringInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询工程详情列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ZEngineeringInfoVo> queryList(ZEngineeringInfoBo bo) {
|
|
|
+ LambdaQueryWrapper<ZEngineeringInfo> lqw = buildQueryWrapper(bo);
|
|
|
+ return baseMapper.selectVoList(lqw);
|
|
|
+ }
|
|
|
+
|
|
|
+ private LambdaQueryWrapper<ZEngineeringInfo> buildQueryWrapper(ZEngineeringInfoBo bo) {
|
|
|
+ Map<String, Object> params = bo.getParams();
|
|
|
+ LambdaQueryWrapper<ZEngineeringInfo> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getEngInfoId()), ZEngineeringInfo::getEngInfoId, bo.getEngInfoId());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getConstructAddre()), ZEngineeringInfo::getConstructAddre, bo.getConstructAddre());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getConstructAccordingDrawings()), ZEngineeringInfo::getConstructAccordingDrawings, bo.getConstructAccordingDrawings());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSegmentedCompressionQualified()), ZEngineeringInfo::getSegmentedCompressionQualified, bo.getSegmentedCompressionQualified());
|
|
|
+ lqw.eq(bo.getBackfillTime() != null, ZEngineeringInfo::getBackfillTime, bo.getBackfillTime());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getConstructPhone()), ZEngineeringInfo::getConstructPhone, bo.getConstructPhone());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getConstructUser()), ZEngineeringInfo::getConstructUser, bo.getConstructUser());
|
|
|
+ lqw.eq(bo.getConstructTime() != null, ZEngineeringInfo::getConstructTime, bo.getConstructTime());
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getHeadName()), ZEngineeringInfo::getHeadName, bo.getHeadName());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getHeadPhone()), ZEngineeringInfo::getHeadPhone, bo.getHeadPhone());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitType()), ZEngineeringInfo::getVisitType, bo.getVisitType());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSelfClosingValveType()), ZEngineeringInfo::getSelfClosingValveType, bo.getSelfClosingValveType());
|
|
|
+ return lqw;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增工程详情
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean insertByBo(ZEngineeringInfoBo bo) {
|
|
|
+ ZEngineeringInfo add = BeanUtil.toBean(bo, ZEngineeringInfo.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ bo.setId(add.getId());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改工程详情
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean updateByBo(ZEngineeringInfoBo bo) {
|
|
|
+ ZEngineeringInfo update = BeanUtil.toBean(bo, ZEngineeringInfo.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存前的数据校验
|
|
|
+ */
|
|
|
+ private void validEntityBeforeSave(ZEngineeringInfo entity){
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除工程详情
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
|
|
|
+ if(isValid){
|
|
|
+ //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
+ }
|
|
|
+ return baseMapper.deleteBatchIds(ids) > 0;
|
|
|
+ }
|
|
|
+}
|