package com.heyu.api.data.dao.vv;
/**
 * <p>
 * 商品表 服务类
 * </p>
 *
 * @author quyixiao
 * @since 2025-08-20
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.heyu.api.data.entity.vv.VvProductEntity;
import com.lz.mybatis.plugin.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface VvProductDao extends BaseMapper<VvProductEntity> {


    VvProductEntity selectVvProductById(@Param("id") Long id);


    Long insertVvProduct(VvProductEntity vvProduct);


    Long insertOrUpdateVvProduct(VvProductEntity vvProduct);


    int updateVvProductById(VvProductEntity vvProduct);


    int updateCoverVvProductById(VvProductEntity vvProduct);


    int deleteVvProductById(@Param("id") Long id);

    @OrderBy(value={VvProductEntity.default_sort},type={OrderType.ASC})
    List<VvProductEntity> selectVvProductByFrontPage(Integer frontPage);


    List<VvProductEntity> selectVvProductByIds(@IN List<Long> id);


    @OrderBy(VvProductEntity.id_)
    List<VvProductEntity> selectVvProductByCondition(IPage page,
                                                     @IF Long id,
                                                     @IF @LIKE String title,
                                                     @IF @Column(VvProductEntity.show_sale_price) @GE BigDecimal minShowSalePrice,
                                                     @IF @Column(VvProductEntity.show_sale_price) @LE BigDecimal maxShowSalePrice,
                                                     @IF @Column(VvProductEntity.real_sale_count) @GE Integer minRealSaleCount,
                                                     @IF @Column(VvProductEntity.real_sale_count) @LE Integer maxRealSaleCount,
                                                     @IF @Column(VvProductEntity.create_timestamp) @GE Long minCreateTimestamp,
                                                     @IF @Column(VvProductEntity.create_timestamp) @LE Long maxCreateTimestamp,
                                                     @IF @Column(VvProductEntity.modify_timestamp) @GE Long minModifyTimestamp,
                                                     @IF @Column(VvProductEntity.modify_timestamp) @LE Long maxModifyTimestamp,
                                                     @IF Integer frontPage,
                                                     @IF String status,
                                                     @IF @OrderBy(VvProductEntity.real_sale_count) String saleCount,
                                                     @IF @OrderBy(VvProductEntity.create_timestamp) String createTimestamp,
                                                     @IF @OrderBy(VvProductEntity.modify_timestamp) String modifyTimestamp
    );


    @OrderBy(value = {VvProductEntity.default_sort},type={OrderType.ASC})
    @ExludeColumn({VvProductEntity.real_sale_count})
    List<VvProductEntity> selectIndexVvProduct(IPage page,
                                               @IF @LIKE String title,
                                               @IF Integer frontPage,
                                               @IF String status,
                                               @IF Integer appCategoryId1,
                                               @IF Integer appCategoryId2,
                                               @IF Integer appCategoryId3,
                                               @IF Integer isTest,
                                               @IF Integer isNew,
                                               @IF Integer isFlash,
                                               @IF @OrderBy(VvProductEntity.show_sale_price) String salePriceSort,
                                               @IF @OrderBy(VvProductEntity.show_sale_count) String saleCountSort,
                                               @IF @OrderBy(VvProductEntity.create_timestamp) String createTimestampSort
    );

    List<VvProductEntity> selectVvProductByProductIds(@IN List<Long> id);




    int updateShowSaleCountAndSaleCount(@Plus Integer showSaleCount,@Plus Integer realSaleCount,@By Long id);
}