package com.xinelu.manage.service.sysarea.impl;

import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.sysarea.SysArea;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.sysarea.ISysAreaService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 区域Service业务层处理
 *
 * @author zh
 * @date 2024-02-26
 */
@Service
public class SysAreaServiceImpl implements ISysAreaService {
    @Resource
    private SysAreaMapper sysAreaMapper;

    /**
     * 查询省级区域信息信息
     *
     * @return 省级区域信息集合
     */
    @Override
    public AjaxResult getProvinceAreaInfo() {
        SysArea area = new SysArea();
        area.setAreaLevel(1);
        return AjaxResult.success(sysAreaMapper.selectSysAreaList(area));
    }

    /**
     * 根据父id查询其下属区域信息
     *
     * @param parentId 父级区域id
     * @return 下属区域信息集合
     */
    @Override
    public AjaxResult getSubordinateAreaInfo(Long parentId) {
        SysArea area = new SysArea();
        area.setParentId(parentId);
        return AjaxResult.success(sysAreaMapper.selectSysAreaList(area));
    }
}
