package com.javaweb.geo.service.impl;
|
|
import java.util.List;
|
import java.util.UUID;
|
|
import com.javaweb.common.utils.IdGenerate;
|
import com.javaweb.common.utils.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import com.javaweb.geo.mapper.DataSourceMapper;
|
import com.javaweb.geo.domain.DataSource;
|
import com.javaweb.geo.service.IDataSourceService;
|
import com.javaweb.common.core.text.Convert;
|
import org.springframework.util.ObjectUtils;
|
|
/**
|
* 数据来源Service业务层处理
|
*
|
* @author cxy
|
* @date 2022-12-30
|
*/
|
@Service
|
public class DataSourceServiceImpl implements IDataSourceService {
|
|
@Autowired
|
private DataSourceMapper dataSourceMapper;
|
|
/**
|
* 查询数据来源
|
*
|
* @param ids 数据来源ID
|
* @return 数据来源
|
*/
|
@Override
|
public DataSource selectDataSourceById(String ids)
|
{
|
return dataSourceMapper.selectDataSourceById(ids);
|
}
|
|
/**
|
* 查询数据来源列表
|
*
|
* @param dataSource 数据来源
|
* @return 数据来源
|
*/
|
@Override
|
public List<DataSource> selectDataSourceList(DataSource dataSource)
|
{
|
return dataSourceMapper.selectDataSourceList(dataSource);
|
}
|
|
/**
|
* 新增数据来源
|
*
|
* @param dataSource 数据来源
|
* @return 结果
|
*/
|
@Override
|
public int insertDataSource(DataSource dataSource)
|
{
|
dataSource.setIds(IdGenerate.nextId());
|
dataSource.setSecretKey(IdGenerate.uuid());
|
return dataSourceMapper.insertDataSource(dataSource);
|
}
|
|
/**
|
* 修改数据来源
|
*
|
* @param dataSource 数据来源
|
* @return 结果
|
*/
|
@Override
|
public int updateDataSource(DataSource dataSource)
|
{
|
if (StringUtils.isEmpty(dataSource.getIds())){
|
return dataSourceMapper.insertDataSource(dataSource);
|
}
|
return dataSourceMapper.updateDataSource(dataSource);
|
}
|
|
/**
|
* 删除数据来源对象
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteDataSourceByIds(String ids)
|
{
|
return dataSourceMapper.deleteDataSourceByIds(Convert.toStrArray(ids));
|
}
|
|
/**
|
* 删除数据来源信息
|
*
|
* @param ids 数据来源ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteDataSourceById(String ids)
|
{
|
return dataSourceMapper.deleteDataSourceById(ids);
|
}
|
|
|
/**
|
* 校验key是否存在
|
* @param secretKey
|
* @return true校验通过,false不通过
|
*/
|
@Override
|
public Boolean checkSecretKey(String secretKey) {
|
DataSource dataSource = new DataSource();
|
dataSource.setSecretKey(secretKey);
|
|
List<DataSource> dataSources = selectDataSourceList(dataSource);
|
if (ObjectUtils.isEmpty(dataSources)){
|
return false;
|
}
|
return true;
|
}
|
|
|
@Override
|
public String selectDataSourceBySecretKey(String secretKey) {
|
return dataSourceMapper.selectDataSourceBySecretKey(secretKey);
|
}
|
|
@Override
|
public String selectCompanyIdBySecretKey(String secretKey) {
|
return dataSourceMapper.selectCompanyIdBySecretKey(secretKey);
|
}
|
|
@Override
|
public int updateDataSourceBySecretKey(String secretKey,String companyId) {
|
return dataSourceMapper.updateDataSourceBySecretKey(secretKey,companyId);
|
}
|
|
|
}
|