package com.fs.his.mapper;

import java.util.List;
import com.fs.his.domain.FsStoreOrderItem;
import com.fs.his.vo.FsStoreOrderItemExcelVO;
import com.fs.his.vo.FsStoreOrderItemListDVO;
import com.fs.his.vo.FsStoreOrderItemListUVO;
import com.fs.his.vo.FsStoreOrderItemVO;
import org.apache.ibatis.annotations.Select;

/**
 * 订单详情Mapper接口
 *
 * @author fs
 * @date 2023-06-13
 */
public interface FsStoreOrderItemMapper
{
    /**
     * 查询订单详情
     *
     * @param itemId 订单详情主键
     * @return 订单详情
     */
    public FsStoreOrderItem selectFsStoreOrderItemByItemId(String itemId);

    /**
     * 查询订单详情列表
     *
     * @param fsStoreOrderItem 订单详情
     * @return 订单详情集合
     */
    public List<FsStoreOrderItem> selectFsStoreOrderItemList(FsStoreOrderItem fsStoreOrderItem);

    /**
     * 新增订单详情
     *
     * @param fsStoreOrderItem 订单详情
     * @return 结果
     */
    public int insertFsStoreOrderItem(FsStoreOrderItem fsStoreOrderItem);

    /**
     * 修改订单详情
     *
     * @param fsStoreOrderItem 订单详情
     * @return 结果
     */
    public int updateFsStoreOrderItem(FsStoreOrderItem fsStoreOrderItem);

    /**
     * 删除订单详情
     *
     * @param itemId 订单详情主键
     * @return 结果
     */
    public int deleteFsStoreOrderItemByItemId(String itemId);

    /**
     * 批量删除订单详情
     *
     * @param itemIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsStoreOrderItemByItemIds(String[] itemIds);
    @Select("select * from fs_store_order_item where   order_id=#{orderId}")
    List<FsStoreOrderItem> selectFsStoreOrderItemListByOrderId(Long id);
    @Select("select product_id,json_info,num from fs_store_order_item where order_id=#{orderId}")
    List<FsStoreOrderItemListUVO> selectFsStoreOrderItemListUVOByOrderId(Long orderId);

    @Select("select num,json_info->>'$.barCode'as  barCode,json_info->>'$.productName'as  productName,v.cost_price  from fs_store_order_item LEFT JOIN fs_store_product_attr_value v on v.id=product_attr_value_id where order_id=#{orderId}")
    List<FsStoreOrderItemExcelVO> selectFsStoreOrderItemExcelVOListByOrderId(Long orderId);
    @Select("select product_id,json_info,num from fs_store_order_item where order_id=#{orderId}")
    List<FsStoreOrderItemListDVO> selectFsStoreOrderItemListDVOByOrderId(Long orderId);
}
