|
@@ -0,0 +1,93 @@
|
|
|
+package com.gyee.backconfig.service.auto.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.gyee.backconfig.config.CacheContext;
|
|
|
+import com.gyee.backconfig.mapper.auto.ProBasicLogicalUnitMapper;
|
|
|
+import com.gyee.backconfig.model.auto.ProBasicLogicalUnit;
|
|
|
+import com.gyee.backconfig.model.auto.ProEconEquipmentmodel;
|
|
|
+import com.gyee.backconfig.model.auto.ProEconLogicalUnit;
|
|
|
+import com.gyee.backconfig.mapper.auto.ProEconLogicalUnitMapper;
|
|
|
+import com.gyee.backconfig.service.auto.IProBasicLogicalUnitService;
|
|
|
+import com.gyee.backconfig.service.auto.IProEconEquipmentmodelService;
|
|
|
+import com.gyee.backconfig.service.auto.IProEconLogicalUnitService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 逻辑部件 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author wang
|
|
|
+ * @since 2022-12-06
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ProEconLogicalUnitServiceImpl extends ServiceImpl<ProEconLogicalUnitMapper, ProEconLogicalUnit> implements IProEconLogicalUnitService {
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(ProEconLogicalUnitServiceImpl.class);
|
|
|
+ @Autowired
|
|
|
+ private IProEconEquipmentmodelService proEconEquipmentmodelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IProBasicLogicalUnitService proBasicLogicalUnitService;//部件
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IProEconLogicalUnitService proEconLogicalUnitService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean addgl(ProEconEquipmentmodel jx) {
|
|
|
+
|
|
|
+ QueryWrapper<ProEconLogicalUnit> qw = new QueryWrapper<>(); //关联
|
|
|
+ List<ProEconLogicalUnit> list = baseMapper.selectList(qw);
|
|
|
+
|
|
|
+ List<ProBasicLogicalUnit> list1 = new ArrayList<>();
|
|
|
+
|
|
|
+ List<ProBasicLogicalUnit> units = CacheContext.unitls;//部件
|
|
|
+
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ for (ProEconLogicalUnit p1 : list) {
|
|
|
+ if (StringUtils.notEmp(p1.getId())) {
|
|
|
+ ProEconLogicalUnit vo1 = new ProEconLogicalUnit();
|
|
|
+ for (ProBasicLogicalUnit p2 : units) {
|
|
|
+ vo1.setAname(p2.getAname());
|
|
|
+ vo1.setName(p2.getName());
|
|
|
+ vo1.setNemCode(p2.getNemCode());
|
|
|
+ list.add(vo1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.saveOrUpdateBatch(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconLogicalUnit> list1(String[] modelId) {
|
|
|
+ QueryWrapper<ProEconLogicalUnit> qw = new QueryWrapper<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(modelId)) {
|
|
|
+ qw.in("modelId", modelId);
|
|
|
+ }
|
|
|
+ List<ProEconLogicalUnit> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconLogicalUnit> list(String id, String equipmentId) {
|
|
|
+ QueryWrapper<ProEconLogicalUnit> qw = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
+ qw.in("id", id);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(equipmentId)) {
|
|
|
+ qw.in("equipment_id", equipmentId);
|
|
|
+ }
|
|
|
+ List<ProEconLogicalUnit> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+}
|