package com.sckw.system.service;

import com.sckw.system.dao.SysAreaDao;
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
import com.sckw.system.model.SysArea;
import com.sckw.system.model.vo.req.FindAreaTreeReqVo;
import com.sckw.system.model.vo.res.FindAreaTreeResVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 行政区域service接口
 * @author zk
 * @date 2023-05-31
 */
@Service
public class SysAreaService {

    @Autowired
    SysAreaDao sysAreaDao;

    @Autowired
    private RemoteSystemServiceImpl remoteSystemService;
    /**
     * 查询
     * @param params
     * @return
     */
    public List<SysArea> findList(Map<String, Object> params) {
        return sysAreaDao.findList(params);
    }


    /**
     * @desc: 根据id获取
     * @author: yzc
     * @date: 2023-07-11 11:38
     * @Param code:
     * @return: com.sckw.system.model.SysArea
     */
    public SysArea selectById(Integer code) {
        return sysAreaDao.selectById(code);
    }

    /**
     * @desc: 根据id获取
     * @author: yzc
     * @date: 2023-07-11 11:38
     * @Param code:
     * @return: com.sckw.system.model.SysArea
     */
    public List<SysArea> selectByIds(List<Integer> list) {
        return sysAreaDao.selectByIds(list);
    }


    /**
     * @param reqVo pcode
     * @return List<FindAreaTreeResVo>
     * @desc: 查区域树
     * @author: czh
     * @date: 2023/7/31
     */
    public List<FindAreaTreeResVo> findTree(FindAreaTreeReqVo reqVo) {
        int code = 100000;
        if (Objects.nonNull(reqVo.getCode())) {
            code = reqVo.getCode();
        }
        return remoteSystemService.queryAreaTree(code);
    }
}
