package com.cftech.mp.fans.dao;

import com.cftech.core.feature.orm.mybatis.Page;
import com.cftech.core.generic.GenericDao;
import com.cftech.mp.fans.model.MpFanssEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface MpFanssMapper extends GenericDao<MpFanssEntity>{
	
//    @CacheEvict(value = { "mpAccounts","countmpAccounts"},key="#p0.getId().toString()")
    long insert(MpFanssEntity mpAccounts); 
	
//	@Cacheable(value="mpAccounts",key="#p0.toString()" )
	List<MpFanssEntity> getMpFans(Long userid);
    
	List<MpFanssEntity> getMpFansAndPage(Page<MpFanssEntity> page, @Param("userid") Long userid);
	
//	@Cacheable(value="countmpAccounts" )
	Long selectFannscounts(@Param("userid") Long userid);
    
	//更新账户 信息
//	@CacheEvict(key="#p0.getId().toString()",value = { "mpAccounts","detail" })
	public void updateByPrimaryKey(MpFanssEntity mpAccounts);
	
	
	//删除账户
//	@CacheEvict(value={ "mpAccounts","countmpAccounts","detail"},key="#p0.toString()")
	int deleteByPrimaryKey(Long id);
	
//	@Cacheable(value="detail",key="#p0.toString()" )
	MpFanssEntity getDetail(Long userid);
	
//	List<MpFanssEntity> getAllMpAccounts();
	
	int insertFannsGroupMapping(@Param("fansgroups") List<MpFansGroupMapping> fansgroups);
	
	//根据openID获取详细信息
	MpFanssEntity getWxUser(String openid);
	
	//根据公众号ID更新获取详细信息
	List<String> getAllWxUser(String AccountId);

	//根据openid更新粉丝信息
	public void updateByOpenId(MpFanssEntity mpAccounts);
	//根据openId删除粉丝
	int deleteByOpenId(String openid);
	/**
	 * 根据省市获取粉丝
	 */
	public List<String> fannsByArea(Map<String, Object> params);
	
	/**
     * 分页查询
     *
     * @param params
     * @return
     */
    List<MpFanssEntity> fetchSearchByPageStore(Map<String, Object> params);
    /**
     * 修改粉丝的标签
     * */
	boolean updateLabelByid(Map<String, Object> params);

	String findopenidById(Long id);

	Integer updateBatchLabelByTags(Map<String, Object> params);
}
