package cn.iocoder.yudao.module.mes.dal.mysql.workteam;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mes.controller.admin.workteam.vo.WorkTeamPageReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.workteam.WorkTeamDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 生产班组 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface WorkTeamMapper extends BaseMapperX<WorkTeamDO> {

    default PageResult<WorkTeamDO> selectPage(WorkTeamPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkTeamDO>()
                .likeIfPresent(WorkTeamDO::getTeamName, reqVO.getTeamName())
                .eqIfPresent(WorkTeamDO::getTeamLeaderId, reqVO.getTeamLeaderId())
                .eqIfPresent(WorkTeamDO::getTeamType, reqVO.getTeamType())
                .eqIfPresent(WorkTeamDO::getGroupType, reqVO.getGroupType())
                .eqIfPresent(WorkTeamDO::getRemark, reqVO.getRemark())
                .eqIfPresent(WorkTeamDO::getIsEnable, reqVO.getIsEnable())
                .betweenIfPresent(WorkTeamDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkTeamDO::getId));
    }
    default List<WorkTeamDO> selectBy(WorkTeamDO detailDO) {
        return selectList(new LambdaQueryWrapperX<WorkTeamDO>()
                .likeIfPresent(WorkTeamDO::getTeamName, detailDO.getTeamName())
                .eqIfPresent(WorkTeamDO::getTeamLeaderId, detailDO.getTeamLeaderId())
                .eqIfPresent(WorkTeamDO::getTeamType, detailDO.getTeamType())
                .eqIfPresent(WorkTeamDO::getGroupType, detailDO.getGroupType())
                .eqIfPresent(WorkTeamDO::getRemark, detailDO.getRemark())
                .eqIfPresent(WorkTeamDO::getIsEnable, detailDO.getIsEnable()));
    }
    default List<WorkTeamDO> selectByIds(List<Long> ids) {
        return selectBatchIds(ids);
    }
}