|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -36,6 +37,8 @@ public class AitagTagCategoryServiceImpl implements AitagTagCategoryService {
|
|
|
vo.setVisibilityLevel(category.getVisibilityLevel());
|
|
vo.setVisibilityLevel(category.getVisibilityLevel());
|
|
|
vo.setState(category.getState());
|
|
vo.setState(category.getState());
|
|
|
vo.setIsDelete(category.getIsDelete());
|
|
vo.setIsDelete(category.getIsDelete());
|
|
|
|
|
+ vo.setCreateTime(category.getCreateTime());
|
|
|
|
|
+ vo.setUpdateTime(category.getUpdateTime());
|
|
|
|
|
|
|
|
// 动态计算 tagNum
|
|
// 动态计算 tagNum
|
|
|
int tagNum = aiTagCategoryMapper.countTagsByCategoryId(category.getId());
|
|
int tagNum = aiTagCategoryMapper.countTagsByCategoryId(category.getId());
|
|
@@ -63,6 +66,9 @@ public class AitagTagCategoryServiceImpl implements AitagTagCategoryService {
|
|
|
category.setCategoryDesc(dto.getCategoryDesc());
|
|
category.setCategoryDesc(dto.getCategoryDesc());
|
|
|
category.setState(1); // 默认停用
|
|
category.setState(1); // 默认停用
|
|
|
category.setIsDelete(0); // 未删除
|
|
category.setIsDelete(0); // 未删除
|
|
|
|
|
+ Date now = new Date();
|
|
|
|
|
+ category.setCreateTime(now);
|
|
|
|
|
+ category.setUpdateTime(now);
|
|
|
|
|
|
|
|
aiTagCategoryMapper.insertCategory(category);
|
|
aiTagCategoryMapper.insertCategory(category);
|
|
|
return category;
|
|
return category;
|
|
@@ -84,6 +90,7 @@ public class AitagTagCategoryServiceImpl implements AitagTagCategoryService {
|
|
|
|
|
|
|
|
existing.setCategoryNm(dto.getCategoryNm());
|
|
existing.setCategoryNm(dto.getCategoryNm());
|
|
|
existing.setCategoryDesc(dto.getCategoryDesc());
|
|
existing.setCategoryDesc(dto.getCategoryDesc());
|
|
|
|
|
+ existing.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
aiTagCategoryMapper.updateCategory(existing);
|
|
aiTagCategoryMapper.updateCategory(existing);
|
|
|
return existing;
|
|
return existing;
|
|
@@ -134,7 +141,7 @@ public class AitagTagCategoryServiceImpl implements AitagTagCategoryService {
|
|
|
throw new RuntimeException("标签体系不存在");
|
|
throw new RuntimeException("标签体系不存在");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 判断标签数量是否为0
|
|
|
|
|
|
|
+ // 判断标签数量是否为 0
|
|
|
int tagCount = aiTagCategoryMapper.countTagsByCategoryId(id);
|
|
int tagCount = aiTagCategoryMapper.countTagsByCategoryId(id);
|
|
|
if (tagCount > 0) {
|
|
if (tagCount > 0) {
|
|
|
throw new RuntimeException("该标签体系下仍有标签,无法删除");
|
|
throw new RuntimeException("该标签体系下仍有标签,无法删除");
|
|
@@ -159,6 +166,8 @@ public class AitagTagCategoryServiceImpl implements AitagTagCategoryService {
|
|
|
vo.setVisibilityLevel(category.getVisibilityLevel());
|
|
vo.setVisibilityLevel(category.getVisibilityLevel());
|
|
|
vo.setState(category.getState());
|
|
vo.setState(category.getState());
|
|
|
vo.setIsDelete(category.getIsDelete());
|
|
vo.setIsDelete(category.getIsDelete());
|
|
|
|
|
+ vo.setCreateTime(category.getCreateTime());
|
|
|
|
|
+ vo.setUpdateTime(category.getUpdateTime());
|
|
|
|
|
|
|
|
// 动态计算 tagNum
|
|
// 动态计算 tagNum
|
|
|
int tagNum = aiTagCategoryMapper.countTagsByCategoryId(category.getId());
|
|
int tagNum = aiTagCategoryMapper.countTagsByCategoryId(category.getId());
|
|
@@ -187,6 +196,8 @@ public class AitagTagCategoryServiceImpl implements AitagTagCategoryService {
|
|
|
vo.setVisibilityLevel(category.getVisibilityLevel());
|
|
vo.setVisibilityLevel(category.getVisibilityLevel());
|
|
|
vo.setState(category.getState());
|
|
vo.setState(category.getState());
|
|
|
vo.setIsDelete(category.getIsDelete());
|
|
vo.setIsDelete(category.getIsDelete());
|
|
|
|
|
+ vo.setCreateTime(category.getCreateTime());
|
|
|
|
|
+ vo.setUpdateTime(category.getUpdateTime());
|
|
|
|
|
|
|
|
// 计算标签数量
|
|
// 计算标签数量
|
|
|
int tagNum = aiTagCategoryMapper.countTagsByCategoryId(category.getId());
|
|
int tagNum = aiTagCategoryMapper.countTagsByCategoryId(category.getId());
|