一、前言
在线教育作为教育技术变革的产物,已经在国内外迅速兴起,成为教育服务的重要组成部分。根据《2021年中国在线教育行业市场现状、细分市场及发展趋势分析》报告,我国在线教育用户规模达到3.42亿,市场规模约达4230亿元,显示出在线教育行业的巨大潜力和发展空间。在线学习平台通过提供灵活的学习时间和丰富的学习资源,满足了不同用户群体的教育需求。
尽管在线教育行业发展迅速,但仍存在一些问题。例如,学生在使用在线学习平台时可能面临网络延迟或卡顿的问题,影响学习效率。此外,平台的交互性不足,导致师生之间难以实现有效沟通,降低了学习体验的质量。还有,一些在线教育平台的个性化服务和学习效果评估功能不够完善,难以满足用户的多样化需求。
本课题旨在设计并实现一个功能齐全、用户友好的在线学习平台,该平台将提供稳定的网络连接、丰富的学习资源、高效的师生互动、以及精准的学习效果评估。通过该系统,希望能够为用户带来更加便捷、高效、个性化的学习体验。
在在线学习平台中,管理员负责用户账户的创建与维护、课程内容的审核与更新、学习资源的整合与管理、平台功能的持续优化与升级;教师能够创建和发布课程、管理在线课堂、跟踪学生的学习进度、进行在线辅导和答疑;学生用户可以浏览课程目录、选择并参与课程学习、提交作业和参与讨论、接收学习反馈和进度报告。系统通过这些功能模块的整合,旨在提供一个全面、互动的在线学习环境,满足不同用户角色的需求,优化学习流程,提高教育质量。
本课题的研究具有重要的理论意义和实际意义。从理论角度来看,它为在线教育领域提供了新的研究思路,即如何利用信息技术提升在线学习体验和教学效果。从实际角度来看,在线学习平台的应用将有助于提高教育资源的利用效率,促进教育公平,提升学习者的自主学习能力,推动教育现代化的发展。同时,系统的推广应用还将为教育工作者提供更多的教学创新空间,为学习者创造更加开放和灵活的学习环境。
二、开发环境
- 开发语言:Java/Python
- 数据库:MySQL
- 系统架构:B/S
- 后端:SpringBoot/SSM/Django/Flask
- 前端:Vue
三、系统界面展示
- 在线学习平台界面展示:
教师-课程信息管理:
教师-作业管理:
教师-试题管理:
学生-查看课程信息:
学生-填写作业:
学生-查看错题本:
四、代码参考
- 项目实战代码参考:
@RestController
@RequestMapping("/kechengxinxi")
public class KechengxinxiController {
@Autowired
private KechengxinxiService kechengxinxiService;
@Autowired
private StoreupService storeupService;
@Autowired
private XuexikechengService xuexikechengService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,KechengxinxiEntity kechengxinxi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
kechengxinxi.setJiaoshigonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
PageUtils page = kechengxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kechengxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,KechengxinxiEntity kechengxinxi,
HttpServletRequest request){
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
PageUtils page = kechengxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kechengxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( KechengxinxiEntity kechengxinxi){
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( kechengxinxi, "kechengxinxi"));
return R.ok().put("data", kechengxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(KechengxinxiEntity kechengxinxi){
EntityWrapper< KechengxinxiEntity> ew = new EntityWrapper< KechengxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( kechengxinxi, "kechengxinxi"));
KechengxinxiView kechengxinxiView = kechengxinxiService.selectView(ew);
return R.ok("查询课程信息成功").put("data", kechengxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
KechengxinxiEntity kechengxinxi = kechengxinxiService.selectById(id);
kechengxinxi.setClicknum(kechengxinxi.getClicknum()+1);
kechengxinxiService.updateById(kechengxinxi);
return R.ok().put("data", kechengxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
KechengxinxiEntity kechengxinxi = kechengxinxiService.selectById(id);
kechengxinxi.setClicknum(kechengxinxi.getClicknum()+1);
kechengxinxiService.updateById(kechengxinxi);
return R.ok().put("data", kechengxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody KechengxinxiEntity kechengxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(kechengxinxi);
kechengxinxiService.insert(kechengxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody KechengxinxiEntity kechengxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(kechengxinxi);
kechengxinxiService.insert(kechengxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody KechengxinxiEntity kechengxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(kechengxinxi);
kechengxinxiService.updateById(kechengxinxi);//全部更新
return R.ok();
}
/**
* 审核
*/
@RequestMapping("/shBatch")
@Transactional
public R update(@RequestBody Long[] ids, @RequestParam String sfsh, @RequestParam String shhf){
List<KechengxinxiEntity> list = new ArrayList<KechengxinxiEntity>();
for(Long id : ids) {
KechengxinxiEntity kechengxinxi = kechengxinxiService.selectById(id);
kechengxinxi.setSfsh(sfsh);
kechengxinxi.setShhf(shhf);
list.add(kechengxinxi);
}
kechengxinxiService.updateBatchById(list);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
kechengxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,KechengxinxiEntity kechengxinxi, HttpServletRequest request,String pre){
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = kechengxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kechengxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 协同算法(基于用户的协同算法)
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,KechengxinxiEntity kechengxinxi, HttpServletRequest request){
String userName = (String)request.getSession().getAttribute("username");
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<XuexikechengEntity> xuexikechengList = xuexikechengService.selectList(new EntityWrapper<XuexikechengEntity>());
Map<String, Map<String, Double>> ratings = new HashMap<>();
if(xuexikechengList!=null && xuexikechengList.size()>0) {
for(XuexikechengEntity xuexikecheng : xuexikechengList) {
Map<String, Double> userRatings = null;
if(ratings.containsKey(xuexikecheng.getZhanghao().toString())) {
userRatings = ratings.get(xuexikecheng.getZhanghao().toString());
} else {
userRatings = new HashMap<>();
ratings.put(xuexikecheng.getZhanghao().toString(), userRatings);
}
if(userRatings.containsKey(xuexikecheng.getKechengleixing().toString())) {
userRatings.put(xuexikecheng.getKechengleixing().toString(), userRatings.get(xuexikecheng.getKechengleixing().toString())+1.0);
} else {
userRatings.put(xuexikecheng.getKechengleixing().toString(), 1.0);
}
}
}
// 创建协同过滤对象
UserBasedCollaborativeFiltering filter = new UserBasedCollaborativeFiltering(ratings);
// 为指定用户推荐物品
String targetUser = userName;
int numRecommendations = limit;
List<String> recommendations = filter.recommendItems(targetUser, numRecommendations);
// 输出推荐结果
System.out.println("Recommendations for " + targetUser + ":");
for (String item : recommendations) {
System.out.println(item);
}
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
ew.in("kechengleixing", String.join(",", recommendations));
if(recommendations!=null && recommendations.size()>0) {
ew.last("order by FIELD(kechengleixing, "+"'"+String.join("','", recommendations)+"'"+")");
}
PageUtils page = kechengxinxiService.queryPage(params, ew);
List<KechengxinxiEntity> pageList = (List<KechengxinxiEntity>)page.getList();
if(pageList.size()<limit) {
int toAddNum = limit-pageList.size();
ew = new EntityWrapper<KechengxinxiEntity>();
ew.notIn("kechengleixing", recommendations);
ew.orderBy("id", false);
ew.last("limit "+toAddNum);
pageList.addAll(kechengxinxiService.selectList(ew));
} else if(pageList.size()>limit) {
pageList = pageList.subList(0, limit);
}
page.setList(pageList);
return R.ok().put("data", page);
}
@RequestMapping("/importExcel")
public R importExcel(@RequestParam("file") MultipartFile file){
try {
//获取输入流
InputStream inputStream = file.getInputStream();
//创建读取工作簿
Workbook workbook = WorkbookFactory.create(inputStream);
//获取工作表
Sheet sheet = workbook.getSheetAt(0);
//获取总行
int rows=sheet.getPhysicalNumberOfRows();
if(rows>1){
//获取单元格
for (int i = 1; i < rows; i++) {
Row row = sheet.getRow(i);
KechengxinxiEntity kechengxinxiEntity =new KechengxinxiEntity();
kechengxinxiEntity.setId(new Date().getTime());
//想数据库中添加新对象
kechengxinxiService.insert(kechengxinxiEntity);//方法
}
}
inputStream.close();
} catch (InvalidFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return R.ok("导入成功");
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = kechengxinxiService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计(多))
*/
@RequestMapping("/valueMul/{xColumnName}")
public R valueMul(@PathVariable("xColumnName") String xColumnName,@RequestParam String yColumnNameMul, HttpServletRequest request) {
String[] yColumnNames = yColumnNameMul.split(",");
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
List<List<Map<String, Object>>> result2 = new ArrayList<List<Map<String,Object>>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
for(int i=0;i<yColumnNames.length;i++) {
params.put("yColumn", yColumnNames[i]);
List<Map<String, Object>> result = kechengxinxiService.selectValue(params, ew);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
result2.add(result);
}
return R.ok().put("data", result2);
}
/**
* (按值统计)时间统计类型
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = kechengxinxiService.selectTimeStatValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计)时间统计类型(多)
*/
@RequestMapping("/valueMul/{xColumnName}/{timeStatType}")
public R valueMulDay(@PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,@RequestParam String yColumnNameMul,HttpServletRequest request) {
String[] yColumnNames = yColumnNameMul.split(",");
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("timeStatType", timeStatType);
List<List<Map<String, Object>>> result2 = new ArrayList<List<Map<String,Object>>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
for(int i=0;i<yColumnNames.length;i++) {
params.put("yColumn", yColumnNames[i]);
List<Map<String, Object>> result = kechengxinxiService.selectTimeStatValue(params, ew);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
result2.add(result);
}
return R.ok().put("data", result2);
}
/**
* 分组统计
*/
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName);
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = kechengxinxiService.selectGroup(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* 总数量
*/
@RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params,KechengxinxiEntity kechengxinxi, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
kechengxinxi.setJiaoshigonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<KechengxinxiEntity> ew = new EntityWrapper<KechengxinxiEntity>();
int count = kechengxinxiService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kechengxinxi), params), params));
return R.ok().put("data", count);
}
}
@RestController
@RequestMapping("/exampaper")
public class ExampaperController {
@Autowired
private ExampaperService exampaperService;
@Autowired
private ExamquestionService examquestionService;
@Autowired
private ExamquestionbankService examquestionbankService;
@Autowired
private ExamrecordService examrecordService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ExampaperEntity exampaper,
HttpServletRequest request){
EntityWrapper<ExampaperEntity> ew = new EntityWrapper<ExampaperEntity>();
PageUtils page = exampaperService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, exampaper), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ExampaperEntity exampaper,
HttpServletRequest request){
EntityWrapper<ExampaperEntity> ew = new EntityWrapper<ExampaperEntity>();
PageUtils page = exampaperService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, exampaper), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ExampaperEntity exampaper){
EntityWrapper<ExampaperEntity> ew = new EntityWrapper<ExampaperEntity>();
ew.allEq(MPUtil.allEQMapPre( exampaper, "exampaper"));
return R.ok().put("data", exampaperService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ExampaperEntity exampaper){
EntityWrapper< ExampaperEntity> ew = new EntityWrapper< ExampaperEntity>();
ew.allEq(MPUtil.allEQMapPre( exampaper, "exampaper"));
ExampaperView exampaperView = exampaperService.selectView(ew);
return R.ok("查询线上测试表成功").put("data", exampaperView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ExampaperEntity exampaper = exampaperService.selectById(id);
return R.ok().put("data", exampaper);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ExampaperEntity exampaper = exampaperService.selectById(id);
return R.ok().put("data", exampaper);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ExampaperEntity exampaper, HttpServletRequest request){
//ValidatorUtils.validateEntity(exampaper);
exampaperService.insert(exampaper);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ExampaperEntity exampaper, HttpServletRequest request){
//ValidatorUtils.validateEntity(exampaper);
exampaperService.insert(exampaper);
return R.ok();
}
/**
* 获取用户密保
*/
@RequestMapping("/security")
@IgnoreAuth
public R security(@RequestParam String username){
ExampaperEntity exampaper = exampaperService.selectOne(new EntityWrapper<ExampaperEntity>().eq("", username));
return R.ok().put("data", exampaper);
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
@IgnoreAuth
public R update(@RequestBody ExampaperEntity exampaper, HttpServletRequest request){
//ValidatorUtils.validateEntity(exampaper);
exampaperService.updateById(exampaper);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
exampaperService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,ExampaperEntity exampaper, HttpServletRequest request,String pre){
EntityWrapper<ExampaperEntity> ew = new EntityWrapper<ExampaperEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicktime");
params.put("order", "desc");
PageUtils page = exampaperService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, exampaper), params), params));
return R.ok().put("data", page);
}
/**
* 组卷
*/
@RequestMapping("/compose")
public R compose(HttpServletRequest request,@RequestParam Long paperid, @RequestParam String papername, @RequestParam Integer radioNum,
@RequestParam Integer multipleChoiceNum, @RequestParam Integer determineNum, @RequestParam Integer fillNum, @RequestParam Integer subjectivityNum){
//如果已存在考试记录,不能进行重新组卷
if(examrecordService.selectCount(new EntityWrapper<ExamrecordEntity>().eq("paperid", paperid))>0) {
return R.error("已存在考试记录,无法重新组卷");
}
//组卷之前删除该试卷之前的所有题目
examquestionService.deleteByMap(new MapUtils().put("paperid", paperid));
List<ExamquestionbankEntity> questionList = new ArrayList<ExamquestionbankEntity>();
//单选题
if(radioNum>0) {
Integer radioSize = examquestionbankService.selectCount(new EntityWrapper<ExamquestionbankEntity>().eq("type", 0));
if(radioSize<radioNum) {
return R.error("单选题库不足");
} else {
Wrapper<ExamquestionbankEntity> ew = new EntityWrapper<ExamquestionbankEntity>();
ew.eq("type", 0).orderBy("RAND()").last("limit "+radioNum);
List<ExamquestionbankEntity> radioList = examquestionbankService.selectList(ew);
questionList.addAll(radioList);
}
}
//多选题
if(multipleChoiceNum>0) {
Integer multipleChoiceSize = examquestionbankService.selectCount(new EntityWrapper<ExamquestionbankEntity>().eq("type", 1));
if(multipleChoiceSize<multipleChoiceNum) {
return R.error("多选题库不足");
} else {
Wrapper<ExamquestionbankEntity> ew = new EntityWrapper<ExamquestionbankEntity>();
ew.eq("type", 1).orderBy("RAND()").last("limit "+multipleChoiceNum);
List<ExamquestionbankEntity> multipleChoiceList = examquestionbankService.selectList(ew);
questionList.addAll(multipleChoiceList);
}
}
//判断题
if(determineNum>0) {
Integer determineSize = examquestionbankService.selectCount(new EntityWrapper<ExamquestionbankEntity>().eq("type", 2));
if(determineSize<determineNum) {
return R.error("判断题库不足");
} else {
Wrapper<ExamquestionbankEntity> ew = new EntityWrapper<ExamquestionbankEntity>();
ew.eq("type", 2).orderBy("RAND()").last("limit "+determineNum);
List<ExamquestionbankEntity> determineList = examquestionbankService.selectList(ew);
questionList.addAll(determineList);
}
}
//填空题
if(fillNum>0) {
Integer fillSize = examquestionbankService.selectCount(new EntityWrapper<ExamquestionbankEntity>().eq("type", 3));
if(fillSize<fillNum) {
return R.error("填空题库不足");
} else {
Wrapper<ExamquestionbankEntity> ew = new EntityWrapper<ExamquestionbankEntity>();
ew.eq("type", 3).orderBy("RAND()").last("limit "+fillNum);
List<ExamquestionbankEntity> fillList = examquestionbankService.selectList(ew);
questionList.addAll(fillList);
}
}
//主观题
if(subjectivityNum>0) {
Integer subjectivitySize = examquestionbankService.selectCount(new EntityWrapper<ExamquestionbankEntity>().eq("type", 4));
if(subjectivitySize<subjectivityNum) {
return R.error("主观题库不足");
} else {
Wrapper<ExamquestionbankEntity> ew = new EntityWrapper<ExamquestionbankEntity>();
ew.eq("type", 4).orderBy("RAND()").last("limit "+subjectivityNum);
List<ExamquestionbankEntity> subjectivityList = examquestionbankService.selectList(ew);
questionList.addAll(subjectivityList);
}
}
if(questionList!=null && questionList.size()>0) {
long seq = 0;
for(ExamquestionbankEntity q : questionList) {
ExamquestionEntity examquestion = new ExamquestionEntity();
examquestion.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
examquestion.setPaperid(paperid);
examquestion.setPapername(papername);
examquestion.setQuestionname(q.getQuestionname());
examquestion.setOptions(q.getOptions());
examquestion.setScore(q.getScore());
examquestion.setAnswer(q.getAnswer());
examquestion.setAnalysis(q.getAnalysis());
examquestion.setType(q.getType());
examquestion.setSequence(++seq);
examquestionService.insert(examquestion);
}
}
return R.ok();
}
}
五、论文参考
- 计算机毕业设计选题推荐-在线学习平台论文参考:
六、系统视频
在线学习平台项目视频:
计算机毕业设计选题推荐-在线学习平台-Java/Python
结语
计算机毕业设计选题推荐-在线学习平台-Java/Python项目实战
大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:⬇⬇⬇