package com.bonus.canteen.core.supply.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.supply.domain.DrpSupplier;
import com.bonus.canteen.core.supply.dto.DrpMaterialInfoDTO;
import com.bonus.canteen.core.supply.dto.DrpSupplierPageDTO;
import com.bonus.canteen.core.supply.dto.DrpSupplierQueryDTO;
import com.bonus.canteen.core.supply.dto.DrpSupplierScorePageDTO;
import com.bonus.canteen.core.supply.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DrpSupplierMapper extends BaseMapper<DrpSupplier> {


    @Select({"select MAX(supplier_num) from drp_supplier where del_flag = #{delFlag} and LENGTH(supplier_num ) = #{length}"})
    String getMaxSupplierNum(@Param("delFlag") Integer delFlag, @Param("length") Integer length);

    @Select({"select a.supplier_id,a.supplier_name from drp_supplier a where a.supplier_user_id = #{userId}"})
    DrpSupplierVO listSupplierByUserId(@Param("userId") Long userId);

    List<DrpSupplierPageVO> selectAllList(@Param("content")  DrpSupplierPageDTO content, @Param("delFlag") Integer delFlag);

    List<DrpSupplierVO> listSupplier(@Param("status") Integer status, @Param("delFlag") Integer delFlag, @Param("content") DrpSupplierQueryDTO content);

    List<DrpMaterialSupplierVO> getCategorySupplier(@Param("content") DrpMaterialInfoDTO content);

    DrpSupplierMainInfoVO getSupplierMainInfoById(@Param("supplierId") Long supplierId);

    List<DrpSupplierScorePageVO> pageSupplier(@Param("content") DrpSupplierScorePageDTO content, @Param("delFlag") Integer delFlag);
}
