package com.pj.tb_orders_cart;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pj.tb_orders_cart.vo.OrderListVo;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Service: tb_orders_cart -- 订单购物车
 *
 * @author linbl
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class TbOrdersCartService extends ServiceImpl<TbOrdersCartMapper, TbOrdersCart> implements IService<TbOrdersCart> {

    /**
     * 底层 Mapper 对象
     */
    @Autowired
    TbOrdersCartMapper tbOrdersCartMapper;

    /**
     * 增
     */
    void add(TbOrdersCart t) {
        save(t);
    }

    /**
     * 删
     */
    void delete(Long id) {
        removeById(id);
    }

    /**
     * 改
     */
    void update(TbOrdersCart t) {
        updateById(t);

    }

    TbOrdersCart selectByOrderIdAndUserId(TbOrdersCart cart) {
        return tbOrdersCartMapper.selectByOrderIdAndUserId(cart);
    }

    /**
     * 查
     */
    TbOrdersCart getById(String id) {
        return super.getById(id);
    }

    /**
     * 查集合 - 根据条件（参数为空时代表忽略指定条件）
     */
    List<TbOrdersCart> getList(SoMap so) {
        return tbOrdersCartMapper.getList(so);
    }

    List<OrderListVo> getOrderList(SoMap so) {
        return tbOrdersCartMapper.getOrderList(so);
    }

}
