package cn.iocoder.yudao.module.smartfactory.dal.mysql.linefixedassets;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.linefixedassets.LineFixedAssetsDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.smartfactory.controller.admin.linefixedassets.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 打包线固定资产 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface LineFixedAssetsMapper extends BaseMapperX<LineFixedAssetsDO> {

    default PageResult<LineFixedAssetsDO> selectPage(LineFixedAssetsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LineFixedAssetsDO>()
                .eqIfPresent(LineFixedAssetsDO::getAssetsNo, reqVO.getAssetsNo())
                .eqIfPresent(LineFixedAssetsDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(LineFixedAssetsDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(LineFixedAssetsDO::getName, reqVO.getName())
                .eqIfPresent(LineFixedAssetsDO::getSku, reqVO.getSku())
                .eqIfPresent(LineFixedAssetsDO::getLineNo, reqVO.getLineNo())
                .eqIfPresent(LineFixedAssetsDO::getModelNo, reqVO.getModelNo())
                .eqIfPresent(LineFixedAssetsDO::getManufacturer, reqVO.getManufacturer())
                .eqIfPresent(LineFixedAssetsDO::getUnit, reqVO.getUnit())
                .eqIfPresent(LineFixedAssetsDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(LineFixedAssetsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LineFixedAssetsDO::getId));
    }

    /**
     * 分页查询
     * @param page
     * @param vo
     * @return
     */
    IPage<LineFixedAssetsDO> getLineFixedAssetsPage(@Param("page") Page page, @Param("vo") LineFixedAssetsPageReqVO vo);
}
