From b1cb09dd5c8917a7ef0f19f60ba5f705abdb0278 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Thu, 9 Jan 2025 17:57:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=A5=E8=AF=86=E6=A6=82?= =?UTF-8?q?=E8=A6=81=E7=BC=96=E8=BE=91=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KnowledgeSummaryController.java | 30 +++++++++++++------ .../entity/SysKnowledgeSummary.java | 15 ++++++++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/KnowledgeSummaryController.java b/src/main/java/com/sztzjy/resource_center/controller/KnowledgeSummaryController.java index 560e83a..02a092e 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/KnowledgeSummaryController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/KnowledgeSummaryController.java @@ -40,16 +40,18 @@ public class KnowledgeSummaryController { if (StringUtils.isBlank(sysKnowledgeSummary.getContent())) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "内容不能为空!"); } - //不为空修改 - SysKnowledgeSummaryExample example = new SysKnowledgeSummaryExample(); - SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria(); - criteria.andOneTagIdEqualTo(sysKnowledgeSummary.getOneTagId()).andThreeTagIdEqualTo(sysKnowledgeSummary.getThreeTagId()).andTwoTagIdEqualTo(sysKnowledgeSummary.getTwoTagId()); - List sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example); - if (sysKnowledgeSummaries != null && !sysKnowledgeSummaries.isEmpty()) { - knowledgeSummaryMapper.updateByPrimaryKeyWithBLOBs(sysKnowledgeSummary); - return new ResultEntity<>(HttpStatus.OK, "修改成功!"); + if (StringUtils.isBlank(sysKnowledgeSummary.getThreeTagId())||StringUtils.isBlank(sysKnowledgeSummary.getThreeTagName())){ + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请先选择章节!"); } + //不为空修改 + if (StringUtils.isNotBlank(sysKnowledgeSummary.getKnowledgeSummaryId())) { + SysKnowledgeSummary sysKnowledgeSummaries = knowledgeSummaryMapper.selectByPrimaryKey(sysKnowledgeSummary.getKnowledgeSummaryId()); + if (sysKnowledgeSummaries != null) { + knowledgeSummaryMapper.updateByPrimaryKeyWithBLOBs(sysKnowledgeSummary); + return new ResultEntity<>(HttpStatus.OK, "修改成功!"); + } + } //新增 String uuid = IdUtil.randomUUID(); sysKnowledgeSummary.setKnowledgeSummaryId(uuid); @@ -96,6 +98,11 @@ public class KnowledgeSummaryController { @RequestParam String oneId, @RequestParam String twoId, @RequestParam String threeId) { + //单独处理打印 + if (threeId.equals("f7498d64-0231-42c4-bc1e-8a0186eab56a")) { + System.out.println("操作对象为变量时前端传的数据,一级ID===》》》》" + oneId + "二级Id===》》" + twoId + "三级Id===》》" + threeId); + } + //删除知识概要 try { knowledgeSummaryMapper.deleteByPrimaryKey(id); @@ -108,7 +115,7 @@ public class KnowledgeSummaryController { example.createCriteria().andKnowledgeSummaryIdEqualTo(id).andOneIdEqualTo(oneId).andThreeIdEqualTo(threeId).andTwoIdEqualTo(twoId); knowledgeAndCourseMapper.deleteByExample(example); return new ResultEntity<>(HttpStatus.OK, "删除成功!"); -} + } @AnonymousAccess @@ -121,6 +128,11 @@ public class KnowledgeSummaryController { SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria(); criteria.andOneTagIdEqualTo(oneId).andThreeTagIdEqualTo(threeId).andTwoTagIdEqualTo(twoId); List sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example); + //单独处理打印 + if (threeId.equals("f7498d64-0231-42c4-bc1e-8a0186eab56a")) { + System.out.println("操作对象为变量时前端传的数据,一级ID===》》》》" + oneId + "二级Id===》》" + twoId + "三级Id===》》" + threeId); + } + if (sysKnowledgeSummaries != null && !sysKnowledgeSummaries.isEmpty()) { return new ResultEntity(sysKnowledgeSummaries.get(0)); } else return null; diff --git a/src/main/java/com/sztzjy/resource_center/entity/SysKnowledgeSummary.java b/src/main/java/com/sztzjy/resource_center/entity/SysKnowledgeSummary.java index f6f1826..317bfee 100644 --- a/src/main/java/com/sztzjy/resource_center/entity/SysKnowledgeSummary.java +++ b/src/main/java/com/sztzjy/resource_center/entity/SysKnowledgeSummary.java @@ -106,4 +106,19 @@ public class SysKnowledgeSummary { public void setContent(String content) { this.content = content == null ? null : content.trim(); } + + @Override + public String toString() { + return "SysKnowledgeSummary{" + + "knowledgeSummaryId='" + knowledgeSummaryId + '\'' + + ", oneTagId='" + oneTagId + '\'' + + ", oneTagName='" + oneTagName + '\'' + + ", twoTagId='" + twoTagId + '\'' + + ", twoTagName='" + twoTagName + '\'' + + ", threeTagId='" + threeTagId + '\'' + + ", threeTagName='" + threeTagName + '\'' + + ", source='" + source + '\'' + + ", content='" + content + '\'' + + '}'; + } } \ No newline at end of file