package com.ruoyi.ss.feedback.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.feedback.domain.Feedback;
import com.ruoyi.ss.feedback.mapper.FeedbackMapper;
import com.ruoyi.ss.feedback.service.IFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

import static com.ruoyi.common.utils.SecurityUtils.getUsername;

/**
 * 反馈意见Service业务层处理
 *
 * @author qzz
 * @date 2024-10-18
 */
@Service
public class FeedbackServiceImpl implements IFeedbackService
{
    @Resource
    private FeedbackMapper asFeedbackMapper;

    /**
     * 查询反馈意见
     *
     * @param feedbackId 反馈意见主键
     * @return 反馈意见
     */
    @Override
    public Feedback selectAsFeedbackByFeedbackId(Long feedbackId)
    {
        return asFeedbackMapper.selectAsFeedbackByFeedbackId(feedbackId);
    }

    /**
     * 查询反馈意见列表
     *
     * @param asFeedback 反馈意见
     * @return 反馈意见
     */
    @Override
    public List<Feedback> selectAsFeedbackList(Feedback asFeedback)
    {
        return asFeedbackMapper.selectAsFeedbackList(asFeedback);
    }

    /**
     * 新增反馈意见
     *
     * @param asFeedback 反馈意见
     * @return 结果
     */
    @Override
    public int insertAsFeedback(Feedback asFeedback)
    {
        asFeedback.setCreateTime(DateUtils.getNowDate());
        asFeedback.setCreateBy(getUsername());
        return asFeedbackMapper.insertAsFeedback(asFeedback);
    }

    /**
     * 修改反馈意见
     *
     * @param asFeedback 反馈意见
     * @return 结果
     */
    @Override
    public int updateAsFeedback(Feedback asFeedback)
    {
        return asFeedbackMapper.updateAsFeedback(asFeedback);
    }

    /**
     * 批量删除反馈意见
     *
     * @param feedbackIds 需要删除的反馈意见主键
     * @return 结果
     */
    @Override
    public int deleteAsFeedbackByFeedbackIds(Long[] feedbackIds)
    {
        return asFeedbackMapper.deleteAsFeedbackByFeedbackIds(feedbackIds);
    }

    /**
     * 删除反馈意见信息
     *
     * @param feedbackId 反馈意见主键
     * @return 结果
     */
    @Override
    public int deleteAsFeedbackByFeedbackId(Long feedbackId)
    {
        return asFeedbackMapper.deleteAsFeedbackByFeedbackId(feedbackId);
    }
}
