Finish all-By Ternece
This commit is contained in:
parent
7f96ccca8b
commit
09bd9583c2
@ -6,7 +6,10 @@ import com.mindskip.xzs.domain.Question;
|
|||||||
import com.mindskip.xzs.service.ExaminationPaperProductionService;
|
import com.mindskip.xzs.service.ExaminationPaperProductionService;
|
||||||
import com.mindskip.xzs.viewmodel.student.exam.ExaminationProductionVM;
|
import com.mindskip.xzs.viewmodel.student.exam.ExaminationProductionVM;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,17 +22,15 @@ public class ExaminationPaperProductionController extends BaseApiController {
|
|||||||
private final ExaminationPaperProductionService examinationPaperProductionService;
|
private final ExaminationPaperProductionService examinationPaperProductionService;
|
||||||
|
|
||||||
@RequestMapping(value = "/paper", method = RequestMethod.GET)
|
@RequestMapping(value = "/paper", method = RequestMethod.GET)
|
||||||
public RestResponse paper(){
|
public RestResponse paper() {
|
||||||
List<Question> paper = examinationPaperProductionService.paper();
|
return RestResponse.ok(examinationPaperProductionService.paper());
|
||||||
return RestResponse.ok(paper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/paper/production", method = RequestMethod.POST)
|
@RequestMapping(value = "/paper/production", method = RequestMethod.POST)
|
||||||
public RestResponse paperProduction(@RequestBody @Valid ExaminationProductionVM examinationProductionVM){
|
public RestResponse paperProduction(@RequestBody @Valid ExaminationProductionVM examinationProductionVM) {
|
||||||
List<Question> questionList = examinationPaperProductionService.generation(examinationProductionVM);
|
List<Question> questionList = examinationPaperProductionService.generation(examinationProductionVM);
|
||||||
return RestResponse.ok(questionList);
|
return RestResponse.ok(questionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.mindskip.xzs.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AllSkillAndIndustry {
|
||||||
|
private List<Skill> skills;
|
||||||
|
private List<Industry> industries;
|
||||||
|
}
|
@ -1,11 +1,15 @@
|
|||||||
package com.mindskip.xzs.domain;
|
package com.mindskip.xzs.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_industry
|
* t_industry
|
||||||
* @author
|
*
|
||||||
|
* @author
|
||||||
*/
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
public class Industry implements Serializable {
|
public class Industry implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.mindskip.xzs.domain;
|
package com.mindskip.xzs.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_industry
|
* t_industry
|
||||||
* @author
|
*
|
||||||
|
* @author
|
||||||
*/
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
public class Skill implements Serializable {
|
public class Skill implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package com.mindskip.xzs.service;
|
package com.mindskip.xzs.service;
|
||||||
|
|
||||||
|
import com.mindskip.xzs.domain.AllSkillAndIndustry;
|
||||||
import com.mindskip.xzs.domain.Question;
|
import com.mindskip.xzs.domain.Question;
|
||||||
import com.mindskip.xzs.viewmodel.student.exam.ExaminationProductionVM;
|
import com.mindskip.xzs.viewmodel.student.exam.ExaminationProductionVM;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ExaminationPaperProductionService extends BaseService<Question>{
|
public interface ExaminationPaperProductionService extends BaseService<Question> {
|
||||||
|
|
||||||
|
|
||||||
List<Question> generation(ExaminationProductionVM examinationProductionVM);
|
List<Question> generation(ExaminationProductionVM examinationProductionVM);
|
||||||
List<Question> paper();
|
|
||||||
|
AllSkillAndIndustry paper();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.mindskip.xzs.service.impl;
|
package com.mindskip.xzs.service.impl;
|
||||||
|
|
||||||
|
import com.mindskip.xzs.domain.AllSkillAndIndustry;
|
||||||
|
import com.mindskip.xzs.domain.Industry;
|
||||||
import com.mindskip.xzs.domain.Question;
|
import com.mindskip.xzs.domain.Question;
|
||||||
|
import com.mindskip.xzs.domain.Skill;
|
||||||
import com.mindskip.xzs.repository.BaseMapper;
|
import com.mindskip.xzs.repository.BaseMapper;
|
||||||
import com.mindskip.xzs.repository.QuestionMapper;
|
import com.mindskip.xzs.repository.QuestionMapper;
|
||||||
import com.mindskip.xzs.service.ExaminationPaperProductionService;
|
import com.mindskip.xzs.service.ExaminationPaperProductionService;
|
||||||
@ -69,10 +72,29 @@ public class ExaminationPaperProductionServiceImpl extends BaseServiceImpl<Quest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Question> paper(){
|
public AllSkillAndIndustry paper() {
|
||||||
List<Question> questions1 = questionMapper.selectAllSkills();
|
List<Question> questions1 = questionMapper.selectAllSkills();
|
||||||
List<Question> questions2 = questionMapper.selectAllIndustry();
|
List<Question> questions2 = questionMapper.selectAllIndustry();
|
||||||
questions1.addAll(questions2);
|
|
||||||
return questions1;
|
|
||||||
|
List<Skill> skillList = new ArrayList<>();
|
||||||
|
for (Question question : questions1) {
|
||||||
|
Integer skillId = question.getSkillId();
|
||||||
|
String skillName = question.getSkillName();
|
||||||
|
Skill skill = new Skill(skillId, skillName);
|
||||||
|
|
||||||
|
skillList.add(skill);
|
||||||
|
}
|
||||||
|
ArrayList<Industry> industries = new ArrayList<>();
|
||||||
|
for (Question question : questions2) {
|
||||||
|
Integer industryId = question.getIndustryId();
|
||||||
|
String industryName = question.getIndustryName();
|
||||||
|
Industry industry = new Industry(industryId, industryName);
|
||||||
|
|
||||||
|
industries.add(industry);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new AllSkillAndIndustry(skillList, industries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user