You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.6 KiB
101 lines
2.6 KiB
package com.ccic.safeliab.web; |
|
|
|
import com.ccic.safeliab.entity.Industry; |
|
import com.ccic.safeliab.entity.QuestionCategories; |
|
import com.ccic.safeliab.service.QuestionService; |
|
import com.ccic.safeliab.util.R; |
|
import com.ccic.safeliab.vo.InsQuestionVO; |
|
import org.springframework.beans.factory.annotation.Autowired; |
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import java.util.List; |
|
import java.util.Map; |
|
|
|
@RestController |
|
@RequestMapping("/ex/question") |
|
public class QuestionController { |
|
|
|
@Autowired |
|
private QuestionService questionService; |
|
|
|
/** |
|
* 查询试题 |
|
* @param vo 试题vo |
|
* @return 查询结果 |
|
*/ |
|
@PostMapping("/getList") |
|
public R getList(@RequestBody InsQuestionVO vo) { |
|
QuestionCategories entity = new QuestionCategories(); |
|
entity.setIndustryId(vo.getIndustryId()); |
|
entity.setServiceTypeId(vo.getServiceTypeId()); |
|
entity.setQuestionContent(vo.getQuestionContent()); |
|
Map<String, Object> map = questionService.getList(vo.getPage(), vo.getNum(), entity); |
|
return R.ok().data(map); |
|
} |
|
|
|
/** |
|
* 删除试题 |
|
* @param ids 试题ID |
|
* @return 删除结果 |
|
*/ |
|
@PostMapping("/delQuestion") |
|
public R delQuestion(@RequestBody List<Long> ids) { |
|
boolean flag = questionService.delQuestion(ids); |
|
if (flag) { |
|
return R.ok(); |
|
} else { |
|
return R.error(); |
|
} |
|
} |
|
|
|
/** |
|
* 添加试题 |
|
* @param vo 试题vo |
|
* @return 添加结果 |
|
*/ |
|
@PostMapping("/addQuestion") |
|
public R addQuestion(@RequestBody List<InsQuestionVO> vo) { |
|
boolean flag = questionService.addQuestion(vo); |
|
if (flag) { |
|
return R.ok(); |
|
} else { |
|
return R.error(); |
|
} |
|
} |
|
|
|
/** |
|
* 修改试题 |
|
* @param vo 试题vo |
|
* @return 修改结果 |
|
*/ |
|
@PostMapping("/editQuestion") |
|
public R editQuestion(@RequestBody InsQuestionVO vo) { |
|
boolean flag = questionService.editQuestion(vo); |
|
if (flag) { |
|
return R.ok(); |
|
} else { |
|
return R.error(); |
|
} |
|
} |
|
|
|
/** |
|
* 获取试题详情 |
|
* @param id 试题ID |
|
* @return 试题详情 |
|
*/ |
|
@GetMapping("/getQuestionDetail") |
|
public R getQuestionDetail(String id) { |
|
QuestionCategories data = questionService.getQuestionDetail(id); |
|
return R.ok().data(data); |
|
} |
|
|
|
/** |
|
* 查询字典数据 |
|
* @return 字典数据 |
|
*/ |
|
@GetMapping("/findIndustry") |
|
public R findIndustry() { |
|
List<Industry> tree = questionService.findDictionary(); |
|
return R.ok().data(tree); |
|
} |
|
} |