From 932d97af93590073bf7671d979e29fc1571e1cd3 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Thu, 31 Oct 2024 18:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=AE=97=E4=B9=A6-=E8=B4=A2=E6=94=BF?= =?UTF-8?q?=E6=8B=A8=E6=AC=BE=E3=80=81=E5=B9=B4=E5=BA=A6=E9=A2=84=E7=AE=97?= =?UTF-8?q?=E8=A1=A8=20=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0=2010.31?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectAnnualBudgetController.java | 15 +++- .../entity/ProjectAnnualBudget.java | 24 +++++- .../yusuanshu/NianDuYuSuanDemo.vue | 74 +++++++++++++------ 3 files changed, 83 insertions(+), 30 deletions(-) diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/controller/ProjectAnnualBudgetController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/controller/ProjectAnnualBudgetController.java index 13f87bf..edfbd16 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/controller/ProjectAnnualBudgetController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/controller/ProjectAnnualBudgetController.java @@ -79,12 +79,11 @@ public class ProjectAnnualBudgetController extends JeecgController add(@PathVariable("projectId") String projectId, @RequestBody List list) { + public Result add(@PathVariable("projectId") String projectId, @RequestBody ProjectAnnualBudget projectAnnualBudget) { Project project = iProjectService.getById(projectId); Optional.ofNullable(project).orElseThrow(() -> new JeecgBootException("项目不存在")); - BigDecimal sumFee = Optional.ofNullable(list).orElse(new LinkedList<>()).stream().map(ProjectAnnualBudget::getTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add); projectAnnualBudgetService.remove(new LambdaQueryWrapper().eq(ProjectAnnualBudget::getProjectId, projectId)); - projectAnnualBudgetService.saveBatch(list); + projectAnnualBudgetService.save(projectAnnualBudget); return Result.OK("添加成功!"); } @@ -151,6 +150,16 @@ public class ProjectAnnualBudgetController extends JeecgController queryByProjectId(@PathVariable("projectId") String projectId) { + ProjectAnnualBudget projectAnnualBudget = projectAnnualBudgetService.getOne(new LambdaQueryWrapper().eq(ProjectAnnualBudget::getProjectId,projectId)); + if (projectAnnualBudget == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(projectAnnualBudget); + } + /** * 导出excel * diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/entity/ProjectAnnualBudget.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/entity/ProjectAnnualBudget.java index 584d6c5..ed66020 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/entity/ProjectAnnualBudget.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/entity/ProjectAnnualBudget.java @@ -71,24 +71,40 @@ public class ProjectAnnualBudget implements Serializable { @Excel(name = "项目id", width = 15) @ApiModelProperty(value = "项目id") private String projectId; + + @Excel(name = "年度1", width = 15) + @ApiModelProperty(value = "年度1") + private String year1; + /** + * 年度2 + */ + @Excel(name = "年度2", width = 15) + @ApiModelProperty(value = "年度2") + private String year2; /** - * 年度1 + * 年度3 */ + @Excel(name = "年度3", width = 15) + @ApiModelProperty(value = "年度3") + private String year3; + @Excel(name = "年度1", width = 15) @ApiModelProperty(value = "年度1") - private String annual1; + private String year1Value; /** * 年度2 */ @Excel(name = "年度2", width = 15) @ApiModelProperty(value = "年度2") - private String annual2; + private String year2Value; /** * 年度3 */ @Excel(name = "年度3", width = 15) @ApiModelProperty(value = "年度3") - private String annual3; + private String year3Value; + + /** * 部门名称 */ diff --git a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/NianDuYuSuanDemo.vue b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/NianDuYuSuanDemo.vue index c954208..c118d31 100644 --- a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/NianDuYuSuanDemo.vue +++ b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/NianDuYuSuanDemo.vue @@ -28,17 +28,17 @@ - + - {{sum}} + {{Amount}}
- 保存 + 保存 返回
@@ -46,7 +46,10 @@