ConfigParamRepository.java 955 Bytes
package com.reyun.repository;

import com.reyun.model.ConfigParam;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by sunhao on 17/3/2.
 */
@Transactional
public interface ConfigParamRepository extends JpaRepository<ConfigParam,Long> {

    @Query(value = "select value_param from config_param where key_param = ?1 ", nativeQuery = true)
    String findParamsByKey(String key);

    @Query(value = "select * from config_param where key_param in ?1 ", nativeQuery = true)
    List<ConfigParam> findParamsByKeys(List<String> keys);

    @Transactional
    @Modifying
    @Query(value = "update config_param set value_param = ?2 where key_param = ?1", nativeQuery = true)
    void SyncLoginPassword(String key, String uuid);
}