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

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.erp.controller.admin.erp.vo.ErpAssetPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpAssetDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * ERP资产卡片 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ErpAssetMapper extends BaseMapperX<ErpAssetDO> {

    default PageResult<ErpAssetDO> selectPage(ErpAssetPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpAssetDO>()
                .likeIfPresent(ErpAssetDO::getCompanyNumber, reqVO.getCompanyNumber())
                .likeIfPresent(ErpAssetDO::getMainAssetNumber, reqVO.getMainAssetNumber())
                .betweenIfPresent(ErpAssetDO::getRecordCreateDate, reqVO.getRecordCreateDate())
                .likeIfPresent(ErpAssetDO::getUpdateUserName, reqVO.getUpdateUserName())
                .likeIfPresent(ErpAssetDO::getAssetTypeNumber, reqVO.getAssetTypeNumber())
                .likeIfPresent(ErpAssetDO::getAssetTypeName, reqVO.getAssetTypeName())
                .betweenIfPresent(ErpAssetDO::getAssetDate, reqVO.getAssetDate())
                .eqIfPresent(ErpAssetDO::getUom, reqVO.getUom())
                .eqIfPresent(ErpAssetDO::getQuantity, reqVO.getQuantity())
                .likeIfPresent(ErpAssetDO::getAssetDescription, reqVO.getAssetDescription())
                .likeIfPresent(ErpAssetDO::getAssetDescriptionAttach, reqVO.getAssetDescriptionAttach())
                .betweenIfPresent(ErpAssetDO::getDepreciationStartDate, reqVO.getDepreciationStartDate())
                .eqIfPresent(ErpAssetDO::getPlanYearDate, reqVO.getPlanYearDate())
                .eqIfPresent(ErpAssetDO::getCostcenterNumber, reqVO.getCostcenterNumber())
                .eqIfPresent(ErpAssetDO::getDutyCostcenterNumber, reqVO.getDutyCostcenterNumber())
                .orderByDesc(ErpAssetDO::getId));
    }

}