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

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
import com.zt.plat.module.qms.enums.QmsPermissionConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 入库 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface MaterialInventoryInboundMapper extends BaseMapperX<MaterialInventoryInboundDO> {

    @QmsPermission(moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
    default PageResult<MaterialInventoryInboundDO> selectPage(MaterialInventoryInboundPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialInventoryInboundDO>()
                .eqIfPresent(MaterialInventoryInboundDO::getTitle, reqVO.getTitle())
                .eqIfPresent(MaterialInventoryInboundDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(MaterialInventoryInboundDO::getBusinessTypeCode, reqVO.getBusinessTypeCode())
                .eqIfPresent(MaterialInventoryInboundDO::getApplyUser, reqVO.getApplyUser())
                .eqIfPresent(MaterialInventoryInboundDO::getApplyUserId, reqVO.getApplyUserId())
                .eqIfPresent(MaterialInventoryInboundDO::getApplyDepartment, reqVO.getApplyDepartment())
                .eqIfPresent(MaterialInventoryInboundDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
                .betweenIfPresent(MaterialInventoryInboundDO::getApplyTime, reqVO.getApplyTime())
                .eqIfPresent(MaterialInventoryInboundDO::getFlowInstanceId, reqVO.getFlowInstanceId())
                .eqIfPresent(MaterialInventoryInboundDO::getFlowStatus, reqVO.getFlowStatus())
                .eqIfPresent(MaterialInventoryInboundDO::getCommentJson, reqVO.getCommentJson())
                .eqIfPresent(MaterialInventoryInboundDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(MaterialInventoryInboundDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(MaterialInventoryInboundDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaterialInventoryInboundDO::getId));
    }

}