Commit 5d88ea49 authored by tangtuo's avatar tangtuo

nft标签为空时不加入缓存

修改nft编号的前缀
parent cd67567d
package com.fzm.common.service.impl; package com.fzm.common.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.Category; import com.fzm.common.entity.Category;
...@@ -25,10 +26,11 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements ...@@ -25,10 +26,11 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements
private LabelMapper labelMapper; private LabelMapper labelMapper;
@Override @Override
@Cacheable(value = "label:list", key = "#categoryId") @Cacheable(value = "label:list", key = "#categoryId", unless = "#result == null")
public List<Label> listAll(Integer categoryId) { public List<Label> listAll(Integer categoryId) {
QueryWrapper<Label> queryWrapper = new QueryWrapper<>(); QueryWrapper<Label> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("category_id", categoryId); queryWrapper.eq("category_id", categoryId);
return labelMapper.selectList(queryWrapper); List<Label> labels = labelMapper.selectList(queryWrapper);
return CollectionUtil.isEmpty(labels) ? null : labels;
} }
} }
...@@ -287,7 +287,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -287,7 +287,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此类目"); throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此类目");
} }
int code = RandomUtil.randomInt(1000, 10000); int code = RandomUtil.randomInt(1000, 10000);
return String.format("INMVO-%s-%s%s", category.getEnglishName(), System.currentTimeMillis(), code); return String.format("YIMU-%s-%s%s", category.getEnglishName(), System.currentTimeMillis(), code);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment