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