package com.chinaweal.aiccs.aiccs.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chinaweal.aiccs.aiccs.business.entity.TSTwfProcess;
import com.chinaweal.aiccs.aiccs.business.mapper.TSTwfProcessMapper;
import com.chinaweal.aiccs.aiccs.business.service.TSTwfProcessService;
import com.chinaweal.aiccs.common.constant.Constant;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 流程实例 服务实现类
 * </p>
 *
 * @author <a href="https://blog.lroyia.top">lroyia</a>
 * @since 2021-01-29
 */
@Service
public class TSTwfProcessServiceImpl extends BaseServiceImpl<TSTwfProcessMapper, TSTwfProcess> implements TSTwfProcessService {

    @Override
    public TSTwfProcess findTwfProcessByID(String processId) {
        return getById(processId);
    }

    @Override
    public List<TSTwfProcess> findTwfProcessByParentProcessid(String parentProcessId) {
        return list(new LambdaQueryWrapper<TSTwfProcess>().eq(TSTwfProcess::getParentprocessid, parentProcessId));
    }

    @Override
    public List<TSTwfProcess> findTwfProcessByParentProcessidNotIndependent(String parentProcessId) {
        return list(new LambdaQueryWrapper<TSTwfProcess>().eq(TSTwfProcess::getParentprocessid, parentProcessId).eq(TSTwfProcess::getIndependent, Constant.FALSE_0));
    }
}
