package com.YuyeTech.TPlat.service.impl;

import com.YuyeTech.TPlat.service.WxInfoService;
import com.YuyeTech.TPlat.dataobject.WxInfo;
import com.YuyeTech.TPlat.repository.WxInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author:slambb
 * @date:2019/12/13
 */
@Service
public class WxInfoServicelmpl implements WxInfoService {
    @Autowired
    private WxInfoRepository wxInfoRepository;

    @Override
    public WxInfo findWxInfoByOpenid(String openid) {
        return wxInfoRepository.findByOpenid(openid);
    }

    @Override
    public WxInfo addWxInfo(WxInfo wxInfo) {
        return wxInfoRepository.save(wxInfo);
    }

    @Override
    public WxInfo findWxInfoById(String userId) {
        return wxInfoRepository.findById(userId).orElse(null);
    }
}
