|
@ -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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |