package com.ruoyi.frequency.platformanswer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.PublicCommon;
import com.ruoyi.frequency.platformanswer.mapper.PlatformAnswerMapper;
import com.ruoyi.frequency.platformanswer.entity.PlatformAnswer;
import com.ruoyi.frequency.platformanswer.service.PlatformAnswerService;

/**
 * 平台有问必答Service业务层处理
 *
 * @author liwenlong
 * @date 2024-01-24
 */
@Service
public class PlatformAnswerServiceImpl extends ServiceImpl<PlatformAnswerMapper, PlatformAnswer>  implements PlatformAnswerService
{
    @Autowired
    private PlatformAnswerMapper platformAnswerMapper;

    /**
     * 查询平台有问必答
     *
     * @param id 平台有问必答主键
     * @return 平台有问必答
     */
    @Override
    public PlatformAnswer selectPlatformAnswerById(Long id)
    {
        return platformAnswerMapper.selectPlatformAnswerById(id);
    }

    /**
     * 查询平台有问必答列表
     *
     * @param platformAnswer 平台有问必答
     * @return 平台有问必答
     */
    @Override
    public List<PlatformAnswer> selectPlatformAnswerList(PlatformAnswer platformAnswer)
    {
        return platformAnswerMapper.selectPlatformAnswerList(platformAnswer);
    }

    /**
     * 新增平台有问必答
     *
     * @param platformAnswer 平台有问必答
     * @return 结果
     */
    @Override
    public int insertPlatformAnswer(PlatformAnswer platformAnswer)
    {
        platformAnswer.setCreateData();
        return platformAnswerMapper.insert(platformAnswer);
    }

    /**
     * 修改平台有问必答
     *
     * @param platformAnswer 平台有问必答
     * @return 结果
     */
    @Override
    public int updatePlatformAnswer(PlatformAnswer platformAnswer)
    {
        platformAnswer.setUpdateData();
        return platformAnswerMapper.updatePlatformAnswer(platformAnswer);
    }

    /**
     * 批量删除平台有问必答
     *
     * @param ids 需要删除的平台有问必答主键
     * @return 结果
     */
    @Override
    public int deletePlatformAnswerByIds(Long[] ids,Integer delFlag)
    {
        this.lambdaUpdate().set(PlatformAnswer::getDelFlag,delFlag).in(PlatformAnswer::getId,ids).update();
        return ids.length;
    }

}
