package com.sifang.modules.flowable.dao;

import com.sifang.modules.flowable.entity.ItemTaskDetail;
import com.sifang.modules.sys.common.entity.User;
import com.sifang.modules.sys.common.persistence.BaseDao;
import com.sifang.modules.sys.entity.Operator;
import org.springframework.stereotype.Repository;

import java.util.Date;

@Repository
public class ItemTaskDetailDao extends BaseDao<ItemTaskDetail> {

    public void addItemTaskDetail(String formKey, String applicationId, String processInstanceId, String taskId, String handleResult, Date currentTime, User user,Date taskCreateTime,String taskName){
        ItemTaskDetail taskDetail=new ItemTaskDetail();
        taskDetail.setFormKey(formKey);
        taskDetail.setApplicationId(applicationId);
        taskDetail.setProcessInstanceId(processInstanceId);
        taskDetail.setTaskId(taskId);
        taskDetail.setTaskName(taskName);
        taskDetail.setHandleResult(handleResult);
        taskDetail.setHandleUserId(user.getId());
        taskDetail.setHandleUserName(user.getUserName());
        taskDetail.setHandleTime(currentTime);
        taskDetail.setTaskCreateTime(taskCreateTime);
        save(taskDetail);
    }

    public void addItemTaskDetail2(String formKey, String applicationId, String processInstanceId, String taskId, String handleResult, Date currentTime, Operator operator,String taskName){
        ItemTaskDetail taskDetail=new ItemTaskDetail();
        taskDetail.setFormKey(formKey);
        taskDetail.setApplicationId(applicationId);
        taskDetail.setProcessInstanceId(processInstanceId);
        taskDetail.setTaskId(taskId);
        taskDetail.setTaskName(taskName);
        taskDetail.setHandleResult(handleResult);
        taskDetail.setHandleUserId(operator.getUserId());
        taskDetail.setHandleUserName(operator.getUserName());
        taskDetail.setHandleTime(currentTime);
        save(taskDetail);
    }
}
