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, ENTITY,
DATASET, DATASET,
MODEL, MODEL,
UNKNOWN; UNKNOWN
} }

View File

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

View File

@@ -21,7 +21,7 @@ public enum TagType {
} }
public static TagType getType(TagDefineType tagDefineType) { 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; : TagType.ATOMIC;
} }
} }

View File

@@ -11,11 +11,11 @@ import java.util.List;
public interface TagService { 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); TagResp getTag(Long id, User user);

View File

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

View File

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