package com.ssj.dao.sys.role.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.ssj.bean.sys.role.domain.Admin;

@Repository
public interface AdminDao extends JpaRepository<Admin, String>{
	
	public Page<Admin> findAll(Specification<Admin> specification, Pageable page);
	
	@Query(nativeQuery = true, value = "select count(1) from sys_admin  where login_name = ?1 and id !=?2")
	public Integer validateLoginName(String loginName, String id);
	
	@Query(nativeQuery = true, value = "select * from sys_admin  where login_name = ?1 and password =?2 and status = 1 ")
	 public Admin longin(String loginName,String password);
	@Query(nativeQuery = true, value = "select * from sys_admin  where login_name = ?1 ")
	public Admin getByLoginName(String loginName);

}
