package com.qmth.qrzk.dao.repositories;

import java.util.List;

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

import com.qmth.qrzk.supplypaper.model.PrintProvTask;

/**
 * 按省份分配打印任务
 * @author zhengmin
 *
 */
public interface PrintProvTaskRepo extends JpaRepository<PrintProvTask, Long>{

	List<PrintProvTask> findByBatchId(Integer batchId,Sort sort);
	
	List<PrintProvTask> findByBatchIdAndUserId(Integer batchId,Integer userId,Sort sort);
	
	List<PrintProvTask> findByBatchIdAndScanUserId(Integer batchId,Integer scanUserId,Sort sort);
	
	@Modifying
	@Query("update PrintProvTask set userId = ?1 where id = ?2")
	void updateUserId(Integer userId,long id);
	
	@Modifying
	@Query("update PrintProvTask set scanUserId = ?1 where id = ?2")
	void updateScanUserId(Integer scanUserId, long id);
}
