package com.ruoyi.tms.service.impl;
|
|
import java.util.Collections;
|
import java.util.List;
|
|
import com.ruoyi.common.utils.DateUtils;
|
import javax.annotation.Resource;
|
|
import com.ruoyi.tms.domain.vo.RegionVo;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.stereotype.Service;
|
import org.springframework.scheduling.annotation.Async;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import com.ruoyi.common.utils.PageUtils;
|
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.annotation.DataSource;
|
import com.ruoyi.common.enums.DataSourceType;
|
import com.ruoyi.common.core.service.BaseService;
|
|
import com.ruoyi.tms.mapper.TmsRegionMapper;
|
import com.ruoyi.tms.domain.TmsRegion;
|
import com.ruoyi.tms.service.ITmsRegionService;
|
import com.ruoyi.common.core.text.Convert;
|
|
/**
|
* 行政区域Service业务层处理
|
*
|
* @author ruoyi
|
* @date 2025-11-03
|
*/
|
@Service
|
@Transactional(rollbackFor = Exception.class)
|
public class TmsRegionServiceImpl extends BaseService<TmsRegionMapper, TmsRegion> implements ITmsRegionService
|
{
|
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
@Resource
|
private TmsRegionMapper tmsRegionMapper;
|
|
|
/**
|
* 查询行政区域
|
*
|
* @param id 行政区域ID
|
* @return 行政区域
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Override
|
public TmsRegion selectTmsRegionById(Integer id)
|
{
|
return tmsRegionMapper.selectTmsRegionById(id);
|
}
|
|
/**
|
* 查询行政区域 记录数
|
*
|
* @param tmsRegion 行政区域
|
* @return 行政区域集合
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Override
|
public int selectTmsRegionCount(TmsRegion tmsRegion)
|
{
|
return tmsRegionMapper.selectTmsRegionCount(tmsRegion);
|
}
|
|
/**
|
* 查询行政区域列表
|
*
|
* @param tmsRegion 行政区域
|
* @return 行政区域
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Override
|
public List<TmsRegion> selectTmsRegionList(TmsRegion tmsRegion)
|
{
|
return tmsRegionMapper.selectTmsRegionList(tmsRegion);
|
}
|
|
@Override
|
public List<RegionVo> selectRegionVoList(String parentRegionCode) {
|
return tmsRegionMapper.selectRegionVoList(parentRegionCode);
|
}
|
|
/**
|
* 查询行政区域列表 异步 导出
|
*
|
* @param tmsRegion 行政区域
|
* @param exportKey 导出功能的唯一标识
|
* @return 行政区域集合
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Async
|
@Override
|
public void export(TmsRegion tmsRegion,String exportKey) {
|
|
super.export(TmsRegion.class,exportKey,"tmsRegionData",(pageNum)->{
|
PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE);
|
return selectTmsRegionList(tmsRegion);
|
});
|
}
|
|
|
/**
|
* 新增行政区域
|
*
|
* @param tmsRegion 行政区域
|
* @return 结果
|
*/
|
@Override
|
public int insertTmsRegion(TmsRegion tmsRegion)
|
{
|
tmsRegion.setCreateTime(DateUtils.getNowDate());
|
return tmsRegionMapper.insertTmsRegion(tmsRegion);
|
}
|
|
/**
|
* 新增行政区域[批量]
|
*
|
* @param tmsRegions 行政区域
|
* @return 结果
|
*/
|
@Override
|
public int insertTmsRegionBatch(List<TmsRegion> tmsRegions)
|
{
|
int rows = tmsRegionMapper.insertTmsRegionBatch(tmsRegions);
|
return rows;
|
}
|
|
/**
|
* 修改行政区域
|
*
|
* @param tmsRegion 行政区域
|
* @return 结果
|
*/
|
@Override
|
public int updateTmsRegion(TmsRegion tmsRegion)
|
{
|
tmsRegion.setUpdateTime(DateUtils.getNowDate());
|
return tmsRegionMapper.updateTmsRegion(tmsRegion);
|
}
|
|
/**
|
* 修改行政区域[批量]
|
*
|
* @param tmsRegions 行政区域
|
* @return 结果
|
*/
|
@Override
|
public int updateTmsRegionBatch(List<TmsRegion> tmsRegions){
|
return tmsRegionMapper.updateTmsRegionBatch(tmsRegions);
|
}
|
|
/**
|
* 删除行政区域对象
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteTmsRegionByIds(String ids)
|
{
|
return deleteTmsRegionByIds(Convert.toIntArray(ids));
|
}
|
|
/**
|
* 删除行政区域对象
|
*
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteTmsRegionByIds(Integer[] ids)
|
{
|
return tmsRegionMapper.deleteTmsRegionByIds(ids);
|
}
|
|
/**
|
* 删除行政区域信息
|
*
|
* @param id 行政区域ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteTmsRegionById(Integer id)
|
{
|
return tmsRegionMapper.deleteTmsRegionById(id);
|
}
|
}
|