package com.javaweb.geo.service.impl;
|
|
import java.util.List;
|
|
import com.javaweb.common.utils.DateUtils;
|
import com.javaweb.common.utils.IdGenerate;
|
import com.javaweb.geo.domain.*;
|
import com.javaweb.geo.mapper.*;
|
import com.javaweb.geo.service.*;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import com.javaweb.common.core.text.Convert;
|
import org.springframework.util.ObjectUtils;
|
|
/**
|
* 钻孔Service业务层处理
|
*
|
* @author zmk
|
* @date 2022-10-20
|
*/
|
@Service
|
public class HoleServiceImpl implements IHoleService {
|
|
@Autowired
|
private HoleMapper holeMapper;
|
|
@Autowired
|
private HoleBiaoguanMapper holeBiaoguanMapper;
|
|
@Autowired
|
private HoleHuiciMapper holeHuiciMapper;
|
|
@Autowired
|
private HolePersonMapper holePersonMapper;
|
|
@Autowired
|
private HoleQutuMapper holeQutuMapper;
|
|
@Autowired
|
private HoleShuiweiMapper holeShuiweiMapper;
|
|
@Autowired
|
private HoleYantuMapper holeYantuMapper;
|
|
/**
|
* 查询钻孔
|
*
|
* @param ids 钻孔ID
|
* @return 钻孔
|
*/
|
@Override
|
public Hole selectHoleById(String ids) {
|
return holeMapper.selectHoleById(ids);
|
}
|
|
/**
|
* 查询钻孔列表
|
*
|
* @param hole 钻孔
|
* @return 钻孔
|
*/
|
@Override
|
public List<Hole> selectHoleList(Hole hole) {
|
return holeMapper.selectHoleList(hole);
|
}
|
|
/**
|
* 新增钻孔
|
*
|
* @param hole 钻孔
|
* @return 结果
|
*/
|
@Override
|
public int insertHole(Hole hole) {
|
if(ObjectUtils.isEmpty(hole.getIds())){
|
hole.setIds(IdGenerate.nextId());
|
}
|
hole.setCreateTime(DateUtils.getNowDate());
|
return holeMapper.insertHole(hole);
|
}
|
|
/**
|
* 修改钻孔
|
*
|
* @param hole 钻孔
|
* @return 结果
|
*/
|
@Override
|
public int updateHole(Hole hole) {
|
hole.setUpdateTime(DateUtils.getNowDate());
|
return holeMapper.updateHole(hole);
|
}
|
|
/**
|
* 删除钻孔对象
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteHoleByIds(String ids) {
|
|
// 批量删除钻孔下面的关联数据
|
String[] strings = Convert.toStrArray(ids);
|
if (!ObjectUtils.isEmpty(strings)) {
|
for (String holeId : strings) {
|
|
// =======标贯==========
|
List<HoleBiaoguan> biaoguans = holeBiaoguanMapper.selectHoleBiaoguanByHoleId(holeId);
|
String[] biaoguanIds = biaoguans.stream().map(HoleBiaoguan::getIds).toArray(String[]::new);
|
|
// =======回次==========
|
List<HoleHuici> holeHuicis = holeHuiciMapper.selectHoleHuiciByHoleId(holeId);
|
String[] huiCiIds = holeHuicis.stream().map(HoleHuici::getIds).toArray(String[]::new);
|
|
// =======人员==========
|
List<HolePerson> persons = holePersonMapper.selectHolePersonByHoleId(holeId);
|
String[] personIds = persons.stream().map(HolePerson::getIds).toArray(String[]::new);
|
|
// =======取土==========
|
List<HoleQutu> qutus = holeQutuMapper.selectHoleQutuByHoleId(holeId);
|
String[] qutuIds = qutus.stream().map(HoleQutu::getIds).toArray(String[]::new);
|
|
// =======水位==========
|
List<HoleShuiwei> shuiweis = holeShuiweiMapper.selectHoleShuiWeiByHoleId(holeId);
|
String[] shuiweiIds = shuiweis.stream().map(HoleShuiwei::getIds).toArray(String[]::new);
|
|
// =======岩土==========
|
List<HoleYantu> yantus = holeYantuMapper.selectHoleYantuListByHoleId(holeId);
|
String[] yantusIds = yantus.stream().map(HoleYantu::getIds).toArray(String[]::new);
|
|
holeBiaoguanMapper.deleteHoleBiaoguanByIds(biaoguanIds);
|
holeHuiciMapper.deleteHoleHuiciByIds(huiCiIds);
|
holePersonMapper.deleteHolePersonByIds(personIds);
|
holeQutuMapper.deleteHoleQutuByIds(qutuIds);
|
holeShuiweiMapper.deleteHoleShuiweiByIds(shuiweiIds);
|
holeYantuMapper.deleteHoleYantuByIds(yantusIds);
|
}
|
}
|
|
return holeMapper.deleteHoleByIds(Convert.toStrArray(ids));
|
}
|
|
/**
|
* 删除钻孔信息
|
*
|
* @param ids 钻孔ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteHoleById(String ids) {
|
return holeMapper.deleteHoleById(ids);
|
}
|
}
|