package com.ssj.dao.weixin.card.dao;

import com.ssj.bean.weixin.card.domain.LibCardInfo;
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;


@Repository
public interface ILibMainCardDao extends JpaRepository<LibCardInfo, String> {

	LibCardInfo findByCardId(String cardId);
	LibCardInfo findByCardTypeAndStat(String cardType,String stat); //只限于会员卡(会员卡有效的只有一张)
	
	@Modifying
	@Query(nativeQuery = true, value = "update tb_lib_card set stat=?2 where card_type=?1")
	void updateCardStat(String cardType, String stat);
}
