You've already forked FrameTour-BE
- 在PuzzleTemplateController中新增pageTemplates接口支持分页查询 - 为ElementCreateRequest和PuzzleElementDTO添加@JsonProperty注解优化JSON序列化 - 实现PuzzleTemplateServiceImpl中的pageTemplates分页逻辑 - 使用PageHelper实现分页查询并限制最大页面大小为100 - 在IPuzzleTemplateService接口中定义pageTemplates方法签名及文档说明 - 添加参数校验确保page和pageSize的有效性 - 返回PageResponse对象封装分页结果供前端使用
115 lines
2.6 KiB
Java
115 lines
2.6 KiB
Java
package com.ycwl.basic.puzzle.dto;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import lombok.Data;
|
|
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 创建元素请求DTO(重构版)
|
|
*
|
|
* 重构说明:
|
|
* - elementType从Integer改为String(TEXT、IMAGE等)
|
|
* - 删除所有type-specific字段
|
|
* - 新增config和configMap支持JSON配置
|
|
* - 支持两种方式:直接传JSON字符串 或 传Map对象
|
|
*
|
|
* @author Claude
|
|
* @since 2025-01-18
|
|
*/
|
|
@Data
|
|
public class ElementCreateRequest {
|
|
|
|
/**
|
|
* 模板ID
|
|
*/
|
|
@JsonProperty("templateId")
|
|
private Long templateId;
|
|
|
|
/**
|
|
* 元素类型(TEXT-文字 IMAGE-图片 QRCODE-二维码等)
|
|
*/
|
|
@JsonProperty("elementType")
|
|
private String elementType;
|
|
|
|
/**
|
|
* 元素标识(用于动态数据映射)
|
|
*/
|
|
@JsonProperty("elementKey")
|
|
private String elementKey;
|
|
|
|
/**
|
|
* 元素名称(便于管理识别)
|
|
*/
|
|
@JsonProperty("elementName")
|
|
private String elementName;
|
|
|
|
// ===== 位置和布局属性(所有元素通用) =====
|
|
|
|
/**
|
|
* X坐标(相对于画布左上角,像素)
|
|
*/
|
|
@JsonProperty("xPosition")
|
|
private Integer xPosition;
|
|
|
|
/**
|
|
* Y坐标(相对于画布左上角,像素)
|
|
*/
|
|
@JsonProperty("yPosition")
|
|
private Integer yPosition;
|
|
|
|
/**
|
|
* 宽度(像素)
|
|
*/
|
|
@JsonProperty("width")
|
|
private Integer width;
|
|
|
|
/**
|
|
* 高度(像素)
|
|
*/
|
|
@JsonProperty("height")
|
|
private Integer height;
|
|
|
|
/**
|
|
* 层级(数值越大越靠上)
|
|
*/
|
|
@JsonProperty("zIndex")
|
|
private Integer zIndex;
|
|
|
|
/**
|
|
* 旋转角度(0-360度,顺时针)
|
|
*/
|
|
@JsonProperty("rotation")
|
|
private Integer rotation;
|
|
|
|
/**
|
|
* 不透明度(0-100,100为完全不透明)
|
|
*/
|
|
@JsonProperty("opacity")
|
|
private Integer opacity;
|
|
|
|
// ===== JSON配置(二选一) =====
|
|
|
|
/**
|
|
* JSON配置字符串(直接传入JSON字符串)
|
|
*
|
|
* 示例:
|
|
* - 文字元素:"{\"defaultText\":\"用户名\", \"fontFamily\":\"微软雅黑\", \"fontSize\":14}"
|
|
* - 图片元素:"{\"defaultImageUrl\":\"https://...\", \"imageFitMode\":\"COVER\", \"borderRadius\":10}"
|
|
*/
|
|
@JsonProperty("config")
|
|
private String config;
|
|
|
|
/**
|
|
* JSON配置Map(传入Map对象,框架自动序列化为JSON)
|
|
*
|
|
* 示例:
|
|
* Map<String, Object> configMap = new HashMap<>();
|
|
* configMap.put("defaultText", "用户名");
|
|
* configMap.put("fontSize", 14);
|
|
* request.setConfigMap(configMap);
|
|
*/
|
|
@JsonProperty("configMap")
|
|
private Map<String, Object> configMap;
|
|
}
|