|
|
@@ -48,13 +48,18 @@ public class GroupElementServiceImpl implements IGroupElementService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean saveElement(String groupId, CreateMapElementRequest elementCreate) {
|
|
|
+ public Boolean saveElement(String groupId, Integer elementFrom, CreateMapElementRequest elementCreate) {
|
|
|
+ //获取序号
|
|
|
+ Integer elementCount = mapper.selectCount(new LambdaQueryWrapper<GroupElementEntity>()
|
|
|
+ .eq(GroupElementEntity::getGroupId, groupId)
|
|
|
+ .eq(GroupElementEntity::getElementType,ElementTypeEnum.findVal(elementCreate.getResource().getContent().getGeometry().getType())));
|
|
|
+
|
|
|
Optional<GroupElementEntity> groupElementOpt = this.getEntityByElementId(elementCreate.getId());
|
|
|
|
|
|
if (groupElementOpt.isPresent()) {
|
|
|
return false;
|
|
|
}
|
|
|
- GroupElementEntity groupElement = this.createDtoConvertToEntity(elementCreate);
|
|
|
+ GroupElementEntity groupElement = this.createDtoConvertToEntity(elementFrom, elementCount, elementCreate);
|
|
|
groupElement.setGroupId(groupId);
|
|
|
|
|
|
boolean saveElement = mapper.insert(groupElement) > 0;
|
|
|
@@ -172,6 +177,7 @@ public class GroupElementServiceImpl implements IGroupElementService {
|
|
|
return new MapGroupElement()
|
|
|
.setId(entity.getElementId())
|
|
|
.setName(entity.getElementName())
|
|
|
+ .setElementFrom(entity.getElementFrom())
|
|
|
.setCreateTime(entity.getCreateTime())
|
|
|
.setUpdateTime(entity.getUpdateTime())
|
|
|
.setResource(new ElementResource()
|
|
|
@@ -184,15 +190,18 @@ public class GroupElementServiceImpl implements IGroupElementService {
|
|
|
* @param elementCreate
|
|
|
* @return
|
|
|
*/
|
|
|
- private GroupElementEntity createDtoConvertToEntity(CreateMapElementRequest elementCreate) {
|
|
|
+ private GroupElementEntity createDtoConvertToEntity(Integer elementFrom, Integer elementCnt, CreateMapElementRequest elementCreate) {
|
|
|
+
|
|
|
ElementProperty properties = elementCreate.getResource().getContent().getProperties();
|
|
|
return GroupElementEntity.builder()
|
|
|
.elementId(elementCreate.getId())
|
|
|
- .elementName(elementCreate.getName())
|
|
|
+ //.elementName(elementCreate.getName())
|
|
|
+ .elementName(elementCreate.getResource().getUsername() + ++elementCnt)
|
|
|
.username(elementCreate.getResource().getUsername())
|
|
|
.elementType(ElementTypeEnum.findVal(elementCreate.getResource().getContent().getGeometry().getType()))
|
|
|
.clampToGround(properties.getClampToGround() != null && properties.getClampToGround())
|
|
|
.color(properties.getColor())
|
|
|
+ .elementFrom(elementFrom)
|
|
|
.build();
|
|
|
}
|
|
|
|