修改bug

master
xiaoCJ 8 months ago
parent a86debd494
commit 15ad17c6f7

@ -74,7 +74,7 @@ public class ObjectiveApi {
if (StringUtils.isBlank(objectiveQuestion.getType())) { if (StringUtils.isBlank(objectiveQuestion.getType())) {
return false; return false;
} }
if (StringUtils.isBlank(objectiveQuestion.getObjectiveId())) { //子系统的oneName放在这个字段传过来 if (StringUtils.isBlank(objectiveQuestion.getOneName())) {
return false; return false;
} }
if (objectiveQuestion.getType().equals("1") || objectiveQuestion.getType().equals("0")) { if (objectiveQuestion.getType().equals("1") || objectiveQuestion.getType().equals("0")) {
@ -87,7 +87,7 @@ public class ObjectiveApi {
return false; return false;
} }
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(objectiveQuestion.getObjectiveId()); SysOneCatalog sysOneCatalogs = getSysOneCatalogs(objectiveQuestion.getOneName());
String oneId = sysOneCatalogs.getOneId(); String oneId = sysOneCatalogs.getOneId();
//新增题库表 //新增题库表
String uuid = IdUtil.randomUUID(); String uuid = IdUtil.randomUUID();
@ -103,7 +103,7 @@ public class ObjectiveApi {
sysTopicAndCourse.setTopicId(uuid); sysTopicAndCourse.setTopicId(uuid);
sysTopicAndCourse.setTopicType(objectiveQuestion.getType()); sysTopicAndCourse.setTopicType(objectiveQuestion.getType());
sysTopicAndCourse.setOneId(oneId); sysTopicAndCourse.setOneId(oneId);
sysTopicAndCourse.setOneName(objectiveQuestion.getObjectiveId()); //子系统的oneName放在这个字段传过来 sysTopicAndCourse.setOneName(objectiveQuestion.getOneName());
if (StringUtils.isNotBlank(objectiveQuestion.getTwoID())) { if (StringUtils.isNotBlank(objectiveQuestion.getTwoID())) {
sysTopicAndCourse.setTwoId(objectiveQuestion.getTwoID()); sysTopicAndCourse.setTwoId(objectiveQuestion.getTwoID());
sysTopicAndCourse.setTwoName(objectiveQuestion.getTwoName()); sysTopicAndCourse.setTwoName(objectiveQuestion.getTwoName());
@ -126,7 +126,12 @@ public class ObjectiveApi {
//ID不为空修改绑定信息 //ID不为空修改绑定信息
if (StringUtils.isNotBlank(dto.getTopicAndCourseId())) { if (StringUtils.isNotBlank(dto.getTopicAndCourseId())) {
SysTopicAndCourse sysTopicAndCourse = new SysTopicAndCourse(); SysTopicAndCourse sysTopicAndCourse = new SysTopicAndCourse();
BeanUtils.copyProperties(dto, sysTopicAndCourse); sysTopicAndCourse.setId(dto.getTopicAndCourseId());
sysTopicAndCourse.setTopicId(dto.getObjectiveId());
sysTopicAndCourse.setOneId(dto.getOneID());
sysTopicAndCourse.setOneName(dto.getOneName());
sysTopicAndCourse.setTwoId(dto.getTwoID());
sysTopicAndCourse.setTwoName(dto.getTwoName());
sysTopicAndCourseMapper.updateByPrimaryKeySelective(sysTopicAndCourse); sysTopicAndCourseMapper.updateByPrimaryKeySelective(sysTopicAndCourse);
} }
//修改题库基础信息 //修改题库基础信息
@ -400,7 +405,6 @@ public class ObjectiveApi {
* systemOwner * systemOwner
* return:List<SysObjectiveQuestions> * return:List<SysObjectiveQuestions>
*/ */
@AnonymousAccess @AnonymousAccess
@ApiOperation("随机获取35道内置单选题") @ApiOperation("随机获取35道内置单选题")
@PostMapping("selectRandomObjectiveSingle") @PostMapping("selectRandomObjectiveSingle")
@ -427,7 +431,6 @@ public class ObjectiveApi {
* systemOwner * systemOwner
* return:List<SysObjectiveQuestions> * return:List<SysObjectiveQuestions>
*/ */
@AnonymousAccess @AnonymousAccess
@ApiOperation("随机获取5道内置多选题") @ApiOperation("随机获取5道内置多选题")
@PostMapping("selectRandomObjectiveMany") @PostMapping("selectRandomObjectiveMany")

@ -11,6 +11,7 @@ import com.sztzjy.resource_center.entity.admin.*;
import com.sztzjy.resource_center.mapper.admin.AdminCaseMapper; import com.sztzjy.resource_center.mapper.admin.AdminCaseMapper;
import com.sztzjy.resource_center.mapper.admin.AdminDataLabelMapper; import com.sztzjy.resource_center.mapper.admin.AdminDataLabelMapper;
import com.sztzjy.resource_center.mapper.admin.AdminFileMapper; import com.sztzjy.resource_center.mapper.admin.AdminFileMapper;
import com.sztzjy.resource_center.util.PageUtil;
import com.sztzjy.resource_center.util.ResultEntity; import com.sztzjy.resource_center.util.ResultEntity;
import com.sztzjy.resource_center.util.file.IFileUtil; import com.sztzjy.resource_center.util.file.IFileUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -230,10 +231,9 @@ public class AdminCaseController {
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam(required = false) String keyWord, @RequestParam(required = false) String keyWord,
@ApiParam("精品案例不传,院校案例传'院校案例'") @RequestParam(required = false) String source, @ApiParam("精品案例不传,院校案例传'院校案例'") @RequestParam(required = false) String source,
@RequestParam(required = false) String labelName) { @RequestParam(required = false) List<String> labelName) {
PageHelper.startPage(index, size);
List<AdminCaseReturnDto> adminCaseReturnDtos = adminCaseMapper.selectByConditions(keyWord, source, labelName); List<AdminCaseReturnDto> adminCaseReturnDtos = adminCaseMapper.selectByConditions(keyWord, source, labelName);
PageInfo pageInfo = new PageInfo(adminCaseReturnDtos); PageInfo pageInfo = PageUtil.pageHelper(adminCaseReturnDtos, index, size);
return new ResultEntity<>(pageInfo); return new ResultEntity<>(pageInfo);
} }
@ -320,4 +320,25 @@ public class AdminCaseController {
} }
@PostMapping("deleteCase")
@ApiOperation("删除案例题/管理员使用")
private ResultEntity<String> deleteCase(@RequestParam String caseId) {
try {
//删除案例绑定文件
AdminFileExample example = new AdminFileExample();
example.createCriteria().andDataCaseIdEqualTo(caseId);
adminFileMapper.deleteByExample(example);
//删除案例绑定标签
AdminDataLabelExample example1 = new AdminDataLabelExample();
example1.createCriteria().andDataCaseIdEqualTo(caseId);
adminDataLabelMapper.deleteByExample(example1);
adminCaseMapper.deleteByPrimaryKey(caseId);
} catch (Exception e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "上传失败,请联系管理员!");
}
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
}
} }

@ -10,6 +10,7 @@ import com.sztzjy.resource_center.mapper.admin.AdminCaseMapper;
import com.sztzjy.resource_center.mapper.admin.AdminCollectCaseMapper; import com.sztzjy.resource_center.mapper.admin.AdminCollectCaseMapper;
import com.sztzjy.resource_center.mapper.admin.AdminFileMapper; import com.sztzjy.resource_center.mapper.admin.AdminFileMapper;
import com.sztzjy.resource_center.util.CompressUtil; import com.sztzjy.resource_center.util.CompressUtil;
import com.sztzjy.resource_center.util.PageUtil;
import com.sztzjy.resource_center.util.ResultEntity; import com.sztzjy.resource_center.util.ResultEntity;
import com.sztzjy.resource_center.util.file.IFileUtil; import com.sztzjy.resource_center.util.file.IFileUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -73,11 +74,9 @@ public class StuCaseController {
@RequestParam(required = false) String keyWord, @RequestParam(required = false) String keyWord,
@ApiParam("精品案例传管理员院校案例传学校ID") @RequestParam(required = false) String source, @ApiParam("精品案例传管理员院校案例传学校ID") @RequestParam(required = false) String source,
@ApiParam("收藏案例页面传") @RequestParam(required = false) String userId, @ApiParam("收藏案例页面传") @RequestParam(required = false) String userId,
@RequestParam(required = false) String labelName) { @RequestParam(required = false) List<String> labelName) {
PageHelper.startPage(index, size);
List<AdminCaseReturnDto> adminCaseReturnDtos = adminCaseMapper.selectByConditionsByStu(keyWord, source, userId, labelName); List<AdminCaseReturnDto> adminCaseReturnDtos = adminCaseMapper.selectByConditionsByStu(keyWord, source, userId, labelName);
PageInfo pageInfo = new PageInfo(adminCaseReturnDtos); PageInfo pageInfo = PageUtil.pageHelper(adminCaseReturnDtos, index, size);
return new ResultEntity<>(pageInfo); return new ResultEntity<>(pageInfo);
} }
@ -105,4 +104,5 @@ public class StuCaseController {
CompressUtil.downloadZip(response, zipName, pocZipFile); CompressUtil.downloadZip(response, zipName, pocZipFile);
} }
} }
} }

