feat: 添加预算已使用金额

This commit is contained in:
Bunny 2024-11-29 16:25:11 +08:00
parent d9e814110a
commit afd8591020
10 changed files with 35 additions and 0 deletions

View File

@ -32,6 +32,9 @@ public class BudgetCategoryDto {
@Schema(name = "amount", title = "预算金额")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
private BigDecimal useAmount;
@Schema(name = "startPeriod", title = "开始预算周期")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
private LocalDate startPeriod;

View File

@ -48,6 +48,11 @@ public class BudgetCategoryAddDto {
@Min(value = 0, message = "不能低于0")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "不能低于0")
private BigDecimal useAmount;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -52,6 +52,11 @@ public class BudgetCategoryUpdateDto {
@Min(value = 0, message = "不能低于0")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "不能低于0")
private BigDecimal useAmount;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -44,6 +44,11 @@ public class BudgetCategoryAddUserDto {
@Min(value = 0, message = "不能低于0")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "不能低于0")
private BigDecimal useAmount;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -48,6 +48,11 @@ public class BudgetCategoryUpdateUserDto {
@Min(value = 0, message = "不能低于0")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "不能低于0")
private BigDecimal useAmount;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -43,6 +43,9 @@ public class BudgetCategory extends BaseEntity {
@Schema(name = "amount", title = "预算金额")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
private BigDecimal useAmount;
@Schema(name = "period", title = "预算周期")
private LocalDateTime startPeriod;

View File

@ -47,6 +47,9 @@ public class BudgetCategoryVo extends BaseUserVo {
@Schema(name = "amount", title = "预算金额")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
private BigDecimal useAmount;
@Schema(name = "startPeriod", title = "预算周期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)

View File

@ -39,6 +39,9 @@ public class BudgetCategoryUserVo extends BaseVo {
@Schema(name = "amount", title = "预算金额")
private BigDecimal amount;
@Schema(name = "useAmount", title = "已使用预算金额")
private BigDecimal useAmount;
@Schema(name = "startPeriod", title = "预算周期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)

View File

@ -53,6 +53,9 @@
<if test="dto.amount != null and dto.amount != ''">
and base.amount like CONCAT('%',#{dto.amount},'%')
</if>
<if test="dto.useAmount != null and dto.useAmount != ''">
and base.use_amount like CONCAT('%',#{dto.useAmount},'%')
</if>
<if test="dto.startPeriod != null and dto.endPeriod != null">
and (
(base.start_period between #{dto.startPeriod} and #{dto.endPeriod})