package com.cf.imes.module.system.dal.mysql.process;

import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupPageReqVO;
import com.cf.imes.module.system.dal.dataobject.process.ProcessGroupDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 工序组表 process_group Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface ProcessGroupMapper extends BaseMapperX<ProcessGroupDO> {

    default PageResult<ProcessGroupDO> selectPage(ProcessGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProcessGroupDO>()
                .likeIfPresent(ProcessGroupDO::getName, reqVO.getName())
                .eqIfPresent(ProcessGroupDO::getIsDefault, reqVO.getIsDefault())
                .eqIfPresent(ProcessGroupDO::getSort, reqVO.getSort())
                .eqIfPresent(ProcessGroupDO::getItems, reqVO.getItems())
                .eqIfPresent(ProcessGroupDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(ProcessGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProcessGroupDO::getId));
    }

}