package com.aegis.emergency.plan.service.impl;

import com.aegis.emergency.plan.domain.PlanParticipant;
import com.aegis.emergency.plan.mapper.PlanParticipantMapper;
import com.aegis.emergency.plan.service.IPlanParticipantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * 预案执行对象 Service 实现
 */
@Service
public class PlanParticipantServiceImpl extends ServiceImpl<PlanParticipantMapper, PlanParticipant> implements IPlanParticipantService {

    @Override
    public List<PlanParticipant> listByPlanId(Long planId) {
        if (planId == null) {
            return Collections.emptyList();
        }
        return this.lambdaQuery()
            .eq(PlanParticipant::getPlanId, planId)
            .list();
    }

    @Override
    public boolean removeByPlanId(Long planId) {
        if (planId == null) {
            return false;
        }
        return this.lambdaUpdate()
            .eq(PlanParticipant::getPlanId, planId)
            .remove();
    }
}