package com.fs.course.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.common.utils.DateUtils;
import com.fs.course.domain.FsUserCourseComplaintRecord;
import com.fs.course.mapper.FsUserCourseComplaintRecordMapper;
import com.fs.course.param.UserCourseComplaintRecordParam;
import com.fs.course.service.IFsUserCourseComplaintRecordService;
import com.fs.course.vo.FsUserCourseComplaintRecordPageListVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 看课投诉记录Service业务层处理
 *
 * @author fs
 * @date 2025-06-04
 */
@Service
public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCourseComplaintRecordMapper, FsUserCourseComplaintRecord> implements IFsUserCourseComplaintRecordService {

    /**
     * 查询看课投诉记录
     *
     * @param recordId 看课投诉记录主键
     * @return 看课投诉记录
     */
    @Override
    public FsUserCourseComplaintRecord selectFsUserCourseComplaintRecordByRecordId(Long recordId)
    {
        return baseMapper.selectFsUserCourseComplaintRecordByRecordId(recordId);
    }

    /**
     * 查询看课投诉记录列表
     *
     * @param fsUserCourseComplaintRecord 看课投诉记录
     * @return 看课投诉记录
     */
    @Override
    public List<FsUserCourseComplaintRecordPageListVO> selectFsUserCourseComplaintRecordList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
    {
        return baseMapper.selectFsUserCourseComplaintRecordPageList(fsUserCourseComplaintRecord);
    }

    /**
     * 新增看课投诉记录
     *
     * @param fsUserCourseComplaintRecord 看课投诉记录
     * @return 结果
     */
    @Override
    public int insertFsUserCourseComplaintRecord(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
    {
        fsUserCourseComplaintRecord.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertFsUserCourseComplaintRecord(fsUserCourseComplaintRecord);
    }

    /**
     * 修改看课投诉记录
     *
     * @param fsUserCourseComplaintRecord 看课投诉记录
     * @return 结果
     */
    @Override
    public int updateFsUserCourseComplaintRecord(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
    {
        return baseMapper.updateFsUserCourseComplaintRecord(fsUserCourseComplaintRecord);
    }

    /**
     * 批量删除看课投诉记录
     *
     * @param recordIds 需要删除的看课投诉记录主键
     * @return 结果
     */
    @Override
    public int deleteFsUserCourseComplaintRecordByRecordIds(Long[] recordIds)
    {
        return baseMapper.deleteFsUserCourseComplaintRecordByRecordIds(recordIds);
    }

    /**
     * 删除看课投诉记录信息
     *
     * @param recordId 看课投诉记录主键
     * @return 结果
     */
    @Override
    public int deleteFsUserCourseComplaintRecordByRecordId(Long recordId)
    {
        return baseMapper.deleteFsUserCourseComplaintRecordByRecordId(recordId);
    }

    @Override
    public int submitRecord(UserCourseComplaintRecordParam userCourseComplaintRecordParam) {
        FsUserCourseComplaintRecord fsUserCourseComplaintRecord = new FsUserCourseComplaintRecord();
        BeanUtils.copyProperties(userCourseComplaintRecordParam, fsUserCourseComplaintRecord);
        fsUserCourseComplaintRecord.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertFsUserCourseComplaintRecord(fsUserCourseComplaintRecord);
    }
}
