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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.frequency.mallevaluate.entity.MallEvaluate;
import com.ruoyi.frequency.mallevaluate.mapper.MallEvaluateMapper;
import com.ruoyi.frequency.mallevaluate.service.MallEvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商城订单评价Service业务层处理
 *
 * @author liwenlong
 * @date 2024-01-25
 */
@Service
public class MallEvaluateServiceImpl extends ServiceImpl<MallEvaluateMapper, MallEvaluate>  implements MallEvaluateService
{
    @Autowired
    private MallEvaluateMapper mallEvaluateMapper;

    /**
     * 查询商城订单评价
     *
     * @param id 商城订单评价主键
     * @return 商城订单评价
     */
    @Override
    public MallEvaluate selectMallEvaluateById(Long id)
    {
        return mallEvaluateMapper.selectMallEvaluateById(id);
    }

    /**
     * 查询商城订单评价列表
     *
     * @param mallEvaluate 商城订单评价
     * @return 商城订单评价
     */
    @Override
    public List<MallEvaluate> selectMallEvaluateList(MallEvaluate mallEvaluate)
    {
        return mallEvaluateMapper.selectMallEvaluateList(mallEvaluate);
    }

    /**
     * 新增商城订单评价
     *
     * @param mallEvaluate 商城订单评价
     * @return 结果
     */
    @Override
    public int insertMallEvaluate(MallEvaluate mallEvaluate)
    {
        mallEvaluate.setCreateData();
        return mallEvaluateMapper.insert(mallEvaluate);
    }

    /**
     * 修改商城订单评价
     *
     * @param mallEvaluate 商城订单评价
     * @return 结果
     */
    @Override
    public int updateMallEvaluate(MallEvaluate mallEvaluate)
    {
        mallEvaluate.setUpdateData();
        return mallEvaluateMapper.updateMallEvaluate(mallEvaluate);
    }

    /**
     * 批量删除商城订单评价
     *
     * @param ids 需要删除的商城订单评价主键
     * @return 结果
     */
    @Override
    public int deleteMallEvaluateByIds(Long[] ids,Integer delFlag)
    {
        this.lambdaUpdate().set(MallEvaluate::getDelFlag,delFlag).in(MallEvaluate::getId,ids).update();
        return ids.length;
    }

}
