package com.qmth.distributed.print.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qmth.distributed.print.business.entity.TFCustomFlowEntity;
import com.qmth.distributed.print.business.mapper.TFCustomFlowEntityMapper;
import com.qmth.distributed.print.business.service.TFCustomFlowEntityService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 自定义流程列表 服务实现类
 * </p>
 *
 * @author wangliang
 * @since 2022-02-18
 */
@Service
public class TFCustomFlowEntityServiceImpl extends ServiceImpl<TFCustomFlowEntityMapper, TFCustomFlowEntity> implements TFCustomFlowEntityService {

    /**
     * 根据自定义流程id查找
     *
     * @param customFlowId
     * @return
     */
    @Override
    public TFCustomFlowEntity findByCustomFlowId(Long customFlowId) {
        QueryWrapper<TFCustomFlowEntity> tfCustomFlowListQueryWrapper = new QueryWrapper<>();
        tfCustomFlowListQueryWrapper.lambda().eq(TFCustomFlowEntity::gettFCustomFlowId, customFlowId);
        return this.getOne(tfCustomFlowListQueryWrapper);
    }

    /**
     * 根据流程id查找
     *
     * @param flowId
     * @return
     */
    @Override
    public TFCustomFlowEntity findByFlowId(Long flowId) {
        QueryWrapper<TFCustomFlowEntity> tfCustomFlowListQueryWrapper = new QueryWrapper<>();
        tfCustomFlowListQueryWrapper.lambda().eq(TFCustomFlowEntity::getFlowId, flowId);
        return this.getOne(tfCustomFlowListQueryWrapper);
    }

    /**
     * 根据自定义流程id查找list
     *
     * @param customFlowId
     * @return
     */
    @Override
    public List<TFCustomFlowEntity> findListByCustomFlowId(Long customFlowId) {
        QueryWrapper<TFCustomFlowEntity> tfCustomFlowListQueryWrapper = new QueryWrapper<>();
        tfCustomFlowListQueryWrapper.lambda().eq(TFCustomFlowEntity::gettFCustomFlowId, customFlowId);
        return this.list(tfCustomFlowListQueryWrapper);
    }
}
