package com.fs.hisStore.service.impl;

import com.fs.hisStore.domain.FsStoreOrderLogsScrm;
import com.fs.hisStore.mapper.FsStoreOrderLogsScrmMapper;
import com.fs.hisStore.service.IFsStoreOrderLogsScrmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 订单操作记录Service业务层处理
 *
 * @author fs
 * @date 2023-08-11
 */
@Service
public class FsStoreOrderLogsScrmServiceImpl implements IFsStoreOrderLogsScrmService
{
    @Autowired
    private FsStoreOrderLogsScrmMapper fsStoreOrderLogsMapper;

    /**
     * 查询订单操作记录
     *
     * @param logsId 订单操作记录主键
     * @return 订单操作记录
     */
    @Override
    public FsStoreOrderLogsScrm selectFsStoreOrderLogsByLogsId(String logsId)
    {
        return fsStoreOrderLogsMapper.selectFsStoreOrderLogsByLogsId(logsId);
    }

    /**
     * 查询订单操作记录列表
     *
     * @param fsStoreOrderLogs 订单操作记录
     * @return 订单操作记录
     */
    @Override
    public List<FsStoreOrderLogsScrm> selectFsStoreOrderLogsList(FsStoreOrderLogsScrm fsStoreOrderLogs)
    {
        return fsStoreOrderLogsMapper.selectFsStoreOrderLogsList(fsStoreOrderLogs);
    }

    /**
     * 新增订单操作记录
     *
     * @param fsStoreOrderLogs 订单操作记录
     * @return 结果
     */
    @Override
    public int insertFsStoreOrderLogs(FsStoreOrderLogsScrm fsStoreOrderLogs)
    {
        return fsStoreOrderLogsMapper.insertFsStoreOrderLogs(fsStoreOrderLogs);
    }

    /**
     * 修改订单操作记录
     *
     * @param fsStoreOrderLogs 订单操作记录
     * @return 结果
     */
    @Override
    public int updateFsStoreOrderLogs(FsStoreOrderLogsScrm fsStoreOrderLogs)
    {
        return fsStoreOrderLogsMapper.updateFsStoreOrderLogs(fsStoreOrderLogs);
    }

    /**
     * 批量删除订单操作记录
     *
     * @param logsIds 需要删除的订单操作记录主键
     * @return 结果
     */
    @Override
    public int deleteFsStoreOrderLogsByLogsIds(String[] logsIds)
    {
        return fsStoreOrderLogsMapper.deleteFsStoreOrderLogsByLogsIds(logsIds);
    }

    /**
     * 删除订单操作记录信息
     *
     * @param logsId 订单操作记录主键
     * @return 结果
     */
    @Override
    public int deleteFsStoreOrderLogsByLogsId(String logsId)
    {
        return fsStoreOrderLogsMapper.deleteFsStoreOrderLogsByLogsId(logsId);
    }

    @Override
    public int create(Long orderId, String type, String msg) {
        FsStoreOrderLogsScrm logs=new FsStoreOrderLogsScrm();
        logs.setOrderId(orderId);
        logs.setChangeType(type);
        logs.setChangeMessage(msg);
        logs.setCreateTime(new Date());
        return fsStoreOrderLogsMapper.insertFsStoreOrderLogs(logs);
    }
}
