package cn.iocoder.yudao.module.system.dal.mysql.assetreceive;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceivePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.assetreceive.AssetReceiveDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 资产领用 Mapper
 *
 * @author 符溶馨
 */
@Mapper
public interface AssetReceiveMapper extends BaseMapperX<AssetReceiveDO> {

    default PageResult<AssetReceiveDO> selectPage(AssetReceivePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AssetReceiveDO>()
                .eqIfPresent(AssetReceiveDO::getUserId, reqVO.getUserId())
                .eqIfPresent(AssetReceiveDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(AssetReceiveDO::getReceiveUserId, reqVO.getReceiveUserId())
                .eqIfPresent(AssetReceiveDO::getAssetsNo, reqVO.getAssetsNo())
                .likeIfPresent(AssetReceiveDO::getAssetsName, reqVO.getAssetsName())
                .eqIfPresent(AssetReceiveDO::getAssetsTypeId, reqVO.getAssetsTypeId())
                .betweenIfPresent(AssetReceiveDO::getApplyDate, reqVO.getApplyDate())
                .betweenIfPresent(AssetReceiveDO::getAllocationDate, reqVO.getAllocationDate())
                .eqIfPresent(AssetReceiveDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(AssetReceiveDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AssetReceiveDO::getStatus)
                .orderByDesc(AssetReceiveDO::getCreateTime));
    }

}