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.AssetsSecondmentPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.assets.vo.AssetsSecondmentRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.assets.AssetsSecondmentDO;
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 AssetsSecondmentMapper extends BaseMapperX<AssetsSecondmentDO> {

    default PageResult<AssetsSecondmentDO> selectPage(AssetsSecondmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AssetsSecondmentDO>()
                .eqIfPresent(AssetsSecondmentDO::getAssetsId, reqVO.getAssetsId())
                .eqIfPresent(AssetsSecondmentDO::getUseUserId, reqVO.getUseUserId())
                .eqIfPresent(AssetsSecondmentDO::getUseDeptId, reqVO.getUseDeptId())
                .eqIfPresent(AssetsSecondmentDO::getPrincipalUserId, reqVO.getPrincipalUserId())
                .eqIfPresent(AssetsSecondmentDO::getSecondmentDeptId, reqVO.getSecondmentDeptId())
                .orderByDesc(AssetsSecondmentDO::getId));
    }

    /**
     * 列表
     *
     * @param vo
     * @param page
     * @return
     */
    IPage<AssetsSecondmentRespVO> getAssetsSecondmentPage(@Param("vo") AssetsSecondmentPageReqVO vo, @Param("page") Page<Object> page);
}