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

master
xiaoCJ 3 months ago
parent b421c79506
commit 06a72178d0

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

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

@ -1,8 +1,8 @@
package com.sztzjy.resource_center.entity; package com.sztzjy.resource_center.entity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
/** /**
*
* @author xcj * @author xcj
* sys_case_question_steps * sys_case_question_steps
*/ */
@ -34,6 +34,16 @@ public class SysCaseQuestionStepWithBLOBs extends SysCaseQuestionStep {
@ApiModelProperty("练习答案原始数据") @ApiModelProperty("练习答案原始数据")
private String practiceAnswerOriginal; private String practiceAnswerOriginal;
public String threeId;
public String getThreeId() {
return threeId;
}
public void setThreeId(String threeId) {
this.threeId = threeId;
}
public String getTitle() { public String getTitle() {
return title; 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.SysCaseQuestionStepExample;
import com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs; import com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs;
import java.util.List; import java.util.List;
import java.util.Map;
import com.sztzjy.resource_center.entity.dto.TrainingDto; import com.sztzjy.resource_center.entity.dto.TrainingDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.geolatte.geom.M;
@Mapper @Mapper
public interface SysCaseQuestionStepMapper { public interface SysCaseQuestionStepMapper {
long countByExample(SysCaseQuestionStepExample example); long countByExample(SysCaseQuestionStepExample example);
@ -47,4 +50,5 @@ public interface SysCaseQuestionStepMapper {
List<SysCaseQuestionStepWithBLOBs> getCaseStepByIds(@Param("ids") List<String> ids); List<SysCaseQuestionStepWithBLOBs> getCaseStepByIds(@Param("ids") List<String> ids);
List<SysCaseQuestionStepWithBLOBs> selectCaseStepListBatchByIdListAndSort(@Param("threeId") String threeId); 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="question_original" jdbcType="LONGVARCHAR" property="questionOriginal"/>
<result column="answer_original" jdbcType="LONGVARCHAR" property="answerOriginal"/> <result column="answer_original" jdbcType="LONGVARCHAR" property="answerOriginal"/>
<result column="practice_answer_original" jdbcType="LONGVARCHAR" property="practiceAnswerOriginal"/> <result column="practice_answer_original" jdbcType="LONGVARCHAR" property="practiceAnswerOriginal"/>
<result column="three_id" jdbcType="VARCHAR" property="threeId"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -433,6 +435,7 @@
GROUP BY sq.title, s3.three_name,sqs.case_id; GROUP BY sq.title, s3.three_name,sqs.case_id;
</select> </select>
<select id="getCaseStepByIds" resultMap="ResultMapWithBLOBs"> <select id="getCaseStepByIds" resultMap="ResultMapWithBLOBs">
SELECT title,case_step_id,case_id,sort,score SELECT title,case_step_id,case_id,sort,score
FROM sys_case_question_steps FROM sys_case_question_steps
@ -442,6 +445,21 @@
</foreach> </foreach>
</select> </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 id="selectCaseStepListBatchByIdListAndSort" resultMap="ResultMapWithBLOBs">
SELECT sc.* SELECT sc.*
from sys_case_question_steps sc from sys_case_question_steps sc
@ -452,4 +470,5 @@
where st.three_id = #{threeId} where st.three_id = #{threeId}
order by s.create_time ,sc.sort order by s.create_time ,sc.sort
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save