| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | | import org.dromara.eims.domain.EimsFixtureBorrow; |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.eims.utils.DataFilterUtil; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.vo.SysDeptVo; |
| | | import org.dromara.system.mapper.SysDeptMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsRepairReqBo; |
| | | import org.dromara.eims.domain.vo.EimsRepairReqVo; |
| | |
| | | import org.dromara.eims.mapper.EimsRepairReqMapper; |
| | | import org.dromara.eims.service.IEimsRepairReqService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | |
| | | public class EimsRepairReqServiceImpl implements IEimsRepairReqService { |
| | | |
| | | private final EimsRepairReqMapper baseMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | | |
| | | /** |
| | | * 查询故障报修 |
| | |
| | | |
| | | @Override |
| | | public TableDataInfo<EimsRepairReqVo> queryPageListCustom(EimsRepairReqBo bo, PageQuery pageQuery) { |
| | | DataFilterUtil.getInstance().filterRepairReq(bo); |
| | | Page<EimsRepairReqVo> page = baseMapper.selectRepairReqList(pageQuery.build(), buildWrapper(bo)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | |
| | | qw.like(StringUtils.isNotBlank(bo.getCode()),"a.code", bo.getCode()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getStatus()), "a.status", bo.getStatus()); |
| | | qw.eq(bo.getReqTime() != null, "a.req_time", bo.getReqTime()); |
| | | qw.eq(bo.getReqDept() != null, "a.req_dept", bo.getReqDept()); |
| | | qw.eq(bo.getReqUser() != null,"a.req_user", bo.getReqUser()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getUrgencyLevel()), "a.urgency_level", bo.getUrgencyLevel()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getReqType()), "a.req_type", bo.getReqType()); |
| | |
| | | qw.eq(params.containsKey("status"), "a.status", params.get("status")); |
| | | qw.between(params.get("beginReqTime") != null && params.get("endReqTime") != null, |
| | | "a.req_time", params.get("beginReqTime"), params.get("endReqTime")); |
| | | |
| | | |
| | | qw.eq(bo.getCreateBy()!=null, "a.create_by", bo.getCreateBy()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getStatus()), "a.status", bo.getStatus()); |
| | | |
| | | /** |
| | | * 查询部门下所有子部门 |
| | | */ |
| | | if (bo.getReqDept() != null) { |
| | | List<Long> allDescendantIds = getAllDescendantIds(bo.getReqDept()); |
| | | qw.in(bo.getReqDept() != null, "a.req_dept", allDescendantIds); |
| | | } |
| | | |
| | | return qw; |
| | | } |
| | | |
| | | /** |
| | | * 根据id,获取所有后代id |
| | | * |
| | | * @param rootId |
| | | * @return |
| | | */ |
| | | public List<Long> getAllDescendantIds(Long rootId) { |
| | | List<Long> result = new ArrayList<>(); |
| | | result.add(rootId); |
| | | collectDescendants(rootId, result); |
| | | return result; |
| | | } |
| | | |
| | | private void collectDescendants(Long currentId, List<Long> collector) { |
| | | QueryWrapper<SysDept> sysDeptWrapper = new QueryWrapper<>(); |
| | | sysDeptWrapper.lambda().eq(SysDept::getParentId, currentId); |
| | | |
| | | List<SysDeptVo> children = sysDeptMapper.selectVoList(sysDeptWrapper); |
| | | if (children != null && !children.isEmpty()) { |
| | | for (SysDeptVo child : children) { |
| | | Long childId = child.getDeptId(); |
| | | collector.add(childId); |
| | | collectDescendants(childId, collector); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询符合条件的故障报修列表 |