修改案例题客观题逻辑

master
xiaoCJ 7 months ago
parent d3f9a00754
commit 7060b7e278

@ -63,12 +63,8 @@ public class CaseController {
if (!sysCaseQuestions.isEmpty()) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "案例名称不能重复!");
}
String uuid = IdUtil.randomUUID();
sysCaseQuestion.setCaseId(uuid);
sysCaseQuestion.setCreateTime(new Date());
sysCaseQuestion.setUnmountStatus(false);
caseQuestionMapper.insert(sysCaseQuestion);
//新增绑定关系
SysTopicAndCourse sysTopicAndCourse = new SysTopicAndCourse();
sysTopicAndCourse.setId(IdUtil.randomUUID());
@ -85,6 +81,10 @@ public class CaseController {
sysTopicAndCourse.setThreeName(sysCaseQuestion.getThreeName());
}
topicAndCourseMapper.insert(sysTopicAndCourse);
sysCaseQuestion.setCaseId(uuid);
sysCaseQuestion.setCreateTime(new Date());
sysCaseQuestion.setUnmountStatus(false);
caseQuestionMapper.insert(sysCaseQuestion);
return new ResultEntity<>(HttpStatus.OK, "新增成功!");
}
@ -122,11 +122,16 @@ public class CaseController {
@AnonymousAccess
@ApiOperation("案例题详细内容展示")
@PostMapping("selectCaseByConditionsByID")
public ResultEntity<SysCaseQuestion> selectCaseByConditionsByID(@RequestParam String caseId) {
public ResultEntity<SysCaseQuestion> selectCaseByConditionsByID(@RequestParam String caseId,
@RequestParam(required = false) String oneId) {
SysCaseQuestion sysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(caseId);
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andTopicIdEqualTo(caseId);
SysTopicAndCourseExample.Criteria criteria = example.createCriteria();
criteria.andTopicIdEqualTo(caseId);
if (StringUtils.isNotBlank(oneId)) {
criteria.andOneIdEqualTo(oneId);
}
List<SysTopicAndCourse> topicAndCourseList = topicAndCourseMapper.selectByExample(example);
if (!topicAndCourseList.isEmpty()) {
SysTopicAndCourse sysTopicAndCourse = topicAndCourseList.get(0);
@ -168,6 +173,18 @@ public class CaseController {
sysTopicAndCourse.setTwoName(sysCaseQuestion.getTwoName());
sysTopicAndCourse.setThreeName(sysCaseQuestion.getThreeName());
topicAndCourseMapper.updateByPrimaryKeySelective(sysTopicAndCourse);
} else {
SysTopicAndCourse sysTopicAndCourse = new SysTopicAndCourse();
sysTopicAndCourse.setId(IdUtil.randomUUID());
sysTopicAndCourse.setTopicId(sysCaseQuestion.getCaseId());
sysTopicAndCourse.setOneId(sysCaseQuestion.getOneId());
sysTopicAndCourse.setOneName(sysCaseQuestion.getOneName());
sysTopicAndCourse.setTwoId(sysCaseQuestion.getTwoId());
sysTopicAndCourse.setThreeId(sysCaseQuestion.getThreeId());
sysTopicAndCourse.setTwoName(sysCaseQuestion.getTwoName());
sysTopicAndCourse.setThreeName(sysCaseQuestion.getThreeName());
sysTopicAndCourse.setTopicType("1");
topicAndCourseMapper.insert(sysTopicAndCourse);
}
caseQuestionMapper.updateByPrimaryKeySelective(sysCaseQuestion);
return new ResultEntity<>(HttpStatus.OK, "编辑成功!");

@ -4,7 +4,6 @@ import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.SysCaseQuestionExample;
import com.sztzjy.resource_center.entity.SysResource;
import com.sztzjy.resource_center.entity.SysResourceAndCourse;
import com.sztzjy.resource_center.entity.SysResourceAndCourseExample;
@ -128,10 +127,11 @@ public class CourseConfigController {
public ResultEntity<PageInfo<SysResourceDto>> selectResource(@ApiParam("课程ID") @RequestParam(required = false) String oneID,
@ApiParam("章ID") @RequestParam(required = false) String twoID,
@ApiParam("节ID") @RequestParam(required = false) String threeID,
@ApiParam("资源名称") @RequestParam(required = false) String name,
@RequestParam Integer index,
@RequestParam Integer size) {
PageHelper.startPage(index, size);
List<SysResourceDto> sysResourceDtos = sysResourceMapper.selectResource(oneID, twoID, threeID,null);
List<SysResourceDto> sysResourceDtos = sysResourceMapper.selectResource(oneID, twoID, threeID, name,null);
PageInfo<SysResourceDto> pageInfo = new PageInfo(sysResourceDtos);
return new ResultEntity<PageInfo<SysResourceDto>>(pageInfo);
}
@ -162,5 +162,4 @@ public class CourseConfigController {
}
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
}
}

@ -241,14 +241,12 @@ public class TopicResourceController {
@ApiOperation("删除题目绑定关系")
@PostMapping("deleteTopicBinding")
private ResultEntity<String> deleteTopicBinding(@RequestParam String id,
@RequestParam(required = false) String oneId,
@RequestParam String oneId,
@RequestParam(required = false) String twoId,
@RequestParam(required = false) String threeId) {
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
SysTopicAndCourseExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(oneId)) {
criteria.andOneIdEqualTo(oneId);
}
criteria.andOneIdEqualTo(oneId);
if (StringUtils.isNotBlank(twoId)) {
criteria.andTwoIdEqualTo(twoId);
}
@ -388,8 +386,8 @@ public class TopicResourceController {
String threeId = threeIdMap.get(threeName);
if (threeId == null) {
threeId = sysThreeCatalogMapper.getIdByName(twoName, threeName);
if (threeId==null){
return new ResultEntity<HttpStatus>(HttpStatus.INTERNAL_SERVER_ERROR,"导入关联的章节不存在,请在添加后重新导入");
if (threeId == null) {
return new ResultEntity<HttpStatus>(HttpStatus.INTERNAL_SERVER_ERROR, "导入关联的章节不存在,请在添加后重新导入");
}
threeIdMap.put(threeName, threeId);
}

@ -63,10 +63,7 @@ public class CaseApi {
}
String uuid = IdUtil.randomUUID();
sysCaseQuestion.setCaseId(uuid);
sysCaseQuestion.setCreateTime(new Date());
sysCaseQuestion.setUnmountStatus(false);
caseQuestionMapper.insert(sysCaseQuestion);
//新增绑定关系
SysTopicAndCourse sysTopicAndCourse = new SysTopicAndCourse();
sysTopicAndCourse.setId(IdUtil.randomUUID());
@ -83,6 +80,18 @@ public class CaseApi {
sysTopicAndCourse.setThreeName(sysCaseQuestion.getThreeName());
}
topicAndCourseMapper.insert(sysTopicAndCourse);
sysCaseQuestion.setOneId(null);
sysCaseQuestion.setOneName(null);
sysCaseQuestion.setTwoId(null);
sysCaseQuestion.setTwoName(null);
sysCaseQuestion.setThreeId(null);
sysCaseQuestion.setThreeName(null); //这几个参数只是方便前端传 不能直接插入,否则展示会有问题
sysCaseQuestion.setCaseId(uuid);
sysCaseQuestion.setCreateTime(new Date());
sysCaseQuestion.setUnmountStatus(false);
caseQuestionMapper.insert(sysCaseQuestion);
return true;
}
@ -343,7 +352,8 @@ public class CaseApi {
@RequestParam String systemOwner) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId();
return caseQuestionStepMapper.getGradeReportCase(caseIdList, schoolId, oneId);
List<SysCaseQuestionStepWithBLOBs> gradeReportCase = caseQuestionStepMapper.getGradeReportCase(caseIdList, schoolId, oneId);
return gradeReportCase;
}

@ -128,7 +128,7 @@ public class ResourceApi {
@RequestParam String twoId,
@RequestParam String schoolId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(oneId);
return sysResourceMapper.selectResource(sysOneCatalogs.getOneId(), twoId, null, schoolId);
return sysResourceMapper.selectResource(sysOneCatalogs.getOneId(), twoId, null, null, schoolId);
}
@ -144,7 +144,7 @@ public class ResourceApi {
public List<SysResourceDto> selectResourceByChapterId(@RequestParam String oneId, //这里传的是一级的名称
@RequestParam String threeId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(oneId);
return sysResourceMapper.selectResource(sysOneCatalogs.getOneId(), null, threeId, null);
return sysResourceMapper.selectResource(sysOneCatalogs.getOneId(), null, null, threeId, null);
}

@ -2,14 +2,14 @@ package com.sztzjy.resource_center.mapper;
import com.sztzjy.resource_center.entity.SysResource;
import com.sztzjy.resource_center.entity.SysResourceExample;
import java.util.List;
import java.util.Map;
import com.sztzjy.resource_center.entity.dto.SysResourceDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface SysResourceMapper {
long countByExample(SysResourceExample example);
@ -38,6 +38,7 @@ public interface SysResourceMapper {
List<SysResourceDto> selectResource(@Param("oneId") String oneId,
@Param("twoId") String twoId,
@Param("threeId") String threeId,
@Param("name") String name,
@Param("source") String source);
List<SysResourceDto> selectResourceByRepeat(@Param("oneId") String oneId,

@ -141,14 +141,10 @@
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestion">
insert into sys_case_questions (case_id, title, resource_data,
source, type, one_id,
one_name, two_id, two_name,
three_id, three_name, unmount_status,
source, type, unmount_status,
create_time, update_time, content)
values (#{caseId,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{resourceData,jdbcType=VARCHAR},
#{source,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{oneId,jdbcType=VARCHAR},
#{oneName,jdbcType=VARCHAR}, #{twoId,jdbcType=VARCHAR}, #{twoName,jdbcType=VARCHAR},
#{threeId,jdbcType=VARCHAR}, #{threeName,jdbcType=VARCHAR}, #{unmountStatus,jdbcType=BIT},
#{source,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{unmountStatus,jdbcType=BIT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestion">
@ -364,24 +360,6 @@
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="oneId != null">
one_id = #{oneId,jdbcType=VARCHAR},
</if>
<if test="oneName != null">
one_name = #{oneName,jdbcType=VARCHAR},
</if>
<if test="twoId != null">
two_id = #{twoId,jdbcType=VARCHAR},
</if>
<if test="twoName != null">
two_name = #{twoName,jdbcType=VARCHAR},
</if>
<if test="threeId != null">
three_id = #{threeId,jdbcType=VARCHAR},
</if>
<if test="threeName != null">
three_name = #{threeName,jdbcType=VARCHAR},
</if>
<if test="unmountStatus != null">
unmount_status = #{unmountStatus,jdbcType=BIT},
</if>

@ -389,7 +389,7 @@
</update>
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.SysCaseQuestionStep">
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs">
<result column="step_count" jdbcType="LONGVARCHAR" property="contentOriginal"/>
<result column="three_name" jdbcType="LONGVARCHAR" property="questionOriginal"/>
<result column="title" jdbcType="LONGVARCHAR" property="title"/>
@ -401,7 +401,7 @@
JOIN sys_case_questions s2 ON s1.case_id = s2.case_id
JOIN sys_topic_and_course s3 ON s2.case_id = s3.topic_id
WHERE s2.case_id IN
<foreach collection="sysTwoCatalogs" item="id" open="(" close=")" separator=",">
<foreach collection="list" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
and s2.source in ('管理员', #{schoolId})

@ -429,6 +429,9 @@
<if test="source != null and source != ''">
and sr.source in (#{source},'管理员')
</if>
<if test="name != null and name != ''">
and sr.resource_name LIKE CONCAT('%', #{name}, '%')
</if>
</where>
order by sr.create_time
</select>

Loading…
Cancel
Save