package cn.iocoder.yudao.module.finance.controller.admin.ledger.vo; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.time.YearMonth; @Schema(description = "管理后台 - 总账/明细账查询 Request VO") @Data public class FinLedgerReqVO { @Schema(description = "科目编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1001") @NotEmpty(message = "查询总账/明细账必须指定会计科目") private String subjectCode; // 注意:这里必须是 YearMonth,不能是 LocalDate。 // 前端月份选择器传的是 "2026-01",LocalDate 无法从「年+月」还原出「日」, // 会在参数绑定阶段就抛 "Failed to convert ... to java.time.LocalDate"(400), // 即使写了 @DateTimeFormat(pattern = "yyyy-MM") 也救不了 —— 是字段类型错了,不是格式错了。 @Schema(description = "开始月份,格式 yyyy-MM,取该月 1 号为账期起点", requiredMode = Schema.RequiredMode.REQUIRED, example = "2026-01") @NotNull(message = "开始月份不能为空") @DateTimeFormat(pattern = "yyyy-MM") private YearMonth startMonth; @Schema(description = "结束月份,格式 yyyy-MM,取该月最后一天为账期终点", requiredMode = Schema.RequiredMode.REQUIRED, example = "2026-12") @NotNull(message = "结束月份不能为空") @DateTimeFormat(pattern = "yyyy-MM") private YearMonth endMonth; @Schema(description = "是否包含下级科目", example = "true") private Boolean includeChildren; }