TCountyLevelRegionServiceImpl.java 3.4 KB
Newer Older
1 2 3
package com.zehong.system.service.impl;

import java.util.List;
4 5 6 7 8

import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.SysSetting;
import com.zehong.system.service.ISysSettingService;
9 10 11 12 13 14
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TCountyLevelRegionMapper;
import com.zehong.system.domain.TCountyLevelRegion;
import com.zehong.system.service.ITCountyLevelRegionService;

15 16
import javax.annotation.Resource;

17 18 19 20 21 22 23 24 25
/**
 * 县级行政区Service业务层处理
 * 
 * @author zehong
 * @date 2024-06-06
 */
@Service
public class TCountyLevelRegionServiceImpl implements ITCountyLevelRegionService 
{
26
    @Resource
27 28
    private TCountyLevelRegionMapper tCountyLevelRegionMapper;

29 30 31
    @Resource
    private ISysSettingService sysSettingService;

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    /**
     * 查询县级行政区
     * 
     * @param fId 县级行政区ID
     * @return 县级行政区
     */
    @Override
    public TCountyLevelRegion selectTCountyLevelRegionById(Long fId)
    {
        return tCountyLevelRegionMapper.selectTCountyLevelRegionById(fId);
    }

    /**
     * 查询县级行政区列表
     * 
     * @param tCountyLevelRegion 县级行政区
     * @return 县级行政区
     */
    @Override
    public List<TCountyLevelRegion> selectTCountyLevelRegionList(TCountyLevelRegion tCountyLevelRegion)
    {
        return tCountyLevelRegionMapper.selectTCountyLevelRegionList(tCountyLevelRegion);
    }

56 57 58 59 60 61 62 63 64 65
    /**
     * 根据  县(市、区)行政区划编码 查询数据
     * @param countyCodes c
     * @return r
     */
    @Override
    public List<TCountyLevelRegion> queryByCountyCodes(List<String> countyCodes) {
        return tCountyLevelRegionMapper.queryByCountyCodes(countyCodes);
    }

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
    /**
     * 新增县级行政区
     * 
     * @param tCountyLevelRegion 县级行政区
     * @return 结果
     */
    @Override
    public int insertTCountyLevelRegion(TCountyLevelRegion tCountyLevelRegion)
    {
        return tCountyLevelRegionMapper.insertTCountyLevelRegion(tCountyLevelRegion);
    }

    /**
     * 修改县级行政区
     * 
     * @param tCountyLevelRegion 县级行政区
     * @return 结果
     */
    @Override
    public int updateTCountyLevelRegion(TCountyLevelRegion tCountyLevelRegion)
    {
        return tCountyLevelRegionMapper.updateTCountyLevelRegion(tCountyLevelRegion);
    }

    /**
     * 批量删除县级行政区
     * 
     * @param fIds 需要删除的县级行政区ID
     * @return 结果
     */
    @Override
    public int deleteTCountyLevelRegionByIds(Long[] fIds)
    {
        return tCountyLevelRegionMapper.deleteTCountyLevelRegionByIds(fIds);
    }

    /**
     * 删除县级行政区信息
     * 
     * @param fId 县级行政区ID
     * @return 结果
     */
    @Override
    public int deleteTCountyLevelRegionById(Long fId)
    {
        return tCountyLevelRegionMapper.deleteTCountyLevelRegionById(fId);
    }
113 114 115 116 117 118 119 120 121 122 123 124

    /**
     * 获取系统设置县
     * @return
     */
    @Override
    public List<TCountyLevelRegion> getDefaultCountyList() {
        SysSetting code = sysSettingService.getSystemValueByKey("city_id");
        if(null == code || StringUtils.isEmpty(code.getSystemValue())) throw new CustomException("市级行政编码未配置!");
        return tCountyLevelRegionMapper.queryByCityId(code.getSystemValue());
    }

125
}