修改知识概要编辑逻辑,添加限制

master
xiaoCJ 2 months ago
parent 06fb5e27e5
commit b1cb09dd5c

@ -40,16 +40,18 @@ public class KnowledgeSummaryController {
if (StringUtils.isBlank(sysKnowledgeSummary.getContent())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "内容不能为空!");
}
if (StringUtils.isBlank(sysKnowledgeSummary.getThreeTagId())||StringUtils.isBlank(sysKnowledgeSummary.getThreeTagName())){
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<SysKnowledgeSummary> sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example);
if (sysKnowledgeSummaries != null && !sysKnowledgeSummaries.isEmpty()) {
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);
@ -121,6 +128,11 @@ public class KnowledgeSummaryController {
SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria();
criteria.andOneTagIdEqualTo(oneId).andThreeTagIdEqualTo(threeId).andTwoTagIdEqualTo(twoId);
List<SysKnowledgeSummary> 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<SysKnowledgeSummary>(sysKnowledgeSummaries.get(0));
} else return null;

@ -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 + '\'' +
'}';
}
}
Loading…
Cancel
Save