package com.zt.plat.module.qms.office.supplier.dal.mapper;

import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierPropertiesDO;
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierPropertiesPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 供应商属性 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface SupplierPropertiesMapper extends BaseMapperX<SupplierPropertiesDO> {

    default PageResult<SupplierPropertiesDO> selectPage(SupplierPropertiesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplierPropertiesDO>()
                .eqIfPresent(SupplierPropertiesDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(SupplierPropertiesDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(SupplierPropertiesDO::getBusinessCode, reqVO.getBusinessCode())
                .eqIfPresent(SupplierPropertiesDO::getSubitemCode, reqVO.getSubitemCode())
                .likeIfPresent(SupplierPropertiesDO::getName, reqVO.getName())
                .eqIfPresent(SupplierPropertiesDO::getContent, reqVO.getContent())
                .betweenIfPresent(SupplierPropertiesDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(SupplierPropertiesDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(SupplierPropertiesDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(SupplierPropertiesDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(SupplierPropertiesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SupplierPropertiesDO::getId));
    }
    default List<SupplierPropertiesDO> selectList(SupplierPropertiesPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<SupplierPropertiesDO>()
                .eqIfPresent(SupplierPropertiesDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(SupplierPropertiesDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(SupplierPropertiesDO::getBusinessCode, reqVO.getBusinessCode())
                .eqIfPresent(SupplierPropertiesDO::getSubitemCode, reqVO.getSubitemCode())
                .orderByDesc(SupplierPropertiesDO::getId));
    }

}