package com.ssj.service.weixin.user.service.impl;

import com.ssj.bean.weixin.user.domain.UserAccount;
import com.ssj.dao.weixin.user.dao.UserAccountDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.weixin.user.service.UserAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/** 
 * @author  ZhangCaibao 
 * @version 2018年2月2日 下午4:11:26 
 * 类说明 
 */
@Service
@Transactional
public class UserAccountServiceImpl extends BaseServiceImpl<UserAccount, String> implements  UserAccountService{
	
	
	@Autowired
	private UserAccountDao userAccountDao;
	
	@Override
	public PagingAndSortingRepository<UserAccount, String> getDao() {
		return userAccountDao;
	}

	@Override
	public UserAccount findUserAccountByOpenid(String openid) {
		return userAccountDao.findUserAccountByOpenid(openid);
	}

	@Override
	public List<UserAccount> findUserAccountByUserId(String userId) {
		return userAccountDao.findUserAccountByUserId(userId);
	}

	@Override
	public void updateByOpenId(String openid, String unionid) {
		userAccountDao.updateByOpenId(openid, unionid);		
	}

	@Override
	public void updateByUserId(String wxUserId,String mobileUserId) {
		userAccountDao.updateByUserId(wxUserId,mobileUserId);
	}

	@Override
	public UserAccount findByUserIdAndType(String userId, int type) {
		return userAccountDao.findByUserIdAndType(userId, type);
	}

	@Override
	public void updateUserIdByUnionId(String unionid, String userId) {
		 userAccountDao.updateUserIdByUnionId(unionid, userId);
		
	}

	@Override
	public void updateOpenIdAndAppIdByUserId(String userId){
		userAccountDao.updateOpenIdAndAppIdByUserId(userId);
	}

	@Override
	public List<UserAccount> findByUserId(String userId){
	return 	userAccountDao.findByUserId(userId);
	}


	@Override
	public void deleteByUserId(String userId){
		 	userAccountDao.deleteByUserId(userId);
	}
}
