新增三方接口

master
xiaoCJ 8 months ago
parent 7b3cb401fc
commit e0c65c4640

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

@ -96,11 +96,11 @@ public class TopicResourceController {
sysTopicAndCourse.setTopicType(objectiveQuestion.getType());
sysTopicAndCourse.setOneId(objectiveQuestion.getOneID());
sysTopicAndCourse.setOneName(objectiveQuestion.getOneName());
if (StringUtils.isNotBlank(sysTopicAndCourse.getTwoId())) {
if (StringUtils.isNotBlank(objectiveQuestion.getTwoID())) {
sysTopicAndCourse.setTwoId(sysTopicAndCourse.getTwoId());
sysTopicAndCourse.setTwoName(objectiveQuestion.getTwoName());
}
if (StringUtils.isNotBlank(sysTopicAndCourse.getThreeId())) {
if (StringUtils.isNotBlank(objectiveQuestion.getThreeID())) {
sysTopicAndCourse.setThreeId(sysTopicAndCourse.getThreeId());
sysTopicAndCourse.setThreeName(objectiveQuestion.getThreeName());
}
@ -160,9 +160,10 @@ public class TopicResourceController {
@RequestParam(required = false) String oneID,
@RequestParam(required = false) String twoID,
@RequestParam(required = false) String threeID,
@RequestParam(required = false) String type,
@ApiParam("题干") @RequestParam(required = false) String content) {
PageHelper.startPage(index, size);
List<SysObjectiveQuestionsDto> list = sysObjectiveQuestionMapper.selectTopicByConditions(oneID, twoID, threeID, content);
List<SysObjectiveQuestionsDto> list = sysObjectiveQuestionMapper.selectTopicByConditions(oneID, twoID, threeID, type,content);
PageInfo<SysObjectiveQuestionsDto> pageInfo = new PageInfo(list);
return new ResultEntity<PageInfo<SysObjectiveQuestionsDto>>(pageInfo);
}

@ -61,16 +61,15 @@ public class CourseApi {
@AnonymousAccess
@ApiOperation("添加二级目录")
@PostMapping("insertSysTwoCatalog")
public Boolean insertSysTwoCatalog(@RequestBody SysTwoCatalog sysTwoCatalog, @RequestParam String systemOwner) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
public Boolean insertSysTwoCatalog(@RequestBody SysTwoCatalog sysTwoCatalog) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(sysTwoCatalog.getOneId());
if (sysOneCatalogs == null) {
return false;
}
String oneName = sysOneCatalogs.getOneName();
String oneId = sysOneCatalogs.getOneId();
sysTwoCatalog.setTwoId(IdUtil.randomUUID());
sysTwoCatalog.setOneId(oneName);
sysTwoCatalog.setOneId(oneId);
sysTwoCatalog.setCreateTime(new Date());
sysTwoCatalog.setCreator(sysTwoCatalog.getCreator());
sysTwoCatalog.setSort(null);
twoCatalogMapper.insert(sysTwoCatalog);
return true;
@ -87,9 +86,9 @@ public class CourseApi {
@AnonymousAccess
@ApiOperation("添加三级目录")
@PostMapping("insertSysThreeCatalog")
public Boolean insertSysThreeCatalog(@RequestBody SysThreeCatalog sysThreeCatalog, @RequestParam String systemOwner) {
public Boolean insertSysThreeCatalog(@RequestBody SysThreeCatalog sysThreeCatalog) {
try {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(sysThreeCatalog.getOntId());
sysThreeCatalog.setThreeId(IdUtil.randomUUID());
sysThreeCatalog.setOntId(sysOneCatalogs.getOneId());
sysThreeCatalog.setCreateTime(new Date());

@ -34,6 +34,7 @@ public interface SysObjectiveQuestionsMapper {
List<SysObjectiveQuestionsDto> selectTopicByConditions(@Param("oneID")String oneID,
@Param("twoID") String twoID,
@Param("threeID") String threeID,
@Param("type")String type,
@Param("content") String content);
int insertBatch(@Param("objectiveQuestionList") List<SysObjectiveQuestions> objectiveQuestionList);

@ -400,13 +400,16 @@
on sb.objective_id = st.topic_id
<where>
<if test="oneID != null and oneID != ''">
sb.one_id = #{oneID}
st.one_id = #{oneID}
</if>
<if test="twoID != null and twoID != ''">
and sb.two_id = #{twoID}
and st.two_id = #{twoID}
</if>
<if test="threeID != null and threeID != '' ">
and sb.three_id = #{threeID}
and st.three_id = #{threeID}
</if>
<if test="type != null and type != '' ">
and sb.type = #{type}
</if>
<if test="content != null and content != ''">
and sb.content = #{content}

Loading…
Cancel
Save