| | |
| | | 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: 设备加班管理 |
| | |
| | | @Service |
| | | public class MdcEquipmentOvertimeServiceImpl extends ServiceImpl<MdcEquipmentOvertimeMapper, MdcEquipmentOvertime> implements IMdcEquipmentOvertimeService { |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Override |
| | | public IPage<MdcEquipmentOvertime> pageList(String userId, Page<MdcEquipmentOvertime> page, MdcEquipmentOvertime mdcEquipmentOvertime, HttpServletRequest req) { |
| | | List<String> 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); |
| | | } |
| | | } |