Browse Source

修改保存复制人的逻辑

dev_power_axis
YUJT 3 years ago
parent
commit
85058348a8
  1. 5
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java
  2. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java
  3. 49
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java

5
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java

@ -56,6 +56,11 @@ public class PowerAxisLeaderDTO implements Serializable {
*/ */
private String avatar; private String avatar;
/**
* 类别编码
*/
private String categoryCode;
/** /**
* 删除标识 0.未删除 1.已删除 * 删除标识 0.未删除 1.已删除
*/ */

2
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java

@ -12,10 +12,8 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.plugin.power.dto.axis.PowerAxisLeaderDTO; import com.epmet.plugin.power.dto.axis.PowerAxisLeaderDTO;
import com.epmet.plugin.power.dto.axis.form.PowerAxisStructLeaderFormDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao;
import com.epmet.plugin.power.modules.axis.excel.PowerAxisLeaderExcel; import com.epmet.plugin.power.modules.axis.excel.PowerAxisLeaderExcel;
import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService; import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService;
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService; import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService;

49
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.plugin.power.modules.axis.service.impl; package com.epmet.plugin.power.modules.axis.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -13,6 +14,7 @@ import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao; import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao; import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity; import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity;
import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService; import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -26,7 +28,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 动力主轴领导人 * 动力主轴领导人
* *
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2022-04-18 * @since v1.0.0 2022-04-18
@ -53,8 +55,8 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
return ConvertUtils.sourceToTarget(entityList, PowerAxisLeaderDTO.class); return ConvertUtils.sourceToTarget(entityList, PowerAxisLeaderDTO.class);
} }
private QueryWrapper<PowerAxisLeaderEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<PowerAxisLeaderEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<PowerAxisLeaderEntity> wrapper = new QueryWrapper<>(); QueryWrapper<PowerAxisLeaderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -73,12 +75,10 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
public void save(PowerAxisLeaderDTO dto) { public void save(PowerAxisLeaderDTO dto) {
PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class); PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class);
boolean i = insert(entity); boolean i = insert(entity);
if(i){ if (i) {
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity(); addStructLeaderRelation(
leaderEntity.setCustomerId(dto.getCustomerId()); dto.getCustomerId(), dto.getStructReferenceId(), entity.getId(), dto.getCategoryCode()
leaderEntity.setLeaderId(entity.getId()); );
leaderEntity.setStructReferenceId(dto.getStructReferenceId());
powerAxisStructLeaderDao.insert(leaderEntity);
} }
} }
@ -88,12 +88,11 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class); PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class);
boolean i = updateById(entity); boolean i = updateById(entity);
if (i) { if (i) {
// todo 关联表,先删除(by structReferenceId),再插入 // 关联表,先删除(by structReferenceId),再插入
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity(); delStructLeaderRelation(dto.getCustomerId(), dto.getStructReferenceId());
leaderEntity.setLeaderId(entity.getId()); addStructLeaderRelation(
leaderEntity.setStructReferenceId(dto.getStructReferenceId()); dto.getCustomerId(), dto.getStructReferenceId(), entity.getId(), dto.getCategoryCode()
leaderEntity.setCustomerId(dto.getCustomerId()); );
powerAxisStructLeaderDao.updateById(leaderEntity);
} }
} }
@ -106,15 +105,27 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
@Override @Override
public List<PowerAxisSimpleListDTO> getSimpleList(List<String> ids) { public List<PowerAxisSimpleListDTO> getSimpleList(List<String> ids) {
List<PowerAxisSimpleListDTO> list = baseDao.getSimpleList(ids); return baseDao.getSimpleList(ids);
return list;
} }
@Override @Override
public PowerAxisLeaderDetailResultDTO getLeaderDetail(PowerAxisLeaderDetailFormDTO form) { public PowerAxisLeaderDetailResultDTO getLeaderDetail(PowerAxisLeaderDetailFormDTO form) {
PowerAxisLeaderDetailResultDTO dto = baseDao.getLeaderDetail(form); return baseDao.getLeaderDetail(form);
return dto;
} }
private void delStructLeaderRelation(String customerId, String structId) {
LambdaQueryWrapper<PowerAxisStructLeaderEntity> lqw = new LambdaQueryWrapper<>();
lqw.eq(PowerAxisStructLeaderEntity::getStructReferenceId, structId)
.eq(PowerAxisStructLeaderEntity::getCustomerId, customerId);
powerAxisStructLeaderDao.delete(lqw);
}
private void addStructLeaderRelation(String customerId, String structId, String leaderId, String categoryCode) {
PowerAxisStructLeaderEntity structLeader = new PowerAxisStructLeaderEntity();
structLeader.setCustomerId(customerId);
structLeader.setLeaderId(leaderId);
structLeader.setStructReferenceId(structId);
structLeader.setCategoryCode(categoryCode);
powerAxisStructLeaderDao.insert(structLeader);
}
} }
Loading…
Cancel
Save