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

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.playlet.system.domain.PlayletAdviceFeedback;
import com.playlet.system.service.IPlayletAdviceFeedbackService;
import com.playlet.web.service.app.PlayletFeedbackAppService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletFeedbackAppServiceImpl implements PlayletFeedbackAppService {

    private final IPlayletAdviceFeedbackService iPlayletAdviceFeedbackService;

    @Override
    public void add(PlayletAdviceFeedback playletAdviceFeedback) {
        iPlayletAdviceFeedbackService.insertPlayletAdviceFeedback(playletAdviceFeedback);
    }

    @Override
    public PageInfo<PlayletAdviceFeedback> getFeedBackList(PlayletAdviceFeedback playletAdviceFeedback, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<PlayletAdviceFeedback> list = iPlayletAdviceFeedbackService.selectPlayletAdviceFeedbackList(playletAdviceFeedback);
        return PageInfo.of(list);
    }
}
