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