package com.ruoyi.ss.complaint.service;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.complaint.domain.SmComplaint;
import com.ruoyi.ss.complaint.domain.SmComplaintQuery;
import com.ruoyi.ss.complaint.domain.SmComplaintVo;
import com.ruoyi.ss.complaint.mapper.SmComplaintMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 投诉Service业务层处理
 *
 * @author ruoyi
 * @date 2024-03-02
 */
@Service
public class SmComplaintServiceImpl implements ISmComplaintService
{
    @Autowired
    private SmComplaintMapper smComplaintMapper;

    /**
     * 查询投诉
     *
     * @param id 投诉主键
     * @return 投诉
     */
    @Override
    public SmComplaintVo selectSmComplaintById(Long id)
    {
        return smComplaintMapper.selectSmComplaintById(id);
    }

    /**
     * 查询投诉列表
     *
     * @param smComplaint 投诉
     * @return 投诉
     */
    @Override
    public List<SmComplaintVo> selectSmComplaintList(SmComplaintQuery smComplaint)
    {
        return smComplaintMapper.selectSmComplaintList(smComplaint);
    }

    /**
     * 新增投诉
     *
     * @param smComplaint 投诉
     * @return 结果
     */
    @Override
    public int insertSmComplaint(SmComplaint smComplaint)
    {
        smComplaint.setCreateTime(DateUtils.getNowDate());
        return smComplaintMapper.insertSmComplaint(smComplaint);
    }

    /**
     * 修改投诉
     *
     * @param smComplaint 投诉
     * @return 结果
     */
    @Override
    public int updateSmComplaint(SmComplaint smComplaint)
    {
        return smComplaintMapper.updateSmComplaint(smComplaint);
    }

    /**
     * 批量删除投诉
     *
     * @param ids 需要删除的投诉主键
     * @return 结果
     */
    @Override
    public int deleteSmComplaintByIds(Long[] ids)
    {
        return smComplaintMapper.deleteSmComplaintByIds(ids);
    }

    /**
     * 删除投诉信息
     *
     * @param id 投诉主键
     * @return 结果
     */
    @Override
    public int deleteSmComplaintById(Long id)
    {
        return smComplaintMapper.deleteSmComplaintById(id);
    }

    @Override
    public int selectCount(SmComplaintQuery query) {
        return smComplaintMapper.selectCount(query);
    }
}
