package com.ann.demo.repository;

import com.ann.demo.entity.normalEntity.MedicalRecordHomepageCache;
import com.ann.demo.entity.normalEntity.ids.MedicalRecordHomepageCacheIds;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @Author: LeiJiaXin
 * @Date: 2019/9/26 9:31
 */
@Repository
public interface MedicalRecordHomepageCacheRepository extends JpaRepository<MedicalRecordHomepageCache, MedicalRecordHomepageCacheIds> {

    public MedicalRecordHomepageCache findByMasterId(String masterId);

    @Modifying
    @Query("update MedicalRecordHomepageCache  m set  m.isAdd = 1  where  m.masterId = ?1 and m.isAdd = 0")
    public void updateIsValid(String masterId);

}
