新增查询API,修改案例题删除

master
xiaoCJ 3 months ago
parent b421c79506
commit 06a72178d0

@ -201,13 +201,16 @@ public class CaseController {
@PostMapping("deleteCase")
public ResultEntity<HttpStatus> deleteCase(@RequestBody SysCaseQuestion sysCaseQuestion,
@ApiParam("哪个用的掉的请求,传管理员/学校ID") @RequestParam String source) {
if (sysCaseQuestion.getOneId()==null&& sysCaseQuestion.getTwoId()==null&&sysCaseQuestion.getThreeId()==null){
sysCaseQuestion.setUnmountStatus(true);
caseQuestionMapper.updateByPrimaryKeySelective(sysCaseQuestion);
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
}
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestion.getCaseId(), sysCaseQuestion.getOneId());
if (!sysTopicAndCourses.isEmpty()) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!");
} else {
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
topicAndCourseMapper.deleteByPrimaryKey(sysTopicAndCourses.get(0).getId());
sysCaseQuestion.setUnmountStatus(true);
caseQuestionMapper.updateByPrimaryKeySelective(sysCaseQuestion);
return new ResultEntity<>(HttpStatus.OK, "删除成功!");

@ -321,7 +321,12 @@ public class CaseApi {
return caseQuestionStepMapper.selectCaseStepListBatchByIdListAndSort(threeId);
}
@PostMapping("selectCaseStepListBatchByIdListAndSortss")
@ApiOperation("查询案例题步骤并排序")
@AnonymousAccess
public List<SysCaseQuestionStepWithBLOBs> selectCaseStepListBatchByIdListAndSortss(@RequestBody List<String> list) {
return caseQuestionStepMapper.selectCaseStepListBatchByIdListAndSortss(list);
}
/**
* IdList
* selectCaseByChapterIdList

@ -1,8 +1,8 @@
package com.sztzjy.resource_center.entity;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @author xcj
* sys_case_question_steps
*/
@ -34,6 +34,16 @@ public class SysCaseQuestionStepWithBLOBs extends SysCaseQuestionStep {
@ApiModelProperty("练习答案原始数据")
private String practiceAnswerOriginal;
public String threeId;
public String getThreeId() {
return threeId;
}
public void setThreeId(String threeId) {
this.threeId = threeId;
}
public String getTitle() {
return title;
}

@ -4,10 +4,13 @@ import com.sztzjy.resource_center.entity.SysCaseQuestionStep;
import com.sztzjy.resource_center.entity.SysCaseQuestionStepExample;
import com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs;
import java.util.List;
import java.util.Map;
import com.sztzjy.resource_center.entity.dto.TrainingDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.geolatte.geom.M;
@Mapper
public interface SysCaseQuestionStepMapper {
long countByExample(SysCaseQuestionStepExample example);
@ -47,4 +50,5 @@ public interface SysCaseQuestionStepMapper {
List<SysCaseQuestionStepWithBLOBs> getCaseStepByIds(@Param("ids") List<String> ids);
List<SysCaseQuestionStepWithBLOBs> selectCaseStepListBatchByIdListAndSort(@Param("threeId") String threeId);
List<SysCaseQuestionStepWithBLOBs> selectCaseStepListBatchByIdListAndSortss(@Param("list") List<String> list);
}

@ -18,6 +18,8 @@
<result column="question_original" jdbcType="LONGVARCHAR" property="questionOriginal"/>
<result column="answer_original" jdbcType="LONGVARCHAR" property="answerOriginal"/>
<result column="practice_answer_original" jdbcType="LONGVARCHAR" property="practiceAnswerOriginal"/>
<result column="three_id" jdbcType="VARCHAR" property="threeId"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -433,6 +435,7 @@
GROUP BY sq.title, s3.three_name,sqs.case_id;
</select>
<select id="getCaseStepByIds" resultMap="ResultMapWithBLOBs">
SELECT title,case_step_id,case_id,sort,score
FROM sys_case_question_steps
@ -442,6 +445,21 @@
</foreach>
</select>
<select id="selectCaseStepListBatchByIdListAndSortss" resultMap="ResultMapWithBLOBs">
SELECT st.three_id,sc.*
from sys_case_question_steps sc
left join sys_case_questions s
on sc.case_id = s.case_id
left join sys_topic_and_course st
on st.topic_id = s.case_id
where st.three_id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
order by s.create_time ,sc.sort
</select>
<select id="selectCaseStepListBatchByIdListAndSort" resultMap="ResultMapWithBLOBs">
SELECT sc.*
from sys_case_question_steps sc
@ -452,4 +470,5 @@
where st.three_id = #{threeId}
order by s.create_time ,sc.sort
</select>
</mapper>
Loading…
Cancel
Save