package com.yiqi.app.service.impl;

import java.util.List;

import com.yiqi.common.enums.FeedbackStatus;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.DictUtils;
import com.yiqi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.app.mapper.AppFeedbackMapper;
import com.yiqi.app.domain.AppFeedback;
import com.yiqi.app.service.IAppFeedbackService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * APP意见反馈Service业务层处理
 *
 * @author ruoyi
 * @date 2023-11-08
 */
@Service
public class AppFeedbackServiceImpl extends ServiceImpl<AppFeedbackMapper,AppFeedback> implements IAppFeedbackService {

    /**
     * 查询APP意见反馈
     *
     * @param id APP意见反馈主键
     * @return APP意见反馈
     */
    @Override
    public AppFeedback selectAppFeedbackById(Long id) {
        return baseMapper.selectAppFeedbackById(id);
    }

    /**
     * 查询APP意见反馈列表
     *
     * @param appFeedback APP意见反馈
     * @return APP意见反馈
     */
    @Override
    public List<AppFeedback> selectAppFeedbackList(AppFeedback appFeedback) {
        return baseMapper.selectAppFeedbackList(appFeedback);
    }

    /**
     * 新增APP意见反馈
     *
     * @param appFeedback APP意见反馈
     * @return 结果
     */
    @Override
    public int insertAppFeedback(AppFeedback appFeedback) {
        appFeedback.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertAppFeedback(appFeedback);
    }

    /**
     * 修改APP意见反馈
     *
     * @param appFeedback APP意见反馈
     * @return 结果
     */
    @Override
    public int updateAppFeedback(AppFeedback appFeedback) {
        appFeedback.setUpdateTime(DateUtils.getNowDate());
        appFeedback.setStatus(FeedbackStatus.HAS_DEAL.getCode());
        return baseMapper.updateAppFeedback(appFeedback);
    }

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

    /**
     * 删除APP意见反馈信息
     *
     * @param id APP意见反馈主键
     * @return 结果
     */
    @Override
    public int deleteAppFeedbackById(Long id) {
        return baseMapper.deleteAppFeedbackById(id);
    }

    /**
     * 修改APP意见反馈状态
     *
     * @param appFeedback APP意见反馈
     * @return 结果
     */
    @Override
    public int updateAppFeedbackStatus(AppFeedback appFeedback) {
        appFeedback.setUpdateById(SecurityUtils.getUserId());
        appFeedback.setUpdateBy(SecurityUtils.getUsername());
        appFeedback.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateAppFeedback(appFeedback);
    }


}
