试卷题目管理
This commit is contained in:
parent
0ab32cebdc
commit
3054b861e7
|
|
@ -1,16 +1,19 @@
|
||||||
package com.ruoyi.exam.controller;
|
package com.ruoyi.exam.controller;
|
||||||
|
|
||||||
import com.ruoyi.exam.domain.ExamPractice;
|
import com.ruoyi.exam.domain.ExamPractice;
|
||||||
|
import com.ruoyi.exam.domain.ExamPracticeQuestion;
|
||||||
|
import com.ruoyi.exam.domain.ExamPracticeQuestionVO;
|
||||||
|
import com.ruoyi.exam.domain.ExamQuestion;
|
||||||
|
import com.ruoyi.exam.service.IExamPracticeQuestionService;
|
||||||
import com.ruoyi.exam.service.IExamPracticeService;
|
import com.ruoyi.exam.service.IExamPracticeService;
|
||||||
|
import com.ruoyi.exam.service.IExamQuestionService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -18,12 +21,18 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Api("练习")
|
@Api("练习")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/practice")
|
@RequestMapping("/api/v1/practice")
|
||||||
public class ApiPracticeController extends BaseController {
|
public class ApiPracticeController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExamPracticeService examPracticeService;
|
private IExamPracticeService examPracticeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamPracticeQuestionService examPracticeQuestionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamQuestionService examQuestionService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public TableDataInfo list(ExamPractice examPractice) {
|
public TableDataInfo list(ExamPractice examPractice) {
|
||||||
|
|
@ -32,4 +41,17 @@ public class ApiPracticeController extends BaseController {
|
||||||
return getDataTable( list );
|
return getDataTable( list );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/queryone/question/{id}")
|
||||||
|
public TableDataInfo queryOne(@PathVariable("id") Integer id) {
|
||||||
|
ExamPracticeQuestionVO examPracticeQuestion = new ExamPracticeQuestionVO();
|
||||||
|
examPracticeQuestion.setId(id);
|
||||||
|
List<ExamPracticeQuestionVO> list = examPracticeQuestionService.selectExamPracticeQuestionList(examPracticeQuestion);
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
for (ExamPracticeQuestionVO item : list) {
|
||||||
|
ids.add(item.getExamQuestionId().toString());
|
||||||
|
}
|
||||||
|
List<ExamQuestion> result = examQuestionService.selectByIdsPage(ids);
|
||||||
|
return getDataTable( result );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,4 +62,6 @@ public interface IExamQuestionService extends AbstractBaseService<ExamQuestion>
|
||||||
List<ExamQuestion> selectQuestionList(ExamQuestion examQuestion);
|
List<ExamQuestion> selectQuestionList(ExamQuestion examQuestion);
|
||||||
|
|
||||||
List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion);
|
List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion);
|
||||||
|
|
||||||
|
List<ExamQuestion> selectByIdsPage(List<String> ids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,4 +161,16 @@ public class ExamQuestionServiceImpl extends AbstractBaseServiceImpl<ExamQuestio
|
||||||
return examQuestionMapper.selectListBycategory(examQuestion);
|
return examQuestionMapper.selectListBycategory(examQuestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExamQuestion> selectByIdsPage(List<String> ids) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
for (String id : ids) {
|
||||||
|
sb.append(id+",");
|
||||||
|
}
|
||||||
|
String substring = sb.substring(0, sb.length() - 1);
|
||||||
|
startPage();
|
||||||
|
return examQuestionMapper.selectByIds(substring.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue