package com.muyu.enterprise.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.enterprise.mapper.ElectMapper;
import com.muyu.enterprise.mapper.MiddleMapper;
import com.muyu.enterprise.service.MiddleService;
import com.muyu.domain.Middle;
import com.muyu.domain.req.MiddleReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MiddleServiceImpl
        extends ServiceImpl<MiddleMapper, Middle>
        implements MiddleService {

    @Autowired
    private MiddleMapper middleMapper;
    @Autowired
    private ElectMapper electMapper;


    @Override
    public void updateById(MiddleReq req) {

    }

    @Override
    public List<Middle> selectMiddleList(Long gruopId) {

        LambdaQueryWrapper<Middle> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Middle::getFenceGroupId,gruopId);
        this.list(queryWrapper);
        return this.list();
    }

//    @Override
//    public List<Fence> showFenceList(Long fenceGruopId) {
//        List<Middle> fenceList = middleMapper.showFenceList(fenceGruopId);
//        ArrayList<Fence> fences = new ArrayList<>();
//        for (Middle middle : fenceList) {
//            //获取中间表电子围栏id
//            Long fenceId = middle.getFenceId();
//            //查询围栏组绑定的围栏列表
//            fences.add(electMapper.boundFence(fenceId));
//        }
//        return fences;
//    }

}
