package cn.palmte.work.model;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;

public interface ActTaskDefRepository extends JpaRepository<ActTaskDef, Integer> {


    List<ActTaskDef> findByProcDefId(String procDefId);


    ActTaskDef findFirstByProcDefIdAndTaskKey(String procDefId, String taskKey);

    void deleteByProcDefId(String procDefId);




    @Modifying
    @Transactional
    @Query(value = "update ACT_HI_ACTINST a   SET a.ASSIGNEE_=?  WHERE PROC_INST_ID_=? AND TASK_ID_=?", nativeQuery = true)
    int updateHiActAssign(String assign, String procInsId, String taskId);



    @Modifying
    @Transactional
    @Query(value = "update ACT_HI_TASKINST a   SET a.ASSIGNEE_=?  WHERE PROC_INST_ID_=? AND ID_=?", nativeQuery = true)
    int updateHiTaskAssign(String assign, String procInsId, String taskId);
}
