|
@@ -193,6 +193,20 @@ public class TagService {
|
|
|
@Transactional
|
|
|
public void sortTag(String groupId, List<String> tagIdList) {
|
|
|
List<Tag> tagList = tagRepository.findByGroupId(groupId);
|
|
|
+ sortTag(tagIdList, tagList);
|
|
|
+ tagRepository.update(tagList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ public void sortTagByTypeCode(String typeCode, List<String> tagIdList) {
|
|
|
+ List<Tag> tagList = tagRepository.findByTypeCode(typeCode);
|
|
|
+ sortTag(tagIdList, tagList);
|
|
|
+ tagRepository.update(tagList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sortTag(List<String> tagIdList, List<Tag> tagList) {
|
|
|
for (Tag tag : tagList) {
|
|
|
String tagId = tag.getId();
|
|
|
if (!tagIdList.contains(tagId)) {
|
|
@@ -202,6 +216,5 @@ public class TagService {
|
|
|
Integer index = tagIdList.indexOf(tagId);
|
|
|
tag.setSort(index);
|
|
|
}
|
|
|
- tagRepository.update(tagList);
|
|
|
}
|
|
|
}
|