package com.njcn.prepare.harmonic.service.mysql.Impl.area;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.harmonic.pojo.po.PmsTerminalPO;
import com.njcn.prepare.harmonic.mapper.mysql.area.PmsTerminalPOMapper;
import com.njcn.prepare.harmonic.service.mysql.area.PmsTerminalPOService;
import com.njcn.user.api.DeptFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2022/11/29  15:53【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Service
public class PmsTerminalPOServiceImpl extends ServiceImpl<PmsTerminalPOMapper, PmsTerminalPO> implements PmsTerminalPOService{


    private @Autowired
    PmsTerminalPOMapper pmsTerminalPOMapper;
    private @Autowired
    DeptFeignClient deptFeignClient;
    /**
     * @Description: 监测终端集合
     * @Param: [orgid]
     * @return: java.util.List<com.njcn.prepare.harmonic.pojo.po.PmsTerminalPO>
     * @Author: clam
     * @Date: 2022/11/25
     */
    @Override
    public List<PmsTerminalPO> queryOnlineMeasurementPoints(String orgid) {
        List<PmsTerminalPO> list = new ArrayList<> ();
        LambdaQueryWrapper<PmsTerminalPO> wrapper = new LambdaQueryWrapper ( );
        /*获取当前部门及子部门*/
        List<String> deptIds = deptFeignClient.getDepSonSelfCodetByDeptId(orgid).getData();

        wrapper.in (PmsTerminalPO::getOrgId, deptIds);
        list = pmsTerminalPOMapper.selectList (wrapper);

        return list;
    }
}
