package com.ruoyi.frequency.orderpanorama.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.orderpanorama.mapper.OrderPanoramaMapper;
import com.ruoyi.frequency.orderpanorama.entity.OrderPanorama;
import com.ruoyi.frequency.orderpanorama.service.OrderPanoramaService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 订单和3D链接关联Service业务层处理
 *
 * @author zj
 * @date 2023-10-13
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class OrderPanoramaServiceImpl extends ServiceImpl<OrderPanoramaMapper, OrderPanorama>  implements OrderPanoramaService
{
    @Autowired
    private OrderPanoramaMapper orderPanoramaMapper;

    /**
     * 查询订单和3D链接关联
     *
     * @param id 订单和3D链接关联主键
     * @return 订单和3D链接关联
     */
    @Override
    public OrderPanorama selectOrderPanoramaById(Long id)
    {
        return orderPanoramaMapper.selectOrderPanoramaById(id);
    }

    /**
     * 查询订单和3D链接关联列表
     *
     * @param orderPanorama 订单和3D链接关联
     * @return 订单和3D链接关联
     */
    @Override
    public List<OrderPanorama> selectOrderPanoramaList(OrderPanorama orderPanorama)
    {
        return orderPanoramaMapper.selectOrderPanoramaList(orderPanorama);
    }

    /**
     * 新增订单和3D链接关联
     *
     * @param orderPanorama 订单和3D链接关联
     * @return 结果
     */
    @Override
    public int insertOrderPanorama(OrderPanorama orderPanorama)
    {
        return orderPanoramaMapper.insertOrderPanorama(orderPanorama);
    }

    /**
     * 修改订单和3D链接关联
     *
     * @param orderPanorama 订单和3D链接关联
     * @return 结果
     */
    @Override
    public int updateOrderPanorama(OrderPanorama orderPanorama)
    {
        orderPanorama.setUpdateTime(DateUtils.getNowDate());
        return orderPanoramaMapper.updateOrderPanorama(orderPanorama);
    }

    /**
     * 批量删除订单和3D链接关联
     *
     * @param ids 需要删除的订单和3D链接关联主键
     * @return 结果
     */
    @Override
    public int deleteOrderPanoramaByIds(Long[] ids)
    {
        this.lambdaUpdate().set(OrderPanorama::getDelFlag,PublicCommon.删除).in(OrderPanorama::getId,ids).update();
        return ids.length;
    }

    /**
     * 删除订单和3D链接关联信息
     *
     * @param id 订单和3D链接关联主键
     * @return 结果
     */
    @Override
    public int deleteOrderPanoramaById(Long id)
    {
        this.lambdaUpdate().set(OrderPanorama::getDelFlag,PublicCommon.删除).eq(OrderPanorama::getId,id).update();
        return 1;
    }
}
