| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service("manTagService") |
| | | public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements TagService { |
| | |
| | | |
| | | if (!Cools.isEmpty(firstTagName)) { |
| | | //存在一级分类,查询一级分类 |
| | | Tag firstTag = this.getOne(new LambdaQueryWrapper<Tag>() |
| | | List<Tag> firstList = this.list(new LambdaQueryWrapper<Tag>() |
| | | .eq(Tag::getName, firstTagName) |
| | | .eq(Tag::getHostId, hostId)); |
| | | .eq(Tag::getHostId, hostId) |
| | | .orderByAsc(Tag::getCreateTime)); |
| | | Tag firstTag = null; |
| | | if (!firstList.isEmpty()) { |
| | | firstTag = firstList.get(0); |
| | | } |
| | | |
| | | if (firstTag == null) { |
| | | //一级分类为空,创建一级分类 |
| | | firstTag = new Tag(); |
| | |
| | | |
| | | if (!Cools.isEmpty(secondTagName)) { |
| | | //存在二级分类,查询二级分类 |
| | | Tag secondTag = this.getOne(new LambdaQueryWrapper<Tag>() |
| | | List<Tag> secondList = this.list(new LambdaQueryWrapper<Tag>() |
| | | .eq(Tag::getName, secondTagName) |
| | | .eq(Tag::getHostId, hostId)); |
| | | .eq(Tag::getHostId, hostId) |
| | | .orderByAsc(Tag::getCreateTime)); |
| | | Tag secondTag = null; |
| | | if (!secondList.isEmpty()) { |
| | | secondTag = secondList.get(0); |
| | | } |
| | | if (secondTag == null) { |
| | | //二级分类为空,创建二级分类 |
| | | secondTag = new Tag(); |