mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
opt createCollectionIndicators for wrong id and opt TagDefineType (#780)
This commit is contained in:
@@ -9,6 +9,6 @@ public enum TypeEnums {
|
||||
ENTITY,
|
||||
DATASET,
|
||||
MODEL,
|
||||
UNKNOWN;
|
||||
UNKNOWN
|
||||
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ public enum TagDefineType {
|
||||
|
||||
FIELD,
|
||||
DIMENSION,
|
||||
Tag
|
||||
TAG
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user