package com.changhu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.pojo.vo.TreeNodeVo;
import com.changhu.mapper.AdministrativeDivisionMapper;
import com.changhu.pojo.entity.AdministrativeDivision;
import com.changhu.service.AdministrativeDivisionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * administrative_division (全国行政区划表(2023/12/04))  服务实现类
 * author: luozhun
 * desc 由groovy脚本自动生成
 */
@Service
public class AdministrativeDivisionServiceImpl extends ServiceImpl<AdministrativeDivisionMapper, AdministrativeDivision> implements AdministrativeDivisionService {

    @Override
    public List<TreeNodeVo<String>> tree(Integer level) {
        List<TreeNodeVo<String>> treeNodeVos = baseMapper.treeList(level);
        return TreeNodeVo.buildTree(treeNodeVos, "0");
    }

    @Override
    public List<TreeNodeVo<String>> administrativeDivisionByParentCode(String parentCode) {
        return baseMapper.administrativeDivisionByParentCode(parentCode);
    }
}
