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.ErpCostcenterPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpCostcenterDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * ERP成本中心 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ErpCostcenterMapper extends BaseMapperX<ErpCostcenterDO> {

    default PageResult<ErpCostcenterDO> selectPage(ErpCostcenterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpCostcenterDO>()
                .likeIfPresent(ErpCostcenterDO::getNumber, reqVO.getNumber())
                .likeIfPresent(ErpCostcenterDO::getName, reqVO.getName())
                .eqIfPresent(ErpCostcenterDO::getIsUse, reqVO.getIsUse())
                .eqIfPresent(ErpCostcenterDO::getScopeNumber, reqVO.getScopeNumber())
                .likeIfPresent(ErpCostcenterDO::getScopeName, reqVO.getScopeName())
                .betweenIfPresent(ErpCostcenterDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(ErpCostcenterDO::getEndDate, reqVO.getEndDate())
                .orderByDesc(ErpCostcenterDO::getId));
    }
}