fix(resource): 修复模型图片标签显示问题
- 修正图片标签的字典常量名称 - 实现图片标签的字典值转换 - 初始化图片标签列表feature/my-invitation
parent
3ebcf6e07e
commit
c2f0ada4f1
|
@ -49,6 +49,6 @@ public class DictConstants {
|
|||
/**
|
||||
* 图片标签
|
||||
*/
|
||||
public static final String IMAGE_LABLE = "image_lable";
|
||||
public static final String IMAGE_LABEL = "image_label";
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.domain.vo;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -49,7 +50,7 @@ public class ModelImageVo {
|
|||
/**
|
||||
* 图片标签(多个,切割)
|
||||
*/
|
||||
private List<String> tags;
|
||||
private List<String> tags = new ArrayList<>();
|
||||
/**
|
||||
* 描述信息(最多500)
|
||||
*/
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysDictData;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
|
@ -22,6 +23,7 @@ import com.mcwl.resource.domain.vo.ModelImageVo;
|
|||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.system.init.DictInit;
|
||||
import com.mcwl.system.service.ISysDictDataService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -210,13 +212,15 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
BeanUtil.copyProperties(modelImage, modelImageVo);
|
||||
|
||||
// 设置标签
|
||||
List<String> tags = new ArrayList<>();
|
||||
List<String> tagList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(modelImage.getTags())) {
|
||||
String[] tagValueList = modelImage.getTags().split(",");
|
||||
for (String tagIdStr : tagValueList) {
|
||||
for (String tagValue : tagValueList) {
|
||||
String dictLabel = DictInit.getDictValue(DictConstants.IMAGE_LABEL, tagValue);
|
||||
tagList.add(dictLabel);
|
||||
}
|
||||
}
|
||||
modelImageVo.setTags(tags);
|
||||
modelImageVo.setTags(tagList);
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
||||
modelImageVo.setUserId(SecurityUtils.getUserId());
|
||||
|
|
Loading…
Reference in New Issue