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

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.assets.vo.AssetsSecondmentRecordPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.assets.vo.AssetsSecondmentRecordRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.assets.AssetsSecondmentRecordDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 资产借调记录 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface AssetsSecondmentRecordMapper extends BaseMapperX<AssetsSecondmentRecordDO> {

    default PageResult<AssetsSecondmentRecordDO> selectPage(AssetsSecondmentRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AssetsSecondmentRecordDO>()
                .eqIfPresent(AssetsSecondmentRecordDO::getAssetsId, reqVO.getAssetsId())
                .eqIfPresent(AssetsSecondmentRecordDO::getUseUserId, reqVO.getUseUserId())
                .eqIfPresent(AssetsSecondmentRecordDO::getUseDeptId, reqVO.getUseDeptId())
                .eqIfPresent(AssetsSecondmentRecordDO::getPrincipalUserId, reqVO.getPrincipalUserId())
                .eqIfPresent(AssetsSecondmentRecordDO::getSecondmentDeptId, reqVO.getSecondmentDeptId())
                .eqIfPresent(AssetsSecondmentRecordDO::getAssetSecondmentId, reqVO.getAssetSecondmentId())
                .eqIfPresent(AssetsSecondmentRecordDO::getNum, reqVO.getNum())
                .eqIfPresent(AssetsSecondmentRecordDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(AssetsSecondmentRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AssetsSecondmentRecordDO::getId));
    }

    /**
     * 列表
     *
     * @param vo
     * @param page
     * @return
     */
    IPage<AssetsSecondmentRecordRespVO> getAssetsSecondmentRecordPage(@Param("vo") AssetsSecondmentRecordPageReqVO vo, @Param("page") Page page);
}