/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.workflow.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codvision.workflow.entity.WorkFlowSubData;
import com.codvision.workflow.mapper.WorkFlowSubDataMapper;
import com.codvision.workflow.service.WorkFlowSubDataService;
import org.springframework.stereotype.Service;

/**
 * @author hxl
 */
@Service
public class WorkFlowSubDataServiceImpl extends ServiceImpl<WorkFlowSubDataMapper, WorkFlowSubData> implements WorkFlowSubDataService {

    @Override
    public WorkFlowSubData getByTaskId(String taskId) {
        return this.getOne(Wrappers.<WorkFlowSubData>lambdaQuery().eq(WorkFlowSubData::getTaskId, taskId));
    }

    @Override
    public void updateFormData(String taskId, String jsonData) {
        getBaseMapper().updateFormData(taskId, jsonData);
    }

    @Override
    public void delAllByInstanceId(String instanceId) {
        this.remove(Wrappers.<WorkFlowSubData>lambdaQuery().eq(WorkFlowSubData::getInstanceId, instanceId));
    }
}