@ -8,7 +8,6 @@ import lombok.Data;
* @author xcj * @author xcj
* sys_topic_and_course * sys_topic_and_course
*/ */
@Data
public class SysTopicAndCourse { public class SysTopicAndCourse {
private String id; private String id;

@ -4,10 +4,11 @@ import com.sztzjy.resource_center.entity.admin.AdminCase;
import com.sztzjy.resource_center.entity.admin.AdminCaseExample; import com.sztzjy.resource_center.entity.admin.AdminCaseExample;
import com.sztzjy.resource_center.entity.admin.AdminCaseReturnDto; import com.sztzjy.resource_center.entity.admin.AdminCaseReturnDto;
import com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs; import com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs;
import java.util.List;
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 java.util.List;
@Mapper @Mapper
public interface AdminCaseMapper { public interface AdminCaseMapper {
long countByExample(AdminCaseExample example); long countByExample(AdminCaseExample example);
@ -39,12 +40,12 @@ public interface AdminCaseMapper {
int updateByPrimaryKey(AdminCase record); int updateByPrimaryKey(AdminCase record);
List<AdminCaseReturnDto> selectByConditionsByStu(@Param("keyWord") String keyWord, List<AdminCaseReturnDto> selectByConditionsByStu(@Param("keyWord") String keyWord,
@Param("source") String source, @Param("source") String source,
@Param("userId") String userId, @Param("userId") String userId,
@Param("labelName") String labelName); @Param("labelName") List<String> labelName);
List<AdminCaseReturnDto> selectByConditions(@Param("keyWord") String keyWord, List<AdminCaseReturnDto> selectByConditions(@Param("keyWord") String keyWord,
@Param("source") String source, @Param("source") String source,
@Param("labelName") String labelName); @Param("labelName") List<String> labelName);
} }

@ -359,8 +359,11 @@
<if test="keyWord !=null and keyWord !=''"> <if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%') and a.name like CONCAT('%', #{keyWord}, '%')
</if> </if>
<if test="labelName !=null and labelName !=''"> <if test="labelName !=null and labelName.size() > 0">
and ad.name = #{labelName} and ad.name in
<foreach collection="labelName" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="source !=null and source !=''"> <if test="source !=null and source !=''">
and a.source !='管理员' and a.source !='管理员'
@ -383,8 +386,11 @@
<if test="keyWord !=null and keyWord !=''"> <if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%') and a.name like CONCAT('%', #{keyWord}, '%')
</if> </if>
<if test="labelName !=null and labelName !=''"> <if test="labelName != null and labelName.size() > 0">
and ad.name = #{labelName} AND ad.name IN
<foreach collection="labelName" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="source !=null and source !='管理员'"> <if test="source !=null and source !='管理员'">
and a.source = #{source} and a.source = #{source}

@ -348,7 +348,7 @@
and a.name like CONCAT('%', #{keyWord}, '%') and a.name like CONCAT('%', #{keyWord}, '%')
</if> </if>
<if test="labelName !=null and labelName !=''"> <if test="labelName !=null and labelName !=''">
and ad.name = #{labelName} and ad.name in (#{labelName})
</if> </if>
<if test="type !=null and type !=''"> <if test="type !=null and type !=''">
and a.source != '管理员' and a.source != '管理员'

Loading…
Cancel
Save