package com.yh.saas.platform.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yh.saas.platform.entity.NotificationBusinessCode;
import com.yh.saas.platform.mapper.NotificationBusinessCodeMapper;
import com.yh.saas.platform.service.INotificationBusinessCodeService;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 工作流 - businessCode集合 - 实现类
 * </p>
 *
 * @author ZhangMingYu
 * @since 2020年4月16日09:05:23
 */
@Service
public class NotificationBusinessCodeServiceImpl extends ServiceImpl<NotificationBusinessCodeMapper, NotificationBusinessCode>
        implements INotificationBusinessCodeService {

    @Override
    public NotificationBusinessCode findBusinessCodeInfo(String businessCode) {
        return this.selectOne(new EntityWrapper<NotificationBusinessCode>().eq(NotificationBusinessCode.QueryFiled.BUSINESS_CODE, businessCode));
    }

    @Override
    public List<String> findBusinessCodes() {
        List<NotificationBusinessCode> notificationBusinessCodes = this.selectList(new EntityWrapper<>());
        return notificationBusinessCodes.stream().map(NotificationBusinessCode::getBusinessCode).collect(Collectors.toList());
    }
}
