package com.zt.plat.module.qms.resource.device.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceUseRecordDetailDO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordDetailPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备-使用记录明细 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DeviceUseRecordDetailMapper extends BaseMapperX<DeviceUseRecordDetailDO> {

    default PageResult<DeviceUseRecordDetailDO> selectPage(DeviceUseRecordDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceUseRecordDetailDO>()
                .eqIfPresent(DeviceUseRecordDetailDO::getParentId, reqVO.getParentId())
                .eqIfPresent(DeviceUseRecordDetailDO::getTaskNo, reqVO.getTaskNo())
                .eqIfPresent(DeviceUseRecordDetailDO::getTaskId, reqVO.getTaskId())
                .likeIfPresent(DeviceUseRecordDetailDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(DeviceUseRecordDetailDO::getSampleCode, reqVO.getSampleCode())
                .eqIfPresent(DeviceUseRecordDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceUseRecordDetailDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceUseRecordDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceUseRecordDetailDO::getId));
    }

}