# DbEmailTargetServiceImpl.java

    package cloud.wconnect.workperformance.service.database.impl;

    import cloud.wconnect.workperformance.entity.database.DbEmailTarget;
    import cloud.wconnect.workperformance.mapper.database.DbEmailTargetMapper;
    import cloud.wconnect.workperformance.service.database.IDbEmailTargetService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;

    import java.util.List;

    /**
     * <p>
     * Database email target 服务实现类
     * </p>
     *
     * @author zc
     * @since 2025-12-02
     */
    @Service
    @DS("database")
    public class DbEmailTargetServiceImpl extends ServiceImpl<DbEmailTargetMapper, DbEmailTarget> implements IDbEmailTargetService {

        /**
         * 获取邮件通知对象
         *
         * @param configId 邮件配置 id
         * @return 邮件通知对象
         * @author zc
         * @date 2025/12/02
         */
        @Override
        public List<DbEmailTarget> listByConfigId(int configId) {
            return list(new QueryWrapper<DbEmailTarget>().lambda()
                    .eq(DbEmailTarget::getConfigId, configId));
        }

        /**
         * 根据配置 id 删除 target
         *
         * @param emailConfigId 邮件配置 id
         * @author zc
         * @date 2025/12/02
         */
        @Override
        public void removeByConfigId(int emailConfigId) {
            remove(new QueryWrapper<DbEmailTarget>().lambda()
                    .eq(DbEmailTarget::getConfigId, emailConfigId));
        }
    }