package com.ruoyi.platform.mapper;

import com.ruoyi.platform.domain.ResourceOccupy;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface ResourceOccupyDao {

    Boolean haveResource(@Param("id") Integer id, @Param("need") Integer need);

    int save(@Param("resourceOccupy") ResourceOccupy resourceOccupy);

    int edit(@Param("resourceOccupy") ResourceOccupy resourceOccupy);

    List<ResourceOccupy> getResourceOccupyByTask(@Param("taskType") String taskType, @Param("taskId") Long taskId, @Param("taskInsId") Long taskInsId, @Param("nodeId") String nodeId);

    int deduceCredit(@Param("credit") Double credit, @Param("userId") Long userId);

    int updateUsed(@Param("id") Integer id, @Param("used") Integer used);

    int updateUnUsed(@Param("id") Integer id, @Param("used") Integer used);

    long count(@Param("userId") Long userId);

    List<ResourceOccupy> queryByPage(@Param("userId") Long userId, @Param("pageable") Pageable pageable);

    Double getUserCredit(@Param("userId") Long userId);

    Double getDeduceCredit(@Param("userId") Long userId);

    int deleteTaskState(@Param("taskType") String taskType, @Param("taskId") Long taskId, @Param("taskInsId") Long taskInsId);
}
