package com.ssj.dao.weixin.problem.dao;

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

import java.util.List;


@Repository
public interface ArticeDao extends JpaRepository<Artice, String>{
	
	@Query(nativeQuery = true, value = "update ydz_artice set  number = ?2  where id = ?1 ")
	 @Modifying
	 public void updatenum(String id, Integer number);

	@Query(nativeQuery = true, value = "select * from  ydz_artice where  grade = ?1 limit 1")
	public Artice findInfoByName(String grad);

	@Query(nativeQuery = true, value = "select * from  ydz_artice where  grade = ?1 and version = ?2 order by number asc")
	public List<Artice> findArticeList(String grade, int version);
	 

}
