最新一版9.0
parent
f5bdf00167
commit
c8fbf556fa
|
@ -1,7 +1,6 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.servers.Server;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.module.data.governance.constant.BuiltInMetamodel;
|
||||
|
@ -10,16 +9,18 @@ import net.srt.dao.MetadataDao;
|
|||
import net.srt.dao.MetadataPropertyDao;
|
||||
import net.srt.entity.MetadataEntity;
|
||||
import net.srt.entity.MetadataPropertyEntity;
|
||||
import net.srt.framework.common.cache.bean.Neo4jInfo;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.framework.security.cache.TokenStoreCache;
|
||||
import net.srt.service.MetadataService;
|
||||
import net.srt.vo.MetadataVO;
|
||||
import net.srt.vo.MetamodelPropertyVO;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -33,6 +34,7 @@ public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEn
|
|||
|
||||
private final MetadataDao metadataDao;
|
||||
private final MetadataPropertyDao metadataPropertyDao;
|
||||
private final TokenStoreCache tokenStoreCache;
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listByParentId(Long parentId) {
|
||||
|
@ -143,6 +145,40 @@ public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEn
|
|||
buildProperties(entity,vo.getProperties());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(MetadataVO vo) {
|
||||
MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
entity.setPath(recursionPath(entity,null));
|
||||
buildField(entity);
|
||||
updateById(entity);
|
||||
buildProperties(entity,vo.getProperties());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MetadataEntity::getParentId,id).last("limit 1");
|
||||
if(baseMapper.selectOne(wrapper)!=null){
|
||||
throw new ServerException("存在子节点,不可删除!");
|
||||
}
|
||||
removeById(id);
|
||||
LambdaQueryWrapper<MetadataPropertyEntity> propertyWrapper = new LambdaQueryWrapper<>();
|
||||
propertyWrapper.eq(MetadataPropertyEntity::getMetadataId,id);
|
||||
metadataPropertyDao.delete(propertyWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upNeo4jInfo(Neo4jInfo neo4jInfo) {
|
||||
tokenStoreCache.saveNeo4jInfo(getProjectId(),neo4jInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Neo4jInfo getNeo4jInfo() {
|
||||
return tokenStoreCache.getNeo4jInfo(getProjectId());
|
||||
}
|
||||
|
||||
private void recursionAddParent(MetadataEntity metadataEntity, List<MetadataEntity> resultList){
|
||||
if(resultList.stream().noneMatch(item -> metadataEntity.getId().equals(item.getId()))) {
|
||||
resultList.add(metadataEntity);
|
||||
|
|
Loading…
Reference in New Issue