package cn.com.qmth.stmms.biz.user.dao;

import java.util.List;

import cn.com.qmth.stmms.biz.user.model.User;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface UserDao extends PagingAndSortingRepository<User, Integer>, JpaSpecificationExecutor<User> {

    User findFirstByLoginName(String LoginName);

    User findFirstBySchoolIdAndRelatedAccount(Integer schoolId, String relatedAccount);

    @Query(value = "select u from User u where u.id=(select m.userId from Marker m where m.id=?1)")
    User findByMarkerId(Integer markerId);

    @Query(value = "select u from User u where u.loginName like ?1" + "%")
    List<User> findStartWithLoginName(String loginName);
}
