package com.playlet.web.service.app.impl;

import com.playlet.system.domain.PlayletPublicUser;
import com.playlet.system.service.IPlayletPublicUserService;
import com.playlet.web.service.app.PlayletPublicUserAppService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletPublicUserAppServiceImpl implements PlayletPublicUserAppService {

    private final IPlayletPublicUserService iPlayletPublicUserService;

    @Override
    public void addPublicUser(PlayletPublicUser publicUser) {
        iPlayletPublicUserService.insertPlayletPublicUser(publicUser);
    }

    @Override
    public PlayletPublicUser findByUnionIdAndPublicId(PlayletPublicUser publicUser) {
        return iPlayletPublicUserService.lambdaQuery()
                .eq(PlayletPublicUser::getPublicId, publicUser.getPublicId())
                .eq(PlayletPublicUser::getUnionId, publicUser.getUnionId())
                .one();
    }

}
