我的分享题库,题目渲染

This commit is contained in:
Unique-Jerry 2023-11-22 21:47:18 +08:00
parent c15e17e1e9
commit 3d7a8fcc9b
6 changed files with 97 additions and 1 deletions

View File

@ -170,6 +170,16 @@ public class QuestionController {
}
@GetMapping("/get_typeById")
public R getTypeById(Integer id){
QuestionBank bankById = questionBankService.getBankById(id);
if(bankById==null){
return R.error("查找失败,请稍后再试");
}
return R.success(bankById);
}
/**
* 根据公司编码查找题目
@ -356,6 +366,28 @@ public class QuestionController {
return R.success(sharedQuestionBankDtoList);
}
@PostMapping("/edit_OurSharedQuestionType")
public R editOurSharedQuestionType(@RequestBody Map<String, Object> updateInfo) {
Integer id = (Integer) updateInfo.get("id");
String typeName = (String) updateInfo.get("typeName");
String description = (String) updateInfo.get("description");
Integer type = (Integer) updateInfo.get("type");
Integer userId = (Integer) updateInfo.get("userId");
Integer rows = sharedQuestionBankService.editOurSharedQuestionType(id, typeName, description, type, userId);
if (rows != 1) {
return R.error("修改失败");
}
return R.success("修改成功");
}
@DeleteMapping("/delete_OurSharedQuestionType")
public R deleteOurSharedQuestionType(Integer id){
sharedQuestionBankService.deleteOurSharedQuestionType(id);
return R.success("删除成功");
}
@GetMapping("/get_OurQuestionList")
public R getOurSharedQuestionList(String encoding){
List<SharedQuestionDto> ourQuestionList = sharedQuestionService.getOurQuestionList(encoding);
@ -367,7 +399,15 @@ public class QuestionController {
return R.success(sharedQuestionDtoList);
}
@PostMapping("/delete_OurSharedQuestion")
public R deleteOurSharedQuestion(@RequestBody Map<String,Object> sharedQuestionId){
List<Integer> ids=(List<Integer>) sharedQuestionId.get("sharedQuestionId");
Integer rows= sharedQuestionService.deleteOurSharedQuestion(ids);
return R.success("删除成功,删除"+rows+"分享题目");
}
}

View File

@ -62,5 +62,4 @@ public interface QuestionBankService extends IService<QuestionBank> {
QuestionBank getBankById(Integer id);
}

View File

@ -68,6 +68,24 @@ public interface SharedQuestionBankService extends IService<SharedQuestionBank>
*/
List<SharedQuestionBankDto> searchOurSharedQuestionType(String encoding,String searchName);
/**
* 根据分享题库id修改题库信息
* @param id 分享题库id
* @param typeName 题库名称
* @param description 题库描述
* @param type 题库类型
* @param userId 更该人id
* @return 修改的行数
* */
Integer editOurSharedQuestionType(Integer id,String typeName,String description,Integer type,Integer userId);
/**
* 根据分享题库id删除分享题库
* @param id 分享题库id
* @return 影响的行数
* */
Integer deleteOurSharedQuestionType(Integer id);
}

View File

@ -57,7 +57,13 @@ public interface SharedQuestionService extends IService<SharedQuestion> {
*/
List<SharedQuestionDto> searchOurSharedQuestion(String encoding,String searchName);
/**
* 删除分享题目
* @return 影响的行数
* */
Integer deleteOurSharedQuestion(List<Integer> ids);
}

View File

@ -279,7 +279,32 @@ public class SharedQuestionBankServiceImpl extends ServiceImpl<SharedQuestionBan
return sharedQuestionBankDtos;
}
@Override
public Integer editOurSharedQuestionType(Integer id, String typeName, String description, Integer type, Integer userId) {
LambdaQueryWrapper<SharedQuestionBank> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(SharedQuestionBank::getId,id);
SharedQuestionBank sharedQuestionBank = sharedQuestionBankMapper.selectOne(queryWrapper);
sharedQuestionBank.setTypeName(typeName);
sharedQuestionBank.setDescription(description);
sharedQuestionBank.setType(type);
sharedQuestionBank.setUpdateUser(userId);
sharedQuestionBank.setUpdateTime(TimeUtil.getTime());
return sharedQuestionBankMapper.updateById(sharedQuestionBank);
}
@Override
public Integer deleteOurSharedQuestionType(Integer id) {
LambdaQueryWrapper<SharedQuestionBank> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(SharedQuestionBank::getId,id);
return sharedQuestionBankMapper.delete(queryWrapper);
}
}

View File

@ -288,5 +288,13 @@ public class SharedQuestionServiceImpl extends ServiceImpl<SharedQuestionMapper,
return sharedQuestionDtos;
}
@Override
public Integer deleteOurSharedQuestion(List<Integer> ids) {
Integer rows =sharedQuestionMapper.deleteBatchIds(ids);
return rows;
}
}