package com.yiqi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yiqi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.system.mapper.SysAreaMapper;
import com.yiqi.system.domain.SysArea;
import com.yiqi.system.service.ISysAreaService;

/**
 * 地区码Service业务层处理
 *
 * @author ruoyi
 * @date 2023-07-22
 */
@Service
public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> implements ISysAreaService {

    /**
     * 查询地区码列表
     *
     * @param sysArea 地区码
     * @return 地区码
     */
    @Override
    public List<SysArea> selectSysAreaList(SysArea sysArea) {
        QueryWrapper<SysArea> areaQueryWrapper = new QueryWrapper<>();
        if(StringUtils.isNotBlank(sysArea.getParentId())){
            areaQueryWrapper.eq("parent_id",sysArea.getParentId());
        }
        if(sysArea.getLevel() != null){
            areaQueryWrapper.eq("level", sysArea.getLevel());
        }
        return baseMapper.selectList(areaQueryWrapper);
    }

}
