|
|
|
@ -15,10 +15,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -39,13 +36,17 @@ public class KnowledgeSummaryController {
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("知识概要新增或修改")
|
|
|
|
|
@PostMapping("addOrUpdate")
|
|
|
|
|
public ResultEntity<String> addOrUpdate(@ApiParam("没传ID为新增,传了为修改,新增传source字段") @RequestParam SysKnowledgeSummary sysKnowledgeSummary) {
|
|
|
|
|
public ResultEntity<String> addOrUpdate(@ApiParam("没传ID为新增,传了为修改,新增传source字段") @RequestBody SysKnowledgeSummary sysKnowledgeSummary) {
|
|
|
|
|
if (StringUtils.isBlank(sysKnowledgeSummary.getContent())) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "内容不能为空!");
|
|
|
|
|
}
|
|
|
|
|
//不为空修改
|
|
|
|
|
if (!StringUtils.isBlank(sysKnowledgeSummary.getKnowledgeSummaryId())) {
|
|
|
|
|
knowledgeSummaryMapper.updateByPrimaryKey(sysKnowledgeSummary);
|
|
|
|
|
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()) {
|
|
|
|
|
knowledgeSummaryMapper.updateByPrimaryKeyWithBLOBs(sysKnowledgeSummary);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "修改成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -102,7 +103,7 @@ public class KnowledgeSummaryController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("知识概要条件查询")
|
|
|
|
|
@ApiOperation("知识概要展示")
|
|
|
|
|
@PostMapping("selectByConditions")
|
|
|
|
|
public ResultEntity<SysKnowledgeSummary> selectByConditions(@RequestParam String oneId,
|
|
|
|
|
@RequestParam String twoId,
|
|
|
|
@ -110,8 +111,10 @@ public class KnowledgeSummaryController {
|
|
|
|
|
SysKnowledgeSummaryExample example = new SysKnowledgeSummaryExample();
|
|
|
|
|
SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andOneTagIdEqualTo(oneId).andThreeTagIdEqualTo(threeId).andTwoTagIdEqualTo(twoId);
|
|
|
|
|
List<SysKnowledgeSummary> sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExample(example);
|
|
|
|
|
return new ResultEntity<SysKnowledgeSummary>(sysKnowledgeSummaries.get(0));
|
|
|
|
|
List<SysKnowledgeSummary> sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
if (sysKnowledgeSummaries != null && !sysKnowledgeSummaries.isEmpty()) {
|
|
|
|
|
return new ResultEntity<SysKnowledgeSummary>(sysKnowledgeSummaries.get(0));
|
|
|
|
|
} else return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|