package com.dashitech.businessdata.dao;

import com.dashitech.businessdata.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by chi on 2019/9/12.
 */
public interface IUserDAO extends JpaRepository<UserEntity, String> {

    @SuppressWarnings("unchecked")
    UserEntity save(UserEntity userEntity);

    //@Query(value = "select id from UserEntity where ACCOUNT =?1")
    @Query(value = "select id from itsm_uc_user where ACCOUNT =?1 limit 1",nativeQuery = true)
    Long selectIdByAccount(String account);

    @Query(value = "SELECT id FROM itsm_base_dictionary WHERE _key='user_gender' and _value =?1", nativeQuery = true)
    Long getGenderIdById(String gender);

    @Query(value = "select * from itsm_uc_user where ACCOUNT =?1 limit 1",nativeQuery = true)
    UserEntity selectByAccount(String account);
}
