package com.ruoyi.frequency.platformanswertype.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.platformanswertype.mapper.PlatformAnswerTypeMapper;
import com.ruoyi.frequency.platformanswertype.entity.PlatformAnswerType;
import com.ruoyi.frequency.platformanswertype.service.PlatformAnswerTypeService;

/**
 * 平台有问必答类型Service业务层处理
 *
 * @author liwenlong
 * @date 2024-02-21
 */
@Service
public class PlatformAnswerTypeServiceImpl extends ServiceImpl<PlatformAnswerTypeMapper, PlatformAnswerType>  implements PlatformAnswerTypeService
{
    @Autowired
    private PlatformAnswerTypeMapper platformAnswerTypeMapper;

    /**
     * 查询平台有问必答类型
     *
     * @param id 平台有问必答类型主键
     * @return 平台有问必答类型
     */
    @Override
    public PlatformAnswerType selectPlatformAnswerTypeById(Long id)
    {
        return platformAnswerTypeMapper.selectPlatformAnswerTypeById(id);
    }

    /**
     * 查询平台有问必答类型列表
     *
     * @param platformAnswerType 平台有问必答类型
     * @return 平台有问必答类型
     */
    @Override
    public List<PlatformAnswerType> selectPlatformAnswerTypeList(PlatformAnswerType platformAnswerType)
    {
        return platformAnswerTypeMapper.selectPlatformAnswerTypeList(platformAnswerType);
    }

    /**
     * 新增平台有问必答类型
     *
     * @param platformAnswerType 平台有问必答类型
     * @return 结果
     */
    @Override
    public int insertPlatformAnswerType(PlatformAnswerType platformAnswerType)
    {
        platformAnswerType.setCreateData();
        platformAnswerType.setUpdateData();
        return platformAnswerTypeMapper.insert(platformAnswerType);
    }

    /**
     * 修改平台有问必答类型
     *
     * @param platformAnswerType 平台有问必答类型
     * @return 结果
     */
    @Override
    public int updatePlatformAnswerType(PlatformAnswerType platformAnswerType)
    {
        platformAnswerType.setUpdateData();
        return platformAnswerTypeMapper.updatePlatformAnswerType(platformAnswerType);
    }

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

}
