package com.ruoyi.tjfx.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.tjfx.entity.BaseData;
import com.ruoyi.tjfx.entity.BaseDataVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 基准数据Mapper接口
 */
@Mapper
public interface BaseDataMapper extends BaseMapper<BaseData> {

    /**
     * 根据商品编号和分类ID查询基准数据
     */
    BaseData selectByProductCodeAndCategoryId(@Param("productCode") String productCode,
                                              @Param("categoryId") Long categoryId);
    BaseDataVO selectByProductCode(@Param("productCode") String productCode);


    List<BaseDataVO> findByCategoryId( @Param("categoryId") Long categoryId);
    List<String> selectExistingProductCodes(@Param("codes") List<String> codes);

    IPage<BaseDataVO> selectPageWithJoin(
        Page<BaseDataVO> page,
        @Param("productCode") String productCode,
        @Param("productName") String productName,
        @Param("categoryId") Long categoryId
    );
    void insertBatch(@Param("list") List<BaseData> list);

}
