package cn.com.ty.lift.ud.areaCode.service.impl;

import java.util.List;

import cn.com.ty.lift.ud.areaCode.mapper.entity.AreaCode;
import cn.com.ty.lift.ud.areaCode.service.IAreaCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.ty.lift.ud.areaCode.mapper.AreaCodeMapper;
import cn.com.ty.lift.ud.utils.TreeUtil;

/**
 * 行政区划 -ServiceImpl
 *
 * @author Xson
 * @date 2020-04-30
 */
@Service
@Transactional
public class AreaCodeServiceImpl extends ServiceImpl<AreaCodeMapper, AreaCode>
    implements IAreaCodeService {

	@Autowired
	private AreaCodeMapper areaCodeMapper;
	
	@Override
    public List<AreaCode> areaTree() {
        List<AreaCode> allAreaCodeList = list();
        return TreeUtil.listToTree(allAreaCodeList, "parent","0" , "code");
    }

	@Override
	public List<AreaCode> allCityCode() {
		return areaCodeMapper.allCityCode();
	}

}
