package cn.quantgroup.xyqb.service.user.impl;

import cn.quantgroup.tech.db.DSType;
import cn.quantgroup.tech.db.TargetDataSource;
import cn.quantgroup.xyqb.entity.CustomerLoginEntity;
import cn.quantgroup.xyqb.repository.ICustomerLoginRepository;
import cn.quantgroup.xyqb.service.user.ICustomerLoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by 11 on 2016/12/29.
 */
@Slf4j
@Service
public class CustomerLoginServiceImpl implements ICustomerLoginService {
    @Autowired
    private ICustomerLoginRepository customerLoginRepository;

    @Override
    @TargetDataSource(type = DSType.SLAVE)//查询从库
    public CustomerLoginEntity findSlaveByCustomerId(Long customerId) {
        CustomerLoginEntity customerLogin = customerLoginRepository.findFirstByCustomerId(customerId);
        return customerLogin;
    }
}
