package cn.com.qmth.stmms.ms.core.repository;

import cn.com.qmth.stmms.ms.core.domain.user.MarkUser;
import cn.com.qmth.stmms.ms.core.domain.user.Role;
import cn.com.qmth.stmms.ms.core.vo.Subject;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * Created by zhengmin on 2016/10/6.
 */
public interface MarkUserRepo extends JpaRepository<MarkUser,Long>, JpaSpecificationExecutor {

    List<MarkUser> findByWorkIdAndSubjectAndRole(Long workId, Subject subject, Role role);

	List<MarkUser> findByWorkIdAndRole(Long workId, Role role);

	MarkUser findByLoginName(String loginName);

	List<MarkUser> findByWorkId(Long workId);

	long countByWorkIdAndRole(Long workId,Role role);

	List<MarkUser> findByRole(Role role);

    List<MarkUser> findByOrganizationIdAndRole(Long id, Role admin);

	void deleteByOrganizationIdAndRole(Long organizationId, Role admin);

    MarkUser findByPassword(String string);

    List<MarkUser> findByOrganizationIdAndRoleIn(Long organizationId, Role... role);
}
