package com.rf.psychological.scale.dao.repository;

import com.rf.psychological.base.repository.BaseRepository;
import com.rf.psychological.scale.dao.model.ScaleConfigEntity;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author lpf
 * @description:
 * @date 2022/5/28 16:29
 */
public interface ScaleConfigRepository extends BaseRepository<ScaleConfigEntity, String> {

    @Transactional
    @Modifying
    @Query(value = "delete from t_scale_config where flag= :flag  ", nativeQuery = true)
    void deleteScaleConfigEntitiesByFlag(@Param("flag") String flag);

    @Transactional
    @Modifying
    @Query(value = "update t_scale_config set result_config = ?2  where flag= ?1  ", nativeQuery = true)
    void updateByFlag(String flag, String resultConfig);
}
