package com.zt.plat.module.base.dal.dao.processingoperation;

import java.util.*;

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.base.dal.dataobject.processingoperation.ProcessingOperationDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.processingoperation.vo.*;

/**
 * 工序 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface ProcessingOperationMapper extends BaseMapperX<ProcessingOperationDO> {

    default PageResult<ProcessingOperationDO> selectPage(ProcessingOperationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProcessingOperationDO>()
                .eqIfPresent(ProcessingOperationDO::getCode, reqVO.getCode())
                .likeIfPresent(ProcessingOperationDO::getName, reqVO.getName())
                .eqIfPresent(ProcessingOperationDO::getSort, reqVO.getSort())
                .eqIfPresent(ProcessingOperationDO::getTypeValue, reqVO.getTypeValue())
                .eqIfPresent(ProcessingOperationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProcessingOperationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProcessingOperationDO::getId));
    }

    default List<ProcessingOperationDO> selectSimpleList(String typeValue) {
        return selectList(new LambdaQueryWrapperX<ProcessingOperationDO>()
                .eqIfPresent(ProcessingOperationDO::getTypeValue, typeValue)
                .orderByAsc(ProcessingOperationDO::getSort)
                .orderByAsc(ProcessingOperationDO::getId));
    }

}