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.FactoryPageReqVO;
import com.zt.plat.module.base.dal.dataobject.base.FactoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 工厂 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface FactoryMapper extends BaseMapperX<FactoryDO> {

    default PageResult<FactoryDO> selectPage(FactoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FactoryDO>()
                .likeIfPresent(FactoryDO::getCompanyNumber, reqVO.getCompanyNumber())
                .likeIfPresent(FactoryDO::getCpnName, reqVO.getCpnName())
                .likeIfPresent(FactoryDO::getErpCompanyNumber, reqVO.getErpCompanyNumber())
                .likeIfPresent(FactoryDO::getErpCompanyName, reqVO.getErpCompanyName())
                .likeIfPresent(FactoryDO::getName, reqVO.getName())
                .likeIfPresent(FactoryDO::getNumber, reqVO.getNumber())
                .betweenIfPresent(FactoryDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(FactoryDO::getIsEnable, reqVO.getIsEnable())
                .likeIfPresent(FactoryDO::getErpName, reqVO.getErpName())
                .likeIfPresent(FactoryDO::getErpNumber, reqVO.getErpNumber())
                .orderByDesc(FactoryDO::getId));
    }

    String selectMaxCode();
}