feat :组件分类

This commit is contained in:
lizhengwei 2026-03-12 23:47:28 +08:00
parent 83438b76dd
commit 6315c60afe
2 changed files with 18 additions and 1 deletions

View File

@ -1,9 +1,11 @@
package com.luban.api.convert;
import cn.hutool.json.JSONUtil;
import com.luban.api.dto.H5ComponentDTO;
import com.luban.api.entity.H5Component;
import com.luban.api.vo.H5ComponentVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
/**
* H5 组件转换类
@ -30,5 +32,20 @@ public interface H5ComponentConvert {
* @param dto 数据传输对象
* @return 实体
*/
@Mapping(target = "content", source = "content", qualifiedByName = "mapToJson")
H5Component toEntity(H5ComponentDTO dto);
/**
* Map 转换为 JSON 字符串
*
* @param map Map 对象
* @return JSON 字符串
*/
@org.mapstruct.Named("mapToJson")
static String mapToJson(java.util.Map<String, Object> map) {
if (map == null) {
return null;
}
return JSONUtil.toJsonStr(map);
}
}

View File

@ -52,7 +52,7 @@ public class H5Component {
/**
* 组件完整配置数据 (JSON 格式)
*/
private Map<String, Object> content;
private String content;
/**
* 使用次数统计