package com.ssj.dao.weixin.story.dao;

import com.ssj.bean.weixin.story.bean.StoryTaskMedal;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


/** 
 * @author  ZhangCaibao 
 * @version 2018年3月21日 上午10:57:48 
 * 类说明 
 */
@Repository
public interface StoryTaskMedalDao extends JpaRepository<StoryTaskMedal, String>{

	@Query(nativeQuery = true, value = " select  *  from  tb_story_task_medal  where story_id=?1 and days_num = ?2")
	StoryTaskMedal  findByStoryIdAndDaysNum(String storyId,Integer daysNum);
	@Query(nativeQuery = true, value = " select  *  from  tb_story_task_medal  where user_id=?1 ")
	List<StoryTaskMedal> getMedalByUserId(String userId);
	@Query(nativeQuery = true, value = " select  name  from  tb_story_task_medal  where user_id=?1 ")
	List<String>  getMedalNameByUserId(String userId);
	@Query(nativeQuery = true, value = " select  count(1)  from  tb_story_task_medal  where user_id=?1 ")
	int  getMedalNameByUserIdCount(String userId);
}
