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

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.MachineTemplateBrandReqVO;
import com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplatePage;
import com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateResp;
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateLimitDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MachineTemplateLimitMapper extends BaseMapperX<MachineTemplateLimitDO> {


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


    List<MachineTemplateBrandReqVO> selectMachineList(@Param("organIds") List<Long> organIds,@Param("templateName") String templateName);




    default List<MachineTemplateLimitDO> selectListByOrganId(Long organId) {
        return selectList(new LambdaQueryWrapperX<MachineTemplateLimitDO>()
                .eqIfPresent(MachineTemplateLimitDO::getDeleted,false)
                .eqIfPresent(MachineTemplateLimitDO::getOrganId,organId));
    }

}
