opt createCollectionIndicators for wrong id and opt TagDefineType (#780)

This commit is contained in:
daikon
2024-03-05 19:52:21 +08:00
committed by GitHub
parent b8ecfc6a99
commit c97f567cd8
6 changed files with 15 additions and 11 deletions

View File

@@ -9,6 +9,6 @@ public enum TypeEnums {
ENTITY,
DATASET,
MODEL,
UNKNOWN;
UNKNOWN
}

View File

@@ -4,5 +4,5 @@ public enum TagDefineType {
FIELD,
DIMENSION,
Tag
TAG
}

View File

@@ -21,7 +21,7 @@ public enum TagType {
}
public static TagType getType(TagDefineType tagDefineType) {
return Objects.nonNull(tagDefineType) && TagDefineType.Tag.equals(tagDefineType) ? TagType.DERIVED
return Objects.nonNull(tagDefineType) && TagDefineType.TAG.equals(tagDefineType) ? TagType.DERIVED
: TagType.ATOMIC;
}
}

View File

@@ -11,11 +11,11 @@ import java.util.List;
public interface TagService {
TagResp create(TagReq tagReq, User user) throws Exception;
TagResp create(TagReq tagReq, User user);
TagResp update(TagReq tagReq, User user) throws Exception;
TagResp update(TagReq tagReq, User user);
void delete(Long id, User user) throws Exception;
void delete(Long id, User user);
TagResp getTag(Long id, User user);

View File

@@ -27,7 +27,7 @@ public class CollectServiceImpl implements CollectService {
CollectDO collect = new CollectDO();
collect.setType(Strings.isEmpty(collectReq.getType()) ? type : collectReq.getType());
collect.setUsername(user.getName());
collect.setCollectId(collectReq.getId());
collect.setCollectId(collectReq.getCollectId());
collectMapper.insert(collect);
return true;
}

View File

@@ -57,19 +57,23 @@ public class TagServiceImpl implements TagService {
}
@Override
public TagResp create(TagReq tagReq, User user) throws Exception {
public TagResp create(TagReq tagReq, User user) {
checkParam(tagReq);
checkExit(tagReq);
TagDO tagDO = convert(tagReq);
tagDO.setCreatedBy(user.getName());
tagDO.setCreatedAt(new Date());
tagDO.setStatus(StatusEnum.ONLINE.getCode());
if (Objects.nonNull(tagReq.getStatus())) {
tagDO.setStatus(tagReq.getStatus());
} else {
tagDO.setStatus(StatusEnum.ONLINE.getCode());
}
tagRepository.create(tagDO);
return convert(tagDO);
}
@Override
public TagResp update(TagReq tagReq, User user) throws Exception {
public TagResp update(TagReq tagReq, User user) {
if (Objects.isNull(tagReq.getId()) || tagReq.getId() <= 0) {
throw new RuntimeException("id is empty");
}
@@ -93,7 +97,7 @@ public class TagServiceImpl implements TagService {
}
@Override
public void delete(Long id, User user) throws Exception {
public void delete(Long id, User user) {
TagDO tagDO = tagRepository.getTagById(id);
if (Objects.isNull(tagDO)) {
throw new RuntimeException("tag not found");