package com.flossom.system.service.impl;

import java.util.List;

import com.flossom.common.core.domain.entity.WxScriptMessage;
import com.flossom.common.core.mapper.WxScriptMessageMapper;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxScriptMessageService;

/**
 * 消息模版Service业务层处理
 *
 * @author flossom
 * @date 2023-12-22
 */
@Service
public class WxScriptMessageServiceImpl implements IWxScriptMessageService
{
    @Autowired
    private WxScriptMessageMapper wxScriptMessageMapper;

    /**
     * 查询消息模版
     *
     * @param id 消息模版主键
     * @return 消息模版
     */
    @Override
    public WxScriptMessage selectWxScriptMessageById(Long id)
    {
        return wxScriptMessageMapper.selectWxScriptMessageById(id);
    }

    /**
     * 查询消息模版列表
     *
     * @param wxScriptMessage 消息模版
     * @return 消息模版
     */
    @Override
    public List<WxScriptMessage> selectWxScriptMessageList(WxScriptMessage wxScriptMessage)
    {
        return wxScriptMessageMapper.selectWxScriptMessageList(wxScriptMessage);
    }

    /**
     * 新增消息模版
     *
     * @param wxScriptMessage 消息模版
     * @return 结果
     */
    @Override
    public int insertWxScriptMessage(WxScriptMessage wxScriptMessage)
    {
        wxScriptMessage.setCreateTime(DateUtils.getNowDate());
        wxScriptMessage.setCreateBy(SecurityUtils.getUsername());
        return wxScriptMessageMapper.insertWxScriptMessage(wxScriptMessage);
    }

    /**
     * 修改消息模版
     *
     * @param wxScriptMessage 消息模版
     * @return 结果
     */
    @Override
    public int updateWxScriptMessage(WxScriptMessage wxScriptMessage)
    {
        wxScriptMessage.setUpdateTime(DateUtils.getNowDate());
        wxScriptMessage.setUpdateBy(SecurityUtils.getUsername());
        return wxScriptMessageMapper.updateWxScriptMessage(wxScriptMessage);
    }

    /**
     * 批量删除消息模版
     *
     * @param ids 需要删除的消息模版主键
     * @return 结果
     */
    @Override
    public int deleteWxScriptMessageByIds(Long[] ids)
    {
        return wxScriptMessageMapper.deleteWxScriptMessageByIds(ids);
    }

    /**
     * 删除消息模版信息
     *
     * @param id 消息模版主键
     * @return 结果
     */
    @Override
    public int deleteWxScriptMessageById(Long id)
    {
        return wxScriptMessageMapper.deleteWxScriptMessageById(id);
    }
}
