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 @@