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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.machine.vo.*;
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author there
 */
@Mapper
public interface MachineTemplateMapper extends BaseMapperX<MachineTemplateDO> {

    default PageResult<MachineTemplateDO> selectPage(MachinePageReqVO reqVO, Collection<Long> ids) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MachineTemplateDO>()
                .eqIfPresent(MachineTemplateDO::getMachineType, reqVO.getMachineType())
                //.inIfPresent(MachineTemplateDO::getId, ids)
                .likeIfPresent(MachineTemplateDO::getName, reqVO.getName())
                .betweenIfPresent(MachineTemplateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MachineTemplateDO::getCreateTime));
    }

    Page<AuthTemplateResp> selectAuthTemplatePage(@Param("page") IPage<AuthTemplateResp> authTemplateRespPage, @Param("vo") AuthTemplatePage page);

    List<AutoTemplateVO>  selectAuthTemplateList(Map<String, Object> map);

    //Page<OrganTemplateResp> selectOrganTemplatePage(@Param("page") Page<OrganTemplateResp> respPage, @Param("vo") OrganTemplatePage page);

    List<OrganTemplateVO> selectOrganTemplateList(Map<String, Object> map);

    Page<OrganTemplateResp> selectOrganTemplatePage(@Param("page") Page<OrganTemplateResp> respPage, @Param("vo") OrganTemplatePage page);

    OrganTemplateResp selectOrganTemplate(Long organId);
}
