feat(puzzle): 添加模板分页查询功能并优化DTO序列化

- 在PuzzleTemplateController中新增pageTemplates接口支持分页查询
- 为ElementCreateRequest和PuzzleElementDTO添加@JsonProperty注解优化JSON序列化
- 实现PuzzleTemplateServiceImpl中的pageTemplates分页逻辑
- 使用PageHelper实现分页查询并限制最大页面大小为100
- 在IPuzzleTemplateService接口中定义pageTemplates方法签名及文档说明
- 添加参数校验确保page和pageSize的有效性
- 返回PageResponse对象封装分页结果供前端使用
This commit is contained in:
2025-11-18 12:05:21 +08:00
parent bb2367c5a6
commit af60e95529
5 changed files with 99 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package com.ycwl.basic.puzzle.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Map;
@@ -22,21 +23,25 @@ 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;
// ===== 位置和布局属性(所有元素通用) =====
@@ -44,36 +49,43 @@ public class ElementCreateRequest {
/**
* 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配置(二选一) =====
@@ -85,6 +97,7 @@ public class ElementCreateRequest {
* - 文字元素:"{\"defaultText\":\"用户名\", \"fontFamily\":\"微软雅黑\", \"fontSize\":14}"
* - 图片元素:"{\"defaultImageUrl\":\"https://...\", \"imageFitMode\":\"COVER\", \"borderRadius\":10}"
*/
@JsonProperty("config")
private String config;
/**
@@ -96,5 +109,6 @@ public class ElementCreateRequest {
* configMap.put("fontSize", 14);
* request.setConfigMap(configMap);
*/
@JsonProperty("configMap")
private Map<String, Object> configMap;
}