随机试卷
This commit is contained in:
parent
ae1f15d3a2
commit
692154150c
|
|
@ -9,9 +9,7 @@ import cn.hutool.json.JSON;
|
||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.ruoyi.exam.domain.*;
|
import com.ruoyi.exam.domain.*;
|
||||||
import com.ruoyi.exam.service.IExamPaperCategoryService;
|
import com.ruoyi.exam.service.*;
|
||||||
import com.ruoyi.exam.service.IExamPaperQuestionService;
|
|
||||||
import com.ruoyi.exam.service.IExamQuestionService;
|
|
||||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -20,7 +18,6 @@ import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.exam.service.IExamPaperService;
|
|
||||||
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 com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
|
@ -28,261 +25,329 @@ import com.ruoyi.common.utils.ExcelUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 试卷 信息操作处理
|
* 试卷 信息操作处理
|
||||||
*
|
*
|
||||||
* @author zhujj
|
* @author zhujj
|
||||||
* @date 2018-12-16
|
* @date 2018-12-16
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/exam/examPaper")
|
@RequestMapping("/exam/examPaper")
|
||||||
public class ExamPaperController extends BaseController
|
public class ExamPaperController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "exam/examPaper";
|
private String prefix = "exam/examPaper";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IExamPaperService examPaperService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExamPaperCategoryService examPaperCategoryService;
|
private IExamPaperService examPaperService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExamPaperQuestionService examPaperQuestionService;
|
private IExamPaperCategoryService examPaperCategoryService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExamQuestionService examQuestionService;
|
private IExamPaperQuestionService examPaperQuestionService;
|
||||||
|
|
||||||
@RequiresPermissions("exam:examPaper:view")
|
@Autowired
|
||||||
@GetMapping()
|
private IExamQuestionService examQuestionService;
|
||||||
public String examPaper()
|
|
||||||
{
|
@Autowired
|
||||||
return prefix + "/examPaper";
|
private IExamPaperTypeNumberService examPaperTypeNumberService;
|
||||||
}
|
|
||||||
|
@RequiresPermissions("exam:examPaper:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String examPaper() {
|
||||||
|
return prefix + "/examPaper";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试卷列表
|
||||||
/**
|
*/
|
||||||
* 查询试卷列表
|
@RequiresPermissions("exam:examPaper:list")
|
||||||
*/
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("exam:examPaper:list")
|
@ResponseBody
|
||||||
@PostMapping("/list")
|
public TableDataInfo list(ExamPaper examPaper) {
|
||||||
@ResponseBody
|
|
||||||
public TableDataInfo list(ExamPaper examPaper)
|
|
||||||
{
|
|
||||||
List<ExamPaper> list = new ArrayList<>();
|
List<ExamPaper> list = new ArrayList<>();
|
||||||
List<ExamPaper> listByIds = examPaperService.selectListByCategory(examPaper);
|
List<ExamPaper> listByIds = examPaperService.selectListByCategory(examPaper);
|
||||||
return getDataTable(listByIds);
|
return getDataTable(listByIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归找到所有下级的试卷
|
* 递归找到所有下级的试卷
|
||||||
* @param list
|
*
|
||||||
* @param examPaper
|
* @param list
|
||||||
* @return
|
* @param examPaper
|
||||||
*/
|
* @return
|
||||||
private List<ExamPaper> getListByIds(List<ExamPaper> list,ExamPaper examPaper){
|
*/
|
||||||
list.addAll(examPaperService.selectExamPaperList(examPaper));
|
private List<ExamPaper> getListByIds(List<ExamPaper> list, ExamPaper examPaper) {
|
||||||
String categoryId = examPaper.getExamPaperCategoryId().toString();
|
list.addAll(examPaperService.selectExamPaperList(examPaper));
|
||||||
ExamPaperCategory examPaperCategory = new ExamPaperCategory();
|
String categoryId = examPaper.getExamPaperCategoryId().toString();
|
||||||
examPaperCategory.setParentId(Integer.parseInt(categoryId));
|
ExamPaperCategory examPaperCategory = new ExamPaperCategory();
|
||||||
List<ExamPaperCategory> examPaperCategorys = examPaperCategoryService.selectList(examPaperCategory);
|
examPaperCategory.setParentId(Integer.parseInt(categoryId));
|
||||||
for (ExamPaperCategory questionCategory : examPaperCategorys) {
|
List<ExamPaperCategory> examPaperCategorys = examPaperCategoryService.selectList(examPaperCategory);
|
||||||
examPaper.setExamPaperCategoryId(questionCategory.getId());
|
for (ExamPaperCategory questionCategory : examPaperCategorys) {
|
||||||
getListByIds(list,examPaper);
|
examPaper.setExamPaperCategoryId(questionCategory.getId());
|
||||||
}
|
getListByIds(list, examPaper);
|
||||||
return list;
|
}
|
||||||
}
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出试卷列表
|
/**
|
||||||
*/
|
* 导出试卷列表
|
||||||
@RequiresPermissions("exam:examPaper:export")
|
*/
|
||||||
|
@RequiresPermissions("exam:examPaper:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(ExamPaper examPaper)
|
public AjaxResult export(ExamPaper examPaper) {
|
||||||
{
|
List<ExamPaper> list = examPaperService.selectExamPaperList(examPaper);
|
||||||
List<ExamPaper> list = examPaperService.selectExamPaperList(examPaper);
|
|
||||||
ExcelUtil<ExamPaper> util = new ExcelUtil<ExamPaper>(ExamPaper.class);
|
ExcelUtil<ExamPaper> util = new ExcelUtil<ExamPaper>(ExamPaper.class);
|
||||||
return util.exportExcel(list, "examPaper");
|
return util.exportExcel(list, "examPaper");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增试卷
|
|
||||||
*/
|
|
||||||
@GetMapping("/add/{id}")
|
|
||||||
public String add(@PathVariable("id") String id, ModelMap mmap)
|
|
||||||
{
|
|
||||||
mmap.put("examPaperCategoryId",id);
|
|
||||||
return prefix + "/add";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增保存试卷
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("exam:examPaper:add")
|
|
||||||
@Log(title = "试卷", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/add")
|
|
||||||
@ResponseBody
|
|
||||||
public AjaxResult addSave(ExamPaper examPaper)
|
|
||||||
{
|
|
||||||
examPaper.setCreateBy(ShiroUtils.getLoginName());
|
|
||||||
examPaper.setCreateDate(new Date());
|
|
||||||
examPaper.setScore(0);
|
|
||||||
examPaper.setQuestionNumber(0);
|
|
||||||
examPaper.setDelFlag("0");
|
|
||||||
return toAjax(examPaperService.insert(examPaper));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改试卷
|
* 新增试卷
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{id}")
|
@GetMapping("/add/{id}")
|
||||||
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
public String add(@PathVariable("id") String id, ModelMap mmap) {
|
||||||
{
|
mmap.put("examPaperCategoryId", id);
|
||||||
ExamPaper examPaper = examPaperService.selectById(id);
|
return prefix + "/add";
|
||||||
mmap.put("examPaper", examPaper);
|
}
|
||||||
return prefix + "/edit";
|
|
||||||
}
|
/**
|
||||||
|
* 新增保存试卷
|
||||||
/**
|
*/
|
||||||
* 修改保存试卷
|
@RequiresPermissions("exam:examPaper:add")
|
||||||
*/
|
@Log(title = "试卷", businessType = BusinessType.INSERT)
|
||||||
@RequiresPermissions("exam:examPaper:edit")
|
@PostMapping("/add")
|
||||||
@Log(title = "试卷", businessType = BusinessType.UPDATE)
|
@ResponseBody
|
||||||
@PostMapping("/edit")
|
public AjaxResult addSave(ExamPaperVO examPaper) {
|
||||||
@ResponseBody
|
examPaper.setCreateBy(ShiroUtils.getLoginName());
|
||||||
public AjaxResult editSave(ExamPaper examPaper)
|
examPaper.setCreateDate(new Date());
|
||||||
{
|
examPaper.setScore(0);
|
||||||
examPaper.setUpdateBy(ShiroUtils.getLoginName());
|
examPaper.setQuestionNumber(0);
|
||||||
examPaper.setUpdateDate(new Date());
|
examPaper.setDelFlag("0");
|
||||||
return toAjax(examPaperService.updateSelectiveById(examPaper));
|
int insert = examPaperService.insert((ExamPaper) examPaper);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除试卷
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("exam:examPaper:remove")
|
|
||||||
@Log(title = "试卷", businessType = BusinessType.DELETE)
|
|
||||||
@PostMapping( "/remove")
|
|
||||||
@ResponseBody
|
|
||||||
public AjaxResult remove(String ids)
|
|
||||||
{
|
|
||||||
return toAjax(examPaperService.deleteByIds(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/addQuestion/{id}")
|
ExamPaperTypeNumber examPaperTypeNumber1 = new ExamPaperTypeNumber();
|
||||||
public String addQuestion(@PathVariable("id") String ids, ModelMap mmap)
|
examPaperTypeNumber1.setDelFlag("0");
|
||||||
{
|
examPaperTypeNumber1.setExamPaperId(examPaper.getId());
|
||||||
String[] split = ids.split(",");
|
examPaperTypeNumber1.setExamQuestionType(1);
|
||||||
List<String> strings = Arrays.asList(split);
|
examPaperTypeNumber1.setNumber(examPaper.getChoiceNumber());
|
||||||
mmap.put("examPaperId", strings.get(0));
|
examPaperTypeNumberService.insert(examPaperTypeNumber1);
|
||||||
mmap.put("examPaperQuestionIds",strings.subList(1,strings.size()));
|
|
||||||
return prefix + "/examQuestion";
|
|
||||||
}
|
|
||||||
|
|
||||||
// @RequiresPermissions("exam:examPaper:add")
|
ExamPaperTypeNumber examPaperTypeNumber2 = new ExamPaperTypeNumber();
|
||||||
|
examPaperTypeNumber2.setDelFlag("0");
|
||||||
|
examPaperTypeNumber2.setExamPaperId(examPaper.getId());
|
||||||
|
examPaperTypeNumber2.setExamQuestionType(2);
|
||||||
|
examPaperTypeNumber2.setNumber(examPaper.getMoreChoiceNumber());
|
||||||
|
examPaperTypeNumberService.insert(examPaperTypeNumber2);
|
||||||
|
|
||||||
|
ExamPaperTypeNumber examPaperTypeNumber3 = new ExamPaperTypeNumber();
|
||||||
|
examPaperTypeNumber3.setDelFlag("0");
|
||||||
|
examPaperTypeNumber3.setExamPaperId(examPaper.getId());
|
||||||
|
examPaperTypeNumber3.setExamQuestionType(3);
|
||||||
|
examPaperTypeNumber3.setNumber(examPaper.getJudgeNumber());
|
||||||
|
examPaperTypeNumberService.insert(examPaperTypeNumber3);
|
||||||
|
|
||||||
|
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改试卷
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
|
||||||
|
JSONObject jsonObject = new JSONObject(examPaperService.selectById(id));
|
||||||
|
ExamPaperVO examPaper = jsonObject.toBean(ExamPaperVO.class);
|
||||||
|
examPaper.setChoiceNumber(0);
|
||||||
|
examPaper.setMoreChoiceNumber(0);
|
||||||
|
examPaper.setJudgeNumber(0);
|
||||||
|
if (examPaper.getType().equals("2")) {
|
||||||
|
ExamPaperTypeNumber examPaperTypeNumber = new ExamPaperTypeNumber();
|
||||||
|
examPaperTypeNumber.setExamPaperId(id);
|
||||||
|
List<ExamPaperTypeNumber> examPaperTypeNumbers = examPaperTypeNumberService.selectList(examPaperTypeNumber);
|
||||||
|
for (ExamPaperTypeNumber item : examPaperTypeNumbers) {
|
||||||
|
if (item.getExamQuestionType() == 1) {
|
||||||
|
examPaper.setChoiceNumber(item.getNumber());
|
||||||
|
}
|
||||||
|
if (item.getExamQuestionType() == 2) {
|
||||||
|
examPaper.setMoreChoiceNumber(item.getNumber());
|
||||||
|
}
|
||||||
|
if (item.getExamQuestionType() == 3) {
|
||||||
|
examPaper.setJudgeNumber(item.getNumber());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mmap.put("examPaper", examPaper);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存试卷
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examPaper:edit")
|
||||||
|
@Log(title = "试卷", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(ExamPaperVO examPaper) {
|
||||||
|
examPaper.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
examPaper.setUpdateDate(new Date());
|
||||||
|
examPaperService.updateSelectiveById(examPaper);
|
||||||
|
ExamPaperTypeNumber delete = new ExamPaperTypeNumber();
|
||||||
|
delete.setExamPaperId(examPaper.getId());
|
||||||
|
examPaperTypeNumberService.delete(delete);
|
||||||
|
|
||||||
|
ExamPaperTypeNumber examPaperTypeNumber1 = new ExamPaperTypeNumber();
|
||||||
|
examPaperTypeNumber1.setDelFlag("0");
|
||||||
|
examPaperTypeNumber1.setExamPaperId(examPaper.getId());
|
||||||
|
examPaperTypeNumber1.setExamQuestionType(1);
|
||||||
|
examPaperTypeNumber1.setNumber(examPaper.getChoiceNumber());
|
||||||
|
examPaperTypeNumberService.insert(examPaperTypeNumber1);
|
||||||
|
|
||||||
|
ExamPaperTypeNumber examPaperTypeNumber2 = new ExamPaperTypeNumber();
|
||||||
|
examPaperTypeNumber2.setDelFlag("0");
|
||||||
|
examPaperTypeNumber2.setExamPaperId(examPaper.getId());
|
||||||
|
examPaperTypeNumber2.setExamQuestionType(2);
|
||||||
|
examPaperTypeNumber2.setNumber(examPaper.getMoreChoiceNumber());
|
||||||
|
examPaperTypeNumberService.insert(examPaperTypeNumber2);
|
||||||
|
|
||||||
|
ExamPaperTypeNumber examPaperTypeNumber3 = new ExamPaperTypeNumber();
|
||||||
|
examPaperTypeNumber3.setDelFlag("0");
|
||||||
|
examPaperTypeNumber3.setExamPaperId(examPaper.getId());
|
||||||
|
examPaperTypeNumber3.setExamQuestionType(3);
|
||||||
|
examPaperTypeNumber3.setNumber(examPaper.getJudgeNumber());
|
||||||
|
examPaperTypeNumberService.insert(examPaperTypeNumber3);
|
||||||
|
|
||||||
|
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除试卷
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examPaper:remove")
|
||||||
|
@Log(title = "试卷", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids) {
|
||||||
|
String[] split = ids.split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
ExamPaperTypeNumber delete = new ExamPaperTypeNumber();
|
||||||
|
delete.setExamPaperId(Integer.parseInt(s));
|
||||||
|
examPaperTypeNumberService.delete(delete);
|
||||||
|
}
|
||||||
|
return toAjax(examPaperService.deleteByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/addQuestion/{id}")
|
||||||
|
public String addQuestion(@PathVariable("id") String ids, ModelMap mmap) {
|
||||||
|
String[] split = ids.split(",");
|
||||||
|
List<String> strings = Arrays.asList(split);
|
||||||
|
mmap.put("examPaperId", strings.get(0));
|
||||||
|
mmap.put("examPaperQuestionIds", strings.subList(1, strings.size()));
|
||||||
|
return prefix + "/examQuestion";
|
||||||
|
}
|
||||||
|
|
||||||
|
// @RequiresPermissions("exam:examPaper:add")
|
||||||
// @Log(title = "试卷", businessType = BusinessType.DELETE)
|
// @Log(title = "试卷", businessType = BusinessType.DELETE)
|
||||||
@PostMapping( "/saveQuestion")
|
@PostMapping("/saveQuestion")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult saveQuestion(@RequestBody List<ExamPaperQuestion> paperQuestionList)
|
public AjaxResult saveQuestion(@RequestBody List<ExamPaperQuestion> paperQuestionList) {
|
||||||
{
|
ExamPaperQuestion examPaperQuestion = paperQuestionList.get(0);
|
||||||
ExamPaperQuestion examPaperQuestion = paperQuestionList.get(0);
|
ExamPaperQuestion delete = new ExamPaperQuestion();
|
||||||
ExamPaperQuestion delete = new ExamPaperQuestion();
|
delete.setExamPaperId(examPaperQuestion.getExamPaperId());
|
||||||
delete.setExamPaperId(examPaperQuestion.getExamPaperId());
|
ExamPaper examPaper = new ExamPaper();
|
||||||
ExamPaper examPaper = new ExamPaper();
|
examPaper.setId(examPaperQuestion.getExamPaperId());
|
||||||
examPaper.setId(examPaperQuestion.getExamPaperId());
|
examPaperQuestionService.delete(delete);
|
||||||
examPaperQuestionService.delete(delete);
|
int num = 0;
|
||||||
int num =0;
|
int score = 0;
|
||||||
int score = 0;
|
for (int i = 1; i < paperQuestionList.size(); i++) {
|
||||||
for (int i = 1; i < paperQuestionList.size(); i++) {
|
ExamPaperQuestion item = paperQuestionList.get(i);
|
||||||
ExamPaperQuestion item = paperQuestionList.get(i);
|
item.setDelFlag("0");
|
||||||
item.setDelFlag("0");
|
examPaperQuestionService.insert(item);
|
||||||
examPaperQuestionService.insert(item);
|
num++;
|
||||||
num++;
|
score += item.getScore();
|
||||||
score+=item.getScore();
|
}
|
||||||
}
|
examPaper.setQuestionNumber(num);
|
||||||
examPaper.setQuestionNumber(num);
|
examPaper.setScore(score);
|
||||||
examPaper.setScore(score);
|
examPaperService.updateSelectiveById(examPaper);
|
||||||
examPaperService.updateSelectiveById(examPaper);
|
return AjaxResult.success();
|
||||||
return AjaxResult.success();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/toManagerPaperQuestion/{id}")
|
@GetMapping("/toManagerPaperQuestion/{id}")
|
||||||
public String toManagerPaperQuestion(@PathVariable("id") Integer id, ModelMap mmap)
|
public String toManagerPaperQuestion(@PathVariable("id") Integer id, ModelMap mmap) {
|
||||||
{
|
mmap.put("examPaper", examPaperService.selectById(id));
|
||||||
mmap.put("examPaper", examPaperService.selectById(id));
|
JSONObject json = new JSONObject();
|
||||||
JSONObject json = new JSONObject();
|
List<ExamPaperQuestionVO> examPaperQuestions = examPaperQuestionService.selectQuestionForPaperId(id);
|
||||||
List<ExamPaperQuestionVO> examPaperQuestions = examPaperQuestionService.selectQuestionForPaperId(id);
|
for (ExamPaperQuestionVO examPaperQuestion : examPaperQuestions) {
|
||||||
for (ExamPaperQuestionVO examPaperQuestion : examPaperQuestions) {
|
//排序用
|
||||||
//排序用
|
json.append(examPaperQuestion.getOrderNum().toString() + examPaperQuestion.getExamQuestionId().toString(), new JSONObject(examPaperQuestion).toString());
|
||||||
json.append(examPaperQuestion.getOrderNum().toString()+examPaperQuestion.getExamQuestionId().toString(),new JSONObject(examPaperQuestion).toString());
|
}
|
||||||
}
|
mmap.put("examPaperQuestion", json.toString());
|
||||||
mmap.put("examPaperQuestion",json.toString());
|
return prefix + "/managerPaperQuestion";
|
||||||
return prefix + "/managerPaperQuestion";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresPermissions("exam:examPaper:add")
|
@RequiresPermissions("exam:examPaper:add")
|
||||||
@Log(title = "试卷", businessType = BusinessType.DELETE)
|
@Log(title = "试卷", businessType = BusinessType.DELETE)
|
||||||
@PostMapping( "/addQuestionForModel")
|
@PostMapping("/addQuestionForModel")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addQuestionForModel(@RequestParam(value = "questionId[]" ,required = false) String[] questionId,@RequestParam("paperId")String paperId)
|
public AjaxResult addQuestionForModel(@RequestParam(value = "questionId[]", required = false) String[] questionId, @RequestParam("paperId") String paperId) {
|
||||||
{
|
//题目数量和总分数
|
||||||
//题目数量和总分数
|
int questionNum = 0;
|
||||||
int questionNum = 0;
|
int score = 0;
|
||||||
int score = 0;
|
ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion();
|
||||||
ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion();
|
examPaperQuestion.setExamPaperId(Integer.parseInt(paperId));
|
||||||
examPaperQuestion.setExamPaperId(Integer.parseInt(paperId));
|
ExamPaper examPaper = new ExamPaper();
|
||||||
ExamPaper examPaper = new ExamPaper();
|
if (questionId == null) {
|
||||||
if(questionId==null){
|
examPaperQuestionService.delete(examPaperQuestion);
|
||||||
examPaperQuestionService.delete(examPaperQuestion);
|
examPaper.setId(Integer.parseInt(paperId));
|
||||||
examPaper.setId(Integer.parseInt(paperId));
|
examPaper.setQuestionNumber(0);
|
||||||
examPaper.setQuestionNumber(0);
|
examPaper.setScore(0);
|
||||||
examPaper.setScore(0);
|
examPaperService.updateSelectiveById(examPaper);
|
||||||
examPaperService.updateSelectiveById(examPaper);
|
return AjaxResult.success();
|
||||||
return AjaxResult.success();
|
}
|
||||||
}
|
List<ExamPaperQuestionVO> dbDatas = examPaperQuestionService.selectExamPaperQuestionList(examPaperQuestion);
|
||||||
List<ExamPaperQuestionVO> dbDatas = examPaperQuestionService.selectExamPaperQuestionList(examPaperQuestion);
|
questionNum += dbDatas.size();
|
||||||
questionNum +=dbDatas.size();
|
HashSet<Integer> dbSet = new HashSet<>();
|
||||||
HashSet<Integer> dbSet = new HashSet<>();
|
for (ExamPaperQuestionVO dbData : dbDatas) {
|
||||||
for (ExamPaperQuestionVO dbData : dbDatas) {
|
dbSet.add(dbData.getExamQuestionId());
|
||||||
dbSet.add(dbData.getExamQuestionId());
|
score += dbData.getScore();
|
||||||
score+=dbData.getScore();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
HashSet<Integer> htmlSet = new HashSet<>();
|
HashSet<Integer> htmlSet = new HashSet<>();
|
||||||
//新增的
|
//新增的
|
||||||
for (String s : questionId) {
|
for (String s : questionId) {
|
||||||
Integer i = Integer.parseInt(s);
|
Integer i = Integer.parseInt(s);
|
||||||
if(!dbSet.contains(i)){
|
if (!dbSet.contains(i)) {
|
||||||
ExamPaperQuestion insert = new ExamPaperQuestion();
|
ExamPaperQuestion insert = new ExamPaperQuestion();
|
||||||
insert.setExamPaperId(Integer.parseInt(paperId));
|
insert.setExamPaperId(Integer.parseInt(paperId));
|
||||||
insert.setDelFlag("0");
|
insert.setDelFlag("0");
|
||||||
insert.setCreateDate(new Date());
|
insert.setCreateDate(new Date());
|
||||||
insert.setCreateBy(ShiroUtils.getLoginName());
|
insert.setCreateBy(ShiroUtils.getLoginName());
|
||||||
insert.setExamQuestionId(i);
|
insert.setExamQuestionId(i);
|
||||||
insert.setOrderNum(9999);
|
insert.setOrderNum(9999);
|
||||||
insert.setScore(0);
|
insert.setScore(0);
|
||||||
examPaperQuestionService.insert(insert);
|
examPaperQuestionService.insert(insert);
|
||||||
questionNum++;
|
questionNum++;
|
||||||
}
|
}
|
||||||
htmlSet.add(i);
|
htmlSet.add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ExamPaperQuestionVO dbData : dbDatas) {
|
for (ExamPaperQuestionVO dbData : dbDatas) {
|
||||||
if(!htmlSet.contains(dbData.getExamQuestionId())){
|
if (!htmlSet.contains(dbData.getExamQuestionId())) {
|
||||||
examPaperQuestionService.delete(dbData);
|
examPaperQuestionService.delete(dbData);
|
||||||
questionNum--;
|
questionNum--;
|
||||||
score-=dbData.getScore();
|
score -= dbData.getScore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
examPaper.setId(Integer.parseInt(paperId));
|
examPaper.setId(Integer.parseInt(paperId));
|
||||||
examPaper.setQuestionNumber(questionNum);
|
examPaper.setQuestionNumber(questionNum);
|
||||||
examPaper.setScore(score);
|
examPaper.setScore(score);
|
||||||
examPaperService.updateSelectiveById(examPaper);
|
examPaperService.updateSelectiveById(examPaper);
|
||||||
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,166 @@
|
||||||
|
package com.ruoyi.exam.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.base.BaseEntity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机试卷题型数量表 exam_paper_type_number
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
public class ExamPaperTypeNumber
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 试卷题型数量ID */
|
||||||
|
@Id
|
||||||
|
private Integer id;
|
||||||
|
/** 试卷代码 */
|
||||||
|
private Integer examPaperId;
|
||||||
|
/** 问题类型(来自字典表) */
|
||||||
|
private Integer examQuestionType;
|
||||||
|
/** 题型数量 */
|
||||||
|
private Integer number;
|
||||||
|
/** 创建者 */
|
||||||
|
private String createBy;
|
||||||
|
/** 创建时间 */
|
||||||
|
private Date createDate;
|
||||||
|
/** 更新者 */
|
||||||
|
private String updateBy;
|
||||||
|
/** 更新时间 */
|
||||||
|
private Date updateDate;
|
||||||
|
/** 备注信息 */
|
||||||
|
private String remarks;
|
||||||
|
/** 删除标记 */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 设置试卷题型数量ID */
|
||||||
|
public void setId(Integer id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取试卷题型数量ID */
|
||||||
|
public Integer getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
/** 设置试卷代码 */
|
||||||
|
public void setExamPaperId(Integer examPaperId)
|
||||||
|
{
|
||||||
|
this.examPaperId = examPaperId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取试卷代码 */
|
||||||
|
public Integer getExamPaperId()
|
||||||
|
{
|
||||||
|
return examPaperId;
|
||||||
|
}
|
||||||
|
/** 设置问题类型(来自字典表) */
|
||||||
|
public void setExamQuestionType(Integer examQuestionType)
|
||||||
|
{
|
||||||
|
this.examQuestionType = examQuestionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取问题类型(来自字典表) */
|
||||||
|
public Integer getExamQuestionType()
|
||||||
|
{
|
||||||
|
return examQuestionType;
|
||||||
|
}
|
||||||
|
/** 设置题型数量 */
|
||||||
|
public void setNumber(Integer number)
|
||||||
|
{
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取题型数量 */
|
||||||
|
public Integer getNumber()
|
||||||
|
{
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
/** 设置创建者 */
|
||||||
|
public void setCreateBy(String createBy)
|
||||||
|
{
|
||||||
|
this.createBy = createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取创建者 */
|
||||||
|
public String getCreateBy()
|
||||||
|
{
|
||||||
|
return createBy;
|
||||||
|
}
|
||||||
|
/** 设置创建时间 */
|
||||||
|
public void setCreateDate(Date createDate)
|
||||||
|
{
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取创建时间 */
|
||||||
|
public Date getCreateDate()
|
||||||
|
{
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
/** 设置更新者 */
|
||||||
|
public void setUpdateBy(String updateBy)
|
||||||
|
{
|
||||||
|
this.updateBy = updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取更新者 */
|
||||||
|
public String getUpdateBy()
|
||||||
|
{
|
||||||
|
return updateBy;
|
||||||
|
}
|
||||||
|
/** 设置更新时间 */
|
||||||
|
public void setUpdateDate(Date updateDate)
|
||||||
|
{
|
||||||
|
this.updateDate = updateDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取更新时间 */
|
||||||
|
public Date getUpdateDate()
|
||||||
|
{
|
||||||
|
return updateDate;
|
||||||
|
}
|
||||||
|
/** 设置备注信息 */
|
||||||
|
public void setRemarks(String remarks)
|
||||||
|
{
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取备注信息 */
|
||||||
|
public String getRemarks()
|
||||||
|
{
|
||||||
|
return remarks;
|
||||||
|
}
|
||||||
|
/** 设置删除标记 */
|
||||||
|
public void setDelFlag(String delFlag)
|
||||||
|
{
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取删除标记 */
|
||||||
|
public String getDelFlag()
|
||||||
|
{
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("examPaperId", getExamPaperId())
|
||||||
|
.append("examQuestionType", getExamQuestionType())
|
||||||
|
.append("number", getNumber())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createDate", getCreateDate())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateDate", getUpdateDate())
|
||||||
|
.append("remarks", getRemarks())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ruoyi.exam.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by flower on 2019/1/16.
|
||||||
|
*/
|
||||||
|
public class ExamPaperVO extends ExamPaper {
|
||||||
|
|
||||||
|
private Integer choiceNumber;
|
||||||
|
private Integer moreChoiceNumber;
|
||||||
|
private Integer judgeNumber;
|
||||||
|
|
||||||
|
public Integer getChoiceNumber() {
|
||||||
|
return choiceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChoiceNumber(Integer choiceNumber) {
|
||||||
|
this.choiceNumber = choiceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMoreChoiceNumber() {
|
||||||
|
return moreChoiceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoreChoiceNumber(Integer moreChoiceNumber) {
|
||||||
|
this.moreChoiceNumber = moreChoiceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getJudgeNumber() {
|
||||||
|
return judgeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJudgeNumber(Integer judgeNumber) {
|
||||||
|
this.judgeNumber = judgeNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.exam.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamPaperTypeNumber;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.MyMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机试卷题型数量 数据层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
public interface ExamPaperTypeNumberMapper extends MyMapper<ExamPaperTypeNumber>
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询随机试卷题型数量列表
|
||||||
|
*
|
||||||
|
* @param examPaperTypeNumber 随机试卷题型数量信息
|
||||||
|
* @return 随机试卷题型数量集合
|
||||||
|
*/
|
||||||
|
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberList(ExamPaperTypeNumber examPaperTypeNumber);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ruoyi.exam.service;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamPaperTypeNumber;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
|
/**
|
||||||
|
* 随机试卷题型数量 服务层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
public interface IExamPaperTypeNumberService extends AbstractBaseService<ExamPaperTypeNumber>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询随机试卷题型数量分页列表
|
||||||
|
*
|
||||||
|
* @param examPaperTypeNumber 随机试卷题型数量信息
|
||||||
|
* @return 随机试卷题型数量集合
|
||||||
|
*/
|
||||||
|
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberPage(ExamPaperTypeNumber examPaperTypeNumber);
|
||||||
|
/**
|
||||||
|
* 查询随机试卷题型数量列表
|
||||||
|
*
|
||||||
|
* @param examPaperTypeNumber 随机试卷题型数量信息
|
||||||
|
* @return 随机试卷题型数量集合
|
||||||
|
*/
|
||||||
|
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberList(ExamPaperTypeNumber examPaperTypeNumber);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.ruoyi.exam.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.exam.mapper.ExamPaperTypeNumberMapper;
|
||||||
|
import com.ruoyi.exam.domain.ExamPaperTypeNumber;
|
||||||
|
import com.ruoyi.exam.service.IExamPaperTypeNumberService;
|
||||||
|
import com.ruoyi.common.support.Convert;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||||
|
/**
|
||||||
|
* 随机试卷题型数量 服务层实现
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ExamPaperTypeNumberServiceImpl extends AbstractBaseServiceImpl<ExamPaperTypeNumberMapper,ExamPaperTypeNumber> implements IExamPaperTypeNumberService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ExamPaperTypeNumberMapper examPaperTypeNumberMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询随机试卷题型数量列表
|
||||||
|
*
|
||||||
|
* @param examPaperTypeNumber 随机试卷题型数量信息
|
||||||
|
* @return 随机试卷题型数量集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberList(ExamPaperTypeNumber examPaperTypeNumber)
|
||||||
|
{
|
||||||
|
return examPaperTypeNumberMapper.selectExamPaperTypeNumberList(examPaperTypeNumber);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询随机试卷题型数量分页列表
|
||||||
|
*
|
||||||
|
* @param examPaperTypeNumber 随机试卷题型数量信息
|
||||||
|
* @return 随机试卷题型数量集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberPage(ExamPaperTypeNumber examPaperTypeNumber)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
return examPaperTypeNumberMapper.selectExamPaperTypeNumberList(examPaperTypeNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.exam.mapper.ExamPaperTypeNumberMapper">
|
||||||
|
|
||||||
|
<resultMap type="ExamPaperTypeNumber" id="ExamPaperTypeNumberResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="examPaperId" column="exam_paper_id" />
|
||||||
|
<result property="examQuestionType" column="exam_question_type" />
|
||||||
|
<result property="number" column="number" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createDate" column="create_date" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateDate" column="update_date" />
|
||||||
|
<result property="remarks" column="remarks" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectExamPaperTypeNumberVo">
|
||||||
|
id, exam_paper_id, exam_question_type, number, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||||
|
|
||||||
|
<select id="selectExamPaperTypeNumberList" parameterType="ExamPaperTypeNumber" resultMap="ExamPaperTypeNumberResult">
|
||||||
|
select
|
||||||
|
<include refid="selectExamPaperTypeNumberVo"/>
|
||||||
|
from exam_paper_type_number
|
||||||
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
|
<if test="examPaperId != null "> and exam_paper_id = #{examPaperId}</if>
|
||||||
|
<if test="examQuestionType != null "> and exam_question_type = #{examQuestionType}</if>
|
||||||
|
<if test="number != null "> and number = #{number}</if>
|
||||||
|
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||||
|
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||||
|
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||||
|
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||||
|
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||||
|
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -14,12 +14,37 @@
|
||||||
<input id="name" name="name" class="form-control" type="text">
|
<input id="name" name="name" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="form-group"> -->
|
<div class="form-group">
|
||||||
<!--<label class="col-sm-3 control-label">试卷类型(1-固定试卷;2-随机试卷):</label>-->
|
<label class="col-sm-3 control-label">试卷类型</label>
|
||||||
<!--<div class="col-sm-8">-->
|
<div class="col-sm-8">
|
||||||
<!--<input id="type" name="type" class="form-control" type="text">-->
|
<select id="type" name="type" class="form-control m-b" th:with="type=${@dict.getType('exam_paper_type')}">
|
||||||
<!--</div>-->
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||||
<!--</div>-->
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group type">
|
||||||
|
<label class="col-sm-3 control-label">单选题数量:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="choiceNumber" name="choiceNumber" class="form-control" type="text" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group type">
|
||||||
|
<label class="col-sm-3 control-label">多选题数量:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="moreChoiceNumber" name="moreChoiceNumber" class="form-control" type="text" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group type">
|
||||||
|
<label class="col-sm-3 control-label">选择题:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="judgeNumber" name="judgeNumber" class="form-control" type="text" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">备注信息:</label>
|
<label class="col-sm-3 control-label">备注信息:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
@ -44,6 +69,23 @@
|
||||||
$.operate.save(prefix + "/add", $('#form-examPaper-add').serialize());
|
$.operate.save(prefix + "/add", $('#form-examPaper-add').serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
if($("#type").val().toString()=="1"){
|
||||||
|
$(".type").hide()
|
||||||
|
}else{
|
||||||
|
$(".type").show()
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#type").change(function(){
|
||||||
|
if($("#type").val().toString()=="1"){
|
||||||
|
$(".type").hide()
|
||||||
|
}else{
|
||||||
|
$(".type").show()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,96 @@
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<head th:include="include :: header"></head>
|
<head th:include="include :: header"></head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-examPaper-edit" th:object="${examPaper}">
|
<form class="form-horizontal m" id="form-examPaper-edit" th:object="${examPaper}">
|
||||||
<input id="id" name="id" th:field="*{id}" type="hidden">
|
<input id="id" name="id" th:field="*{id}" type="hidden">
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">名称:</label>
|
<label class="col-sm-3 control-label">名称:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
|
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="form-group"> -->
|
|
||||||
<!--<label class="col-sm-3 control-label">试卷类型:</label>-->
|
|
||||||
<!--<div class="col-sm-8">-->
|
|
||||||
<!--<input id="type" name="type" th:field="*{type}" class="form-control" type="text">-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">备注信息:</label>
|
<label class="col-sm-3 control-label">试卷类型:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input id="remarks" name="remarks" th:field="*{remarks}" class="form-control" type="text">
|
<select id="type" name="type" class="form-control m-b" th:field="*{type}"
|
||||||
</div>
|
th:with="type=${@dict.getType('exam_paper_type')}">
|
||||||
</div>
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
<div class="form-group type">
|
||||||
</div>
|
<label class="col-sm-3 control-label">单选题数量:</label>
|
||||||
<div th:include="include::footer"></div>
|
<div class="col-sm-8">
|
||||||
<script type="text/javascript">
|
<input id="choiceNumber" name="choiceNumber" th:field="*{choiceNumber}" class="form-control"
|
||||||
var prefix = ctx + "exam/examPaper"
|
type="text">
|
||||||
$("#form-examPaper-edit").validate({
|
</div>
|
||||||
rules:{
|
</div>
|
||||||
xxxx:{
|
|
||||||
required:true,
|
<div class="form-group type">
|
||||||
},
|
<label class="col-sm-3 control-label">多选题数量:</label>
|
||||||
}
|
<div class="col-sm-8">
|
||||||
});
|
<input id="moreChoiceNumber" name="moreChoiceNumber" th:field="*{moreChoiceNumber}" class="form-control"
|
||||||
|
type="text">
|
||||||
function submitHandler() {
|
</div>
|
||||||
if ($.validate.form()) {
|
</div>
|
||||||
$.operate.save(prefix + "/edit", $('#form-examPaper-edit').serialize());
|
|
||||||
}
|
<div class="form-group type">
|
||||||
}
|
<label class="col-sm-3 control-label">选择题:</label>
|
||||||
</script>
|
<div class="col-sm-8">
|
||||||
|
<input id="judgeNumber" name="judgeNumber" th:field="*{judgeNumber}" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">备注信息:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="remarks" name="remarks" th:field="*{remarks}" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div th:include="include::footer"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var prefix = ctx + "exam/examPaper"
|
||||||
|
$("#form-examPaper-edit").validate({
|
||||||
|
rules: {
|
||||||
|
xxxx: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/edit", $('#form-examPaper-edit').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
if ($("#type").val().toString() == "1") {
|
||||||
|
$(".type").hide()
|
||||||
|
} else {
|
||||||
|
$(".type").show()
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#type").change(function () {
|
||||||
|
if ($("#type").val().toString() == "1") {
|
||||||
|
$(".type").hide()
|
||||||
|
} else {
|
||||||
|
$(".type").show()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue