package com.sptg.device.biz.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sptg.device.api.entity.TimeStrategyTaskDetails;
import com.sptg.device.biz.mapper.TimeStrategyTaskDetailsMapper;
import com.sptg.device.biz.service.TimeStrategyTaskDetailsServiceInterface;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * title: TimeStrategyTaskDetailsServiceImpl
 * package: com.sptg.device.biz.security.impl
 * description:时间策略任务详细-服务层实现类
 *
 *                
 *                
 */
@Service
@AllArgsConstructor
public class TimeStrategyTaskDetailsServiceImpl extends ServiceImpl<TimeStrategyTaskDetailsMapper, TimeStrategyTaskDetails> implements TimeStrategyTaskDetailsServiceInterface {

    @Override
    public List<Long> getFkIdListByTaskId(long taskId){
        Wrapper<TimeStrategyTaskDetails> wrapper=new EntityWrapper<TimeStrategyTaskDetails>();
            wrapper.setSqlSelect("l_fk_id AS fkId");
            wrapper.eq("l_task_id",taskId);
        List<TimeStrategyTaskDetails> timeStrategyTaskDetailsList = this.selectList(wrapper);
        List<Long> list = null;
        if(null!=timeStrategyTaskDetailsList&&!timeStrategyTaskDetailsList.isEmpty()){
            list =timeStrategyTaskDetailsList.stream().map(TimeStrategyTaskDetails::getFkId).collect(Collectors.toList());
        }
        return list;
    }
}
