package com.game.business.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.game.business.mapper.ShopSubOrderMapper;
import com.game.business.domain.ShopSubOrder;
import com.game.business.service.IShopSubOrderService;
import com.game.common.annotation.DataSource;
import com.game.common.enums.DataSourceType;

/**
 * 订单商品Service业务层处理
 *
 * @author game
 * @date 2024-09-06
 */
@Service
public class ShopSubOrderServiceImpl extends ServiceImpl<ShopSubOrderMapper, ShopSubOrder> implements IShopSubOrderService {
    @Autowired
    private ShopSubOrderMapper shopSubOrderMapper;

    /**
     * 查询订单商品
     *
     * @param id 订单商品主键
     * @return 订单商品
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public ShopSubOrder selectShopSubOrderById(Long id) {
        return shopSubOrderMapper.selectShopSubOrderById(id);
    }

    /**
     * 查询订单商品列表
     *
     * @param shopSubOrder 订单商品
     * @return 订单商品
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public List<ShopSubOrder> selectShopSubOrderList(ShopSubOrder shopSubOrder) {
        return shopSubOrderMapper.selectShopSubOrderList(shopSubOrder);
    }

    /**
     * 新增订单商品
     *
     * @param shopSubOrder 订单商品
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int insertShopSubOrder(ShopSubOrder shopSubOrder) {
            return shopSubOrderMapper.insertShopSubOrder(shopSubOrder);
    }

    /**
     * 修改订单商品
     *
     * @param shopSubOrder 订单商品
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int updateShopSubOrder(ShopSubOrder shopSubOrder) {
        return shopSubOrderMapper.updateShopSubOrder(shopSubOrder);
    }

    /**
     * 批量删除订单商品
     *
     * @param ids 需要删除的订单商品主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteShopSubOrderByIds(Long[] ids) {
        return shopSubOrderMapper.deleteShopSubOrderByIds(ids);
    }

    /**
     * 删除订单商品信息
     *
     * @param id 订单商品主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteShopSubOrderById(Long id) {
        return shopSubOrderMapper.deleteShopSubOrderById(id);
    }
}