From b885f71589a895279ce9d7e38502f80c8f49215b Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Mon, 11 Nov 2024 15:41:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A2=84=E7=AE=97=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generator/generator/WebGeneratorCode.java | 25 +++---- .../budgetCategory/BudgetCategoryAddDto.java | 53 +++++++++++++ .../budgetCategory/BudgetCategoryDto.java | 40 ++++++++++ .../BudgetCategoryUpdateDto.java | 57 ++++++++++++++ .../DebtRepaymentPlanUpdateDto.java | 4 +- .../dao/entity/financial/BudgetCategory.java | 26 +++---- .../dao/vo/financial/BudgetCategoryVo.java | 38 ++++++++++ .../financial/BudgetCategoryController.java | 66 ++++++++++++++-- .../financial/BudgetCategoryMapper.java | 26 ++++++- .../financial/BudgetCategoryService.java | 40 +++++++++- .../impl/BudgetCategoryServiceImpl.java | 73 +++++++++++++++++- .../mapper/financial/BudgetCategoryMapper.xml | 75 +++++++++++++++---- 12 files changed, 463 insertions(+), 60 deletions(-) create mode 100644 dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryAddDto.java create mode 100644 dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryDto.java create mode 100644 dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryUpdateDto.java create mode 100644 dao/src/main/java/cn/bunny/dao/vo/financial/BudgetCategoryVo.java diff --git a/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java b/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java index 03ddebc..556abd7 100644 --- a/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java +++ b/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java @@ -3,16 +3,11 @@ package cn.bunny.common.generator.generator; import cn.bunny.common.generator.entity.BaseField; import cn.bunny.common.generator.entity.BaseResultMap; import cn.bunny.common.generator.utils.GeneratorCodeUtils; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanAddDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanUpdateDto; -import cn.bunny.dao.dto.system.configuration.category.CategoryAddDto; -import cn.bunny.dao.dto.system.configuration.category.CategoryDto; -import cn.bunny.dao.dto.system.configuration.category.CategoryUpdateDto; -import cn.bunny.dao.entity.financial.Category; -import cn.bunny.dao.entity.financial.DebtRepaymentPlan; -import cn.bunny.dao.vo.configuration.CategoryVo; -import cn.bunny.dao.vo.financial.DebtRepaymentPlanVo; +import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryAddDto; +import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto; +import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryUpdateDto; +import cn.bunny.dao.entity.financial.BudgetCategory; +import cn.bunny.dao.vo.financial.BudgetCategoryVo; import com.baomidou.mybatisplus.annotation.TableName; import com.google.common.base.CaseFormat; import io.swagger.v3.oas.annotations.media.Schema; @@ -57,11 +52,11 @@ public class WebGeneratorCode { public static String resourceMapperPath = "D:\\MyFolder\\auth\\financial-web-server\\service\\src\\main\\resources\\mapper\\financial\\"; public static void main(String[] args) throws Exception { - Class> originalClass = DebtRepaymentPlan.class; - Class> dtoClass = DebtRepaymentPlanDto.class; - Class> addDtoClass = DebtRepaymentPlanAddDto.class; - Class> updateDtoClass = DebtRepaymentPlanUpdateDto.class; - Class> voClass = DebtRepaymentPlanVo.class; + Class> originalClass = BudgetCategory.class; + Class> dtoClass = BudgetCategoryDto.class; + Class> addDtoClass = BudgetCategoryAddDto.class; + Class> updateDtoClass = BudgetCategoryUpdateDto.class; + Class> voClass = BudgetCategoryVo.class; // 设置velocity资源加载器 Properties prop = new Properties(); diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryAddDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryAddDto.java new file mode 100644 index 0000000..fa2f580 --- /dev/null +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryAddDto.java @@ -0,0 +1,53 @@ +package cn.bunny.dao.dto.financial.budgetCategory; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Schema(name = "BudgetCategoryAddDto对象", title = "预算分类添加", description = "预算分类添加") +public class BudgetCategoryAddDto { + + @Schema(name = "parentId", title = "父级id") + @NotNull(message = "父级id不能为空") + private Long parentId; + + @Schema(name = "userId", title = "绑定的用户id") + @NotNull(message = "债绑定的用户不能为空") + private Long userId; + + @Schema(name = "categoryName", title = "分类名称") + @NotNull(message = "分类名称不能为空") + @NotBlank(message = "分类名称不能为空") + private String categoryName; + + @Schema(name = "budgetName", title = "预算名称") + @NotNull(message = "预算名称不能为空") + @NotBlank(message = "预算名称不能为空") + private String budgetName; + + @Schema(name = "statusType", title = "完成状态") + @NotNull(message = "完成状态不能为空") + @NotBlank(message = "完成状态不能为空") + private String statusType; + + @Schema(name = "amount", title = "预算金额") + @NotNull(message = "预算金额不能为空") + private BigDecimal amount; + + @Schema(name = "period", title = "预算周期") + @NotNull(message = "预算周期不能为空") + @NotBlank(message = "预算周期不能为空") + private String period; + +} + diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryDto.java new file mode 100644 index 0000000..fa36766 --- /dev/null +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryDto.java @@ -0,0 +1,40 @@ +package cn.bunny.dao.dto.financial.budgetCategory; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Schema(name = "BudgetCategoryDto对象", title = "预算分类查询", description = "预算分类查询") +public class BudgetCategoryDto { + + @Schema(name = "parentId", title = "父级id") + private Long parentId; + + @Schema(name = "userId", title = "绑定的用户id") + private Long userId; + + @Schema(name = "categoryName", title = "分类名称") + private String categoryName; + + @Schema(name = "budgetName", title = "预算名称") + private String budgetName; + + @Schema(name = "statusType", title = "完成状态") + private String statusType; + + @Schema(name = "amount", title = "预算金额") + private BigDecimal amount; + + @Schema(name = "period", title = "预算周期") + private String period; + +} + diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryUpdateDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryUpdateDto.java new file mode 100644 index 0000000..b5e7884 --- /dev/null +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/BudgetCategoryUpdateDto.java @@ -0,0 +1,57 @@ +package cn.bunny.dao.dto.financial.budgetCategory; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Schema(name = "BudgetCategoryUpdateDto对象", title = "预算分类更新", description = "预算分类更新") +public class BudgetCategoryUpdateDto { + + @Schema(name = "id", title = "主键") + @NotNull(message = "id不能为空") + private Long id; + + @Schema(name = "parentId", title = "父级id") + @NotNull(message = "父级id不能为空") + private Long parentId; + + @Schema(name = "userId", title = "绑定的用户id") + @NotNull(message = "债绑定的用户不能为空") + private Long userId; + + @Schema(name = "categoryName", title = "分类名称") + @NotNull(message = "分类名称不能为空") + @NotBlank(message = "分类名称不能为空") + private String categoryName; + + @Schema(name = "budgetName", title = "预算名称") + @NotNull(message = "预算名称不能为空") + @NotBlank(message = "预算名称不能为空") + private String budgetName; + + @Schema(name = "statusType", title = "完成状态") + @NotNull(message = "完成状态不能为空") + @NotBlank(message = "完成状态不能为空") + private String statusType; + + @Schema(name = "amount", title = "预算金额") + @NotNull(message = "预算金额不能为空") + private BigDecimal amount; + + @Schema(name = "period", title = "预算周期") + @NotNull(message = "预算周期不能为空") + @NotBlank(message = "预算周期不能为空") + private String period; + +} + diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/DebtRepaymentPlanUpdateDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/DebtRepaymentPlanUpdateDto.java index e52933a..c6bc92e 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/DebtRepaymentPlanUpdateDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/DebtRepaymentPlanUpdateDto.java @@ -1,6 +1,7 @@ package cn.bunny.dao.dto.financial.debtRepaymentPlan; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; @@ -20,7 +21,7 @@ public class DebtRepaymentPlanUpdateDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") private Long id; - + @Schema(name = "debtId", title = "债务ID") @NotNull(message = "债务不能为空") private Long debtId; @@ -43,6 +44,7 @@ public class DebtRepaymentPlanUpdateDto { @Schema(name = "paymentStatus", title = "还款状态") @NotNull(message = "还款状态不能为空") + @NotBlank(message = "还款状态不能为空") private String paymentStatus; } \ No newline at end of file diff --git a/dao/src/main/java/cn/bunny/dao/entity/financial/BudgetCategory.java b/dao/src/main/java/cn/bunny/dao/entity/financial/BudgetCategory.java index bf13973..1acdd10 100644 --- a/dao/src/main/java/cn/bunny/dao/entity/financial/BudgetCategory.java +++ b/dao/src/main/java/cn/bunny/dao/entity/financial/BudgetCategory.java @@ -1,18 +1,14 @@ package cn.bunny.dao.entity.financial; import cn.bunny.dao.common.entity.BaseEntity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; +import java.math.BigDecimal; + /** *
* 预算分类表 @@ -25,28 +21,28 @@ import lombok.experimental.Accessors; @Setter @Accessors(chain = true) @TableName("t_budget_category") -@ApiModel(value = "BudgetCategory对象", description = "预算分类表") +@Schema(name = "BudgetCategory对象", title = "预算分类表", description = "预算分类表") public class BudgetCategory extends BaseEntity { - @ApiModelProperty("父级id") + @Schema(name = "parentId", title = "父级id") private Long parentId; - @ApiModelProperty("绑定的用户id") + @Schema(name = "userId", title = "绑定的用户id") private Long userId; - @ApiModelProperty("分类名称") + @Schema(name = "categoryName", title = "分类名称") private String categoryName; - @ApiModelProperty("预算名称") + @Schema(name = "budgetName", title = "预算名称") private String budgetName; - @ApiModelProperty("完成状态") + @Schema(name = "statusType", title = "完成状态") private String statusType; - @ApiModelProperty("预算金额") + @Schema(name = "amount", title = "预算金额") private BigDecimal amount; - @ApiModelProperty("预算周期") + @Schema(name = "period", title = "预算周期") private String period; } diff --git a/dao/src/main/java/cn/bunny/dao/vo/financial/BudgetCategoryVo.java b/dao/src/main/java/cn/bunny/dao/vo/financial/BudgetCategoryVo.java new file mode 100644 index 0000000..859f5ac --- /dev/null +++ b/dao/src/main/java/cn/bunny/dao/vo/financial/BudgetCategoryVo.java @@ -0,0 +1,38 @@ +package cn.bunny.dao.vo.financial; + +import cn.bunny.dao.common.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.math.BigDecimal; + +@EqualsAndHashCode(callSuper = true) +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Schema(name = "BudgetCategoryVo对象", title = "预算分类查询返回对象", description = "预算分类查询返回对象") +public class BudgetCategoryVo extends BaseVo { + + @Schema(name = "parentId", title = "父级id") + private Long parentId; + + @Schema(name = "userId", title = "绑定的用户id") + private Long userId; + + @Schema(name = "categoryName", title = "分类名称") + private String categoryName; + + @Schema(name = "budgetName", title = "预算名称") + private String budgetName; + + @Schema(name = "statusType", title = "完成状态") + private String statusType; + + @Schema(name = "amount", title = "预算金额") + private BigDecimal amount; + + @Schema(name = "period", title = "预算周期") + private String period; + +} \ No newline at end of file diff --git a/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java b/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java index 4e60b6b..a2505d1 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java @@ -1,18 +1,72 @@ -package cn.bunny.services.controller.financial; +package cn.bunny.services.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryAddDto; +import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto; +import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryUpdateDto; +import cn.bunny.dao.entity.financial.BudgetCategory; +import cn.bunny.dao.pojo.result.PageResult; +import cn.bunny.dao.pojo.result.Result; +import cn.bunny.dao.pojo.result.ResultCodeEnum; +import cn.bunny.dao.vo.financial.BudgetCategoryVo; +import cn.bunny.services.service.BudgetCategoryService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import reactor.core.publisher.Mono; + +import java.util.List; /** *
- * 预算分类表 前端控制器 + * 预算分类表表 前端控制器 *
* * @author Bunny - * @since 2024-11-11 + * @since 2024-11-11 15:36:57 */ +@Tag(name = "预算分类表", description = "预算分类表相关接口") @RestController -@RequestMapping("/budgetCategory") +@RequestMapping("admin/budgetCategory") public class BudgetCategoryController { + @Autowired + private BudgetCategoryService budgetCategoryService; + + @Operation(summary = "分页查询预算分类表", description = "分页查询预算分类表") + @GetMapping("getBudgetCategoryList/{page}/{limit}") + public Mono@@ -10,9 +17,24 @@ import org.apache.ibatis.annotations.Mapper; *
* * @author Bunny - * @since 2024-11-11 + * @since 2024-11-11 15:36:57 */ @Mapper public interface BudgetCategoryMapper extends BaseMapper@@ -9,8 +18,35 @@ import com.baomidou.mybatisplus.extension.service.IService; *
* * @author Bunny - * @since 2024-11-11 + * @since 2024-11-11 15:36:57 */ public interface BudgetCategoryService extends IService* 预算分类表 服务实现类 *
* * @author Bunny - * @since 2024-11-11 + * @since 2024-11-11 15:36:57 */ @Service public class BudgetCategoryServiceImpl extends ServiceImpl