package com.ssj.dao.weixin.goup.dao;

import com.ssj.bean.weixin.goup.domain.GoupTesting;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface GoupTestingDao extends JpaRepository<GoupTesting, String>{


	@Query(nativeQuery = true, value = " SELECT * from tb_goup_testing t where t.app_type=?1 and t.user_id=?2  ORDER BY t.create_time DESC LIMIT 1 ")
    public GoupTesting getGoupTestingByNew(Integer appType,String userId);
	
	@Query(nativeQuery = true, value = " SELECT * from tb_goup_testing t where t.app_type=?1 and t.user_id=?2  ORDER BY t.type DESC LIMIT 1 ")
    public GoupTesting getGoupTestingByTypeNew(Integer appType,String userId);	
	
	@Query(nativeQuery = true, value = " SELECT * from tb_goup_testing t where t.app_type=?1 AND t.type=?2 and t.user_id=?3  ORDER BY t.type DESC,t.train_day asc ")
    public List<GoupTesting> findGoupTestingByList(Integer appType,Integer type,String userId);
	
	
}
