package com.zt.plat.module.base.dal.mysql.base;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.base.vo.MaterialDestroyPageReqVO;
import com.zt.plat.module.base.dal.dataobject.base.MaterialDestroyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 物料回收率 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface MaterialDestroyMapper extends BaseMapperX<MaterialDestroyDO> {

    default PageResult<MaterialDestroyDO> selectPage(MaterialDestroyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDestroyDO>()
                .likeIfPresent(MaterialDestroyDO::getUpNumber, reqVO.getUpNumber())
                .likeIfPresent(MaterialDestroyDO::getUpName, reqVO.getUpName())
                .likeIfPresent(MaterialDestroyDO::getDownNumber, reqVO.getDownNumber())
                .likeIfPresent(MaterialDestroyDO::getDownName, reqVO.getDownName())
                .eqIfPresent(MaterialDestroyDO::getRatio, reqVO.getRatio())
                .eqIfPresent(MaterialDestroyDO::getOperation, reqVO.getOperation())
                .betweenIfPresent(MaterialDestroyDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(MaterialDestroyDO::getSupplierNumber, reqVO.getSupplierNumber())
                .likeIfPresent(MaterialDestroyDO::getSupplierName, reqVO.getSupplierName())
                .likeIfPresent(MaterialDestroyDO::getSendUnit, reqVO.getSendUnit())
                .likeIfPresent(MaterialDestroyDO::getReceiveUnit, reqVO.getReceiveUnit())
                .eqIfPresent(MaterialDestroyDO::getIsEnable, reqVO.getIsEnable())
                .orderByDesc(MaterialDestroyDO::getId));
    }

}