新增三方接口

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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -39,13 +36,17 @@ public class KnowledgeSummaryController {
@AnonymousAccess @AnonymousAccess
@ApiOperation("知识概要新增或修改") @ApiOperation("知识概要新增或修改")
@PostMapping("addOrUpdate") @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())) { if (StringUtils.isBlank(sysKnowledgeSummary.getContent())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "内容不能为空!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "内容不能为空!");
} }
//不为空修改 //不为空修改
if (!StringUtils.isBlank(sysKnowledgeSummary.getKnowledgeSummaryId())) { SysKnowledgeSummaryExample example = new SysKnowledgeSummaryExample();
knowledgeSummaryMapper.updateByPrimaryKey(sysKnowledgeSummary); 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, "修改成功!"); return new ResultEntity<>(HttpStatus.OK, "修改成功!");
} }
@ -102,7 +103,7 @@ public class KnowledgeSummaryController {
@AnonymousAccess @AnonymousAccess
@ApiOperation("知识概要条件查询") @ApiOperation("知识概要展示")
@PostMapping("selectByConditions") @PostMapping("selectByConditions")
public ResultEntity<SysKnowledgeSummary> selectByConditions(@RequestParam String oneId, public ResultEntity<SysKnowledgeSummary> selectByConditions(@RequestParam String oneId,
@RequestParam String twoId, @RequestParam String twoId,
@ -110,8 +111,10 @@ public class KnowledgeSummaryController {
SysKnowledgeSummaryExample example = new SysKnowledgeSummaryExample(); SysKnowledgeSummaryExample example = new SysKnowledgeSummaryExample();
SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria(); SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria();
criteria.andOneTagIdEqualTo(oneId).andThreeTagIdEqualTo(threeId).andTwoTagIdEqualTo(twoId); criteria.andOneTagIdEqualTo(oneId).andThreeTagIdEqualTo(threeId).andTwoTagIdEqualTo(twoId);
List<SysKnowledgeSummary> sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExample(example); List<SysKnowledgeSummary> sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example);
return new ResultEntity<SysKnowledgeSummary>(sysKnowledgeSummaries.get(0)); 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.setTopicType(objectiveQuestion.getType());
sysTopicAndCourse.setOneId(objectiveQuestion.getOneID()); sysTopicAndCourse.setOneId(objectiveQuestion.getOneID());
sysTopicAndCourse.setOneName(objectiveQuestion.getOneName()); sysTopicAndCourse.setOneName(objectiveQuestion.getOneName());
if (StringUtils.isNotBlank(sysTopicAndCourse.getTwoId())) { if (StringUtils.isNotBlank(objectiveQuestion.getTwoID())) {
sysTopicAndCourse.setTwoId(sysTopicAndCourse.getTwoId()); sysTopicAndCourse.setTwoId(sysTopicAndCourse.getTwoId());
sysTopicAndCourse.setTwoName(objectiveQuestion.getTwoName()); sysTopicAndCourse.setTwoName(objectiveQuestion.getTwoName());
} }
if (StringUtils.isNotBlank(sysTopicAndCourse.getThreeId())) { if (StringUtils.isNotBlank(objectiveQuestion.getThreeID())) {
sysTopicAndCourse.setThreeId(sysTopicAndCourse.getThreeId()); sysTopicAndCourse.setThreeId(sysTopicAndCourse.getThreeId());
sysTopicAndCourse.setThreeName(objectiveQuestion.getThreeName()); sysTopicAndCourse.setThreeName(objectiveQuestion.getThreeName());
} }
@ -160,9 +160,10 @@ public class TopicResourceController {
@RequestParam(required = false) String oneID, @RequestParam(required = false) String oneID,
@RequestParam(required = false) String twoID, @RequestParam(required = false) String twoID,
@RequestParam(required = false) String threeID, @RequestParam(required = false) String threeID,
@RequestParam(required = false) String type,
@ApiParam("题干") @RequestParam(required = false) String content) { @ApiParam("题干") @RequestParam(required = false) String content) {
PageHelper.startPage(index, size); 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); PageInfo<SysObjectiveQuestionsDto> pageInfo = new PageInfo(list);
return new ResultEntity<PageInfo<SysObjectiveQuestionsDto>>(pageInfo); return new ResultEntity<PageInfo<SysObjectiveQuestionsDto>>(pageInfo);
} }

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

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

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

Loading…
Cancel
Save