package com.palmnest.service.virtProject.manager.impl;

import com.palmnest.dao.estateserve.UserAccountDao;
import com.palmnest.model.estateserve.UserAccountRecode;
import com.palmnest.service.impl.GenericManagerImpl;
import com.palmnest.service.virtProject.manager.UserAccountManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userAccountManager")
public class UserAccountManagerImpl extends GenericManagerImpl<UserAccountRecode, Long> implements UserAccountManager {

	private UserAccountDao userAccountDao;

	@Autowired
	public void setUserAccountDao(UserAccountDao userAccountDao) {
		this.userAccountDao = userAccountDao;
		this.dao = userAccountDao;
	}

	@Override
	public List<UserAccountRecode> getUserAccountRecode(String orgId, String openId) {
		return userAccountDao.getUserAccountRecode(orgId, openId);
	}

	@Override
	public List<UserAccountRecode> getUserAccountByAccount(String orgId, String accountId,
														   String openId) {
		return userAccountDao.getUserAccountByAccount(orgId, accountId, openId);
	}

	@Override
	public List<UserAccountRecode> getUserAccountByAccountId(Long accountId) {
		return userAccountDao.getUserAccountByAccountId(accountId);
	}

	@Override
	public int updateUserAccountByAccId(Long accountId) throws Exception {
		return userAccountDao.updateUserAccountByAccId(accountId);
	}

	@Override
	public void updateModel(UserAccountRecode object) {
		userAccountDao.updateObj(object);
	}

	@Override
	public int isHaveAccLogin(String openId, String orgId) throws Exception {
		return userAccountDao.isHaveAccLogin(openId, orgId);
	}

}
