package org.jeecg.modules.mdc.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang.StringUtils; import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * @Description: 设备加班管理 * @Author: Lius * @Date: 2023-08-25 * @Version: V1.0 */ @Service public class MdcEquipmentOvertimeServiceImpl extends ServiceImpl implements IMdcEquipmentOvertimeService { @Resource private IMdcEquipmentService mdcEquipmentService; @Override public IPage pageList(String userId, Page page, MdcEquipmentOvertime mdcEquipmentOvertime, HttpServletRequest req) { List equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getParentId()) && StringUtils.isEmpty(mdcEquipmentOvertime.getEquipmentId())) { if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { //部门层级 equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcEquipmentOvertime.getParentId()); } else { //产线层级 equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcEquipmentOvertime.getParentId()); } } else if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getEquipmentId())) { //单台设备信息 mdcEquipmentOvertime.setMdcSectionIds(Collections.singletonList(mdcEquipmentOvertime.getEquipmentId())); } else { //查询用户拥有的所有设备信息 if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { //部门层级 equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); } else { //产线层级 equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); } } if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { mdcEquipmentOvertime.setMdcSectionIds(equipmentIds); } if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { return null; } return this.baseMapper.pageList(page, mdcEquipmentOvertime); } }