From a28e6dcd25c9a0bc30d178c098e617b91cc76e44 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Thu, 24 Dec 2020 17:06:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E8=A1=A8=E5=8F=8A=E8=A1=8C=E4=B8=9A?= =?UTF-8?q?=EF=BC=8C=E6=8A=80=E8=83=BD=E6=B7=BB=E5=8A=A0=20by=20kevin.cui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/EducationController.java | 1 + .../controller/admin/IndustryController.java | 62 +++++++++++++++++ .../xzs/controller/admin/SkillController.java | 62 +++++++++++++++++ .../com/mindskip/xzs/domain/Question.java | 21 ++++++ .../java/com/mindskip/xzs/domain/Skill.java | 31 +++++++++ .../mindskip/xzs/repository/SkillMapper.java | 27 ++++++++ .../mindskip/xzs/service/IndustryService.java | 19 +++++ .../mindskip/xzs/service/SkillService.java | 18 +++++ .../xzs/service/impl/IndustryServiceImpl.java | 46 +++++++++++++ .../xzs/service/impl/QuestionServiceImpl.java | 16 +++-- .../xzs/service/impl/SkillServiceImpl.java | 46 +++++++++++++ .../admin/industry/IndustryEditRequestVM.java | 19 +++++ .../admin/industry/IndustryPageRequestVM.java | 19 +++++ .../admin/industry/IndustryResponseVM.java | 19 +++++ .../admin/question/QuestionEditRequestVM.java | 7 +- .../admin/question/QuestionPageRequestVM.java | 3 + .../admin/question/QuestionResponseVM.java | 4 ++ .../admin/skill/SkillEditRequestVM.java | 19 +++++ .../admin/skill/SkillPageRequestVM.java | 19 +++++ .../admin/skill/SkillResponseVM.java | 19 +++++ .../src/main/resources/application-dev.yml | 6 +- .../main/resources/mapper/QuestionMapper.xml | 28 +++++++- .../src/main/resources/mapper/SkillMapper.xml | 69 +++++++++++++++++++ 23 files changed, 569 insertions(+), 11 deletions(-) create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/controller/admin/IndustryController.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/controller/admin/SkillController.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/domain/Skill.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/repository/SkillMapper.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/service/IndustryService.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/service/SkillService.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/service/impl/IndustryServiceImpl.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/service/impl/SkillServiceImpl.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryEditRequestVM.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryPageRequestVM.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryResponseVM.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillEditRequestVM.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillPageRequestVM.java create mode 100644 source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillResponseVM.java create mode 100644 source/xzs/src/main/resources/mapper/SkillMapper.xml diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java index 36d16f3..dfd3f85 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java @@ -4,6 +4,7 @@ package com.mindskip.xzs.controller.admin; import com.mindskip.xzs.base.BaseApiController; import com.mindskip.xzs.base.RestResponse; import com.mindskip.xzs.domain.Subject; +import com.mindskip.xzs.service.IndustryService; import com.mindskip.xzs.service.SubjectService; import com.mindskip.xzs.utility.PageInfoHelper; import com.mindskip.xzs.viewmodel.admin.education.SubjectEditRequestVM; diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/IndustryController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/IndustryController.java new file mode 100644 index 0000000..3c5b66a --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/IndustryController.java @@ -0,0 +1,62 @@ +package com.mindskip.xzs.controller.admin; + + +import com.github.pagehelper.PageInfo; +import com.mindskip.xzs.base.BaseApiController; +import com.mindskip.xzs.base.RestResponse; +import com.mindskip.xzs.domain.Industry; +import com.mindskip.xzs.service.IndustryService; +import com.mindskip.xzs.utility.PageInfoHelper; +import com.mindskip.xzs.viewmodel.admin.industry.IndustryEditRequestVM; +import com.mindskip.xzs.viewmodel.admin.industry.IndustryPageRequestVM; +import com.mindskip.xzs.viewmodel.admin.industry.IndustryResponseVM; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +@RestController("AdminIndustryController") +@RequestMapping(value = "/api/admin") +@AllArgsConstructor +public class IndustryController extends BaseApiController { + + private final IndustryService industryService; + + @RequestMapping(value = "/industry/list", method = RequestMethod.POST) + public RestResponse> list() { + List industries = industryService.allIndustry(); + return RestResponse.ok(industries); + } + + @RequestMapping(value = "/industry/page", method = RequestMethod.POST) + public RestResponse> pageList(@RequestBody IndustryPageRequestVM model) { + PageInfo pageInfo = industryService.page(model); + PageInfo page = PageInfoHelper.copyMap(pageInfo, e -> modelMapper.map(e, IndustryResponseVM.class)); + return RestResponse.ok(page); + } + + @RequestMapping(value = "/industry/edit", method = RequestMethod.POST) + public RestResponse edit(@RequestBody @Valid IndustryEditRequestVM model) { + Industry industry = modelMapper.map(model, Industry.class); + if (model.getId() == null) { + industryService.insertByFilter(industry); + } else { + industryService.updateByIdFilter(industry); + } + return RestResponse.ok(); + } + + @RequestMapping(value = "/industry/select/{id}", method = RequestMethod.POST) + public RestResponse select(@PathVariable Integer id) { + Industry industry = industryService.selectById(id); + IndustryEditRequestVM vm = modelMapper.map(industry, IndustryEditRequestVM.class); + return RestResponse.ok(vm); + } + + @RequestMapping(value = "/industry/delete/{id}", method = RequestMethod.POST) + public RestResponse delete(@PathVariable Integer id) { + industryService.deleteById(id); + return RestResponse.ok(); + } +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/SkillController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/SkillController.java new file mode 100644 index 0000000..e163459 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/SkillController.java @@ -0,0 +1,62 @@ +package com.mindskip.xzs.controller.admin; + + +import com.github.pagehelper.PageInfo; +import com.mindskip.xzs.base.BaseApiController; +import com.mindskip.xzs.base.RestResponse; +import com.mindskip.xzs.domain.Skill; +import com.mindskip.xzs.service.SkillService; +import com.mindskip.xzs.utility.PageInfoHelper; +import com.mindskip.xzs.viewmodel.admin.skill.SkillEditRequestVM; +import com.mindskip.xzs.viewmodel.admin.skill.SkillPageRequestVM; +import com.mindskip.xzs.viewmodel.admin.skill.SkillResponseVM; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +@RestController("AdminSkillController") +@RequestMapping(value = "/api/admin") +@AllArgsConstructor +public class SkillController extends BaseApiController { + + private final SkillService skillService; + + @RequestMapping(value = "/skill/list", method = RequestMethod.POST) + public RestResponse> list() { + List industries = skillService.allSkill(); + return RestResponse.ok(industries); + } + + @RequestMapping(value = "/skill/page", method = RequestMethod.POST) + public RestResponse> pageList(@RequestBody SkillPageRequestVM model) { + PageInfo pageInfo = skillService.page(model); + PageInfo page = PageInfoHelper.copyMap(pageInfo, e -> modelMapper.map(e, SkillResponseVM.class)); + return RestResponse.ok(page); + } + + @RequestMapping(value = "/skill/edit", method = RequestMethod.POST) + public RestResponse edit(@RequestBody @Valid SkillEditRequestVM model) { + Skill skill = modelMapper.map(model, Skill.class); + if (model.getId() == null) { + skillService.insertByFilter(skill); + } else { + skillService.updateByIdFilter(skill); + } + return RestResponse.ok(); + } + + @RequestMapping(value = "/skill/select/{id}", method = RequestMethod.POST) + public RestResponse select(@PathVariable Integer id) { + Skill skill = skillService.selectById(id); + SkillEditRequestVM vm = modelMapper.map(skill, SkillEditRequestVM.class); + return RestResponse.ok(vm); + } + + @RequestMapping(value = "/skill/delete/{id}", method = RequestMethod.POST) + public RestResponse delete(@PathVariable Integer id) { + skillService.deleteById(id); + return RestResponse.ok(); + } +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/domain/Question.java b/source/xzs/src/main/java/com/mindskip/xzs/domain/Question.java index eace133..59cb298 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/domain/Question.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/domain/Question.java @@ -17,6 +17,10 @@ public class Question implements Serializable { private Integer subjectId; + private Integer industryId; + + private Integer skillId; + private Integer score; private Integer gradeLevel; @@ -59,6 +63,23 @@ public class Question implements Serializable { this.subjectId = subjectId; } + + public Integer getIndustryId() { + return industryId; + } + + public void setIndustryId(Integer industryId) { + this.industryId = industryId; + } + + public Integer getSkillId() { + return skillId; + } + + public void setSkillId(Integer skillId) { + this.skillId = skillId; + } + public Integer getScore() { return score; } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/domain/Skill.java b/source/xzs/src/main/java/com/mindskip/xzs/domain/Skill.java new file mode 100644 index 0000000..6da142c --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/domain/Skill.java @@ -0,0 +1,31 @@ +package com.mindskip.xzs.domain; + +import java.io.Serializable; + +/** + * t_industry + * @author + */ +public class Skill implements Serializable { + private Integer id; + + private String name; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/source/xzs/src/main/java/com/mindskip/xzs/repository/SkillMapper.java b/source/xzs/src/main/java/com/mindskip/xzs/repository/SkillMapper.java new file mode 100644 index 0000000..bea5768 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/repository/SkillMapper.java @@ -0,0 +1,27 @@ +package com.mindskip.xzs.repository; + +import com.mindskip.xzs.domain.Skill; +import com.mindskip.xzs.viewmodel.admin.skill.SkillPageRequestVM; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface SkillMapper extends BaseMapper { + int deleteByPrimaryKey(Integer id); + + int insert(Skill record); + + int insertSelective(Skill record); + + Skill selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(Skill record); + + int updateByPrimaryKey(Skill record); + + List page(SkillPageRequestVM requestVM); + + List allSkill(); + +} \ No newline at end of file diff --git a/source/xzs/src/main/java/com/mindskip/xzs/service/IndustryService.java b/source/xzs/src/main/java/com/mindskip/xzs/service/IndustryService.java new file mode 100644 index 0000000..0268e0c --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/service/IndustryService.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.service; + +import com.github.pagehelper.PageInfo; +import com.mindskip.xzs.domain.Industry; +import com.mindskip.xzs.domain.Subject; +import com.mindskip.xzs.viewmodel.admin.industry.IndustryPageRequestVM; + +import java.util.List; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 14 + * @Description: + */ +public interface IndustryService extends BaseService { + PageInfo page(IndustryPageRequestVM requestVM); + + List allIndustry(); +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/service/SkillService.java b/source/xzs/src/main/java/com/mindskip/xzs/service/SkillService.java new file mode 100644 index 0000000..1d12c55 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/service/SkillService.java @@ -0,0 +1,18 @@ +package com.mindskip.xzs.service; + +import com.github.pagehelper.PageInfo; +import com.mindskip.xzs.domain.Skill; +import com.mindskip.xzs.viewmodel.admin.skill.SkillPageRequestVM; + +import java.util.List; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 14 + * @Description: + */ +public interface SkillService extends BaseService { + PageInfo page(SkillPageRequestVM requestVM); + + List allSkill(); +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/service/impl/IndustryServiceImpl.java b/source/xzs/src/main/java/com/mindskip/xzs/service/impl/IndustryServiceImpl.java new file mode 100644 index 0000000..7c2e6a5 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/service/impl/IndustryServiceImpl.java @@ -0,0 +1,46 @@ +package com.mindskip.xzs.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.mindskip.xzs.domain.Industry; +import com.mindskip.xzs.repository.IndustryMapper; +import com.mindskip.xzs.service.IndustryService; +import com.mindskip.xzs.viewmodel.admin.industry.IndustryPageRequestVM; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 14 + * @Description: + */ +@Service +public class IndustryServiceImpl extends BaseServiceImpl implements IndustryService { + private final IndustryMapper industryMapper; + private final static String CACHE_NAME = "xzs:industry"; + + public IndustryServiceImpl(IndustryMapper industryMapper) { + super(industryMapper); + this.industryMapper = industryMapper; + } + + @Override + @Cacheable(value = CACHE_NAME, key = "#id", unless = "#result == null") + public Industry selectById(Integer id) { + return super.selectById(id); + } + + @Override + public PageInfo page(IndustryPageRequestVM requestVM) { + return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> + industryMapper.page(requestVM) + ); + } + + @Override + public List allIndustry() { + return industryMapper.allIndustry(); + } +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java b/source/xzs/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java index 00c85bd..33aacdc 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java @@ -57,7 +57,7 @@ public class QuestionServiceImpl extends BaseServiceImpl implements Qu @Transactional public Question insertFullQuestion(QuestionEditRequestVM model, Integer userId) { Date now = new Date(); - Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); +// Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); //题干、解析、选项等 插入 TextContent infoTextContent = new TextContent(); @@ -66,8 +66,10 @@ public class QuestionServiceImpl extends BaseServiceImpl implements Qu textContentService.insertByFilter(infoTextContent); Question question = new Question(); - question.setSubjectId(model.getSubjectId()); - question.setGradeLevel(gradeLevel); +// question.setSubjectId(model.getSubjectId()); + question.setIndustryId(model.getIndustryId()); + question.setSkillId(model.getSkillId()); +// question.setGradeLevel(gradeLevel); question.setCreateTime(now); question.setQuestionType(model.getQuestionType()); question.setStatus(QuestionStatusEnum.OK.getCode()); @@ -84,10 +86,12 @@ public class QuestionServiceImpl extends BaseServiceImpl implements Qu @Override @Transactional public Question updateFullQuestion(QuestionEditRequestVM model) { - Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); +// Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); Question question = questionMapper.selectByPrimaryKey(model.getId()); - question.setSubjectId(model.getSubjectId()); - question.setGradeLevel(gradeLevel); +// question.setSubjectId(model.getSubjectId()); + question.setIndustryId(model.getIndustryId()); + question.setSkillId(model.getSkillId()); +// question.setGradeLevel(gradeLevel); question.setScore(ExamUtil.scoreFromVM(model.getScore())); question.setDifficult(model.getDifficult()); question.setCorrectFromVM(model.getCorrect(), model.getCorrectArray()); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/service/impl/SkillServiceImpl.java b/source/xzs/src/main/java/com/mindskip/xzs/service/impl/SkillServiceImpl.java new file mode 100644 index 0000000..ec6a719 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/service/impl/SkillServiceImpl.java @@ -0,0 +1,46 @@ +package com.mindskip.xzs.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.mindskip.xzs.domain.Skill; +import com.mindskip.xzs.repository.SkillMapper; +import com.mindskip.xzs.service.SkillService; +import com.mindskip.xzs.viewmodel.admin.skill.SkillPageRequestVM; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 14 + * @Description: + */ +@Service +public class SkillServiceImpl extends BaseServiceImpl implements SkillService { + private final SkillMapper skillMapper; + private final static String CACHE_NAME = "xzs:skill"; + + public SkillServiceImpl(SkillMapper skillMapper) { + super(skillMapper); + this.skillMapper = skillMapper; + } + + @Override + @Cacheable(value = CACHE_NAME, key = "#id", unless = "#result == null") + public Skill selectById(Integer id) { + return super.selectById(id); + } + + @Override + public PageInfo page(SkillPageRequestVM requestVM) { + return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> + skillMapper.page(requestVM) + ); + } + + @Override + public List allSkill() { + return skillMapper.allSkill(); + } +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryEditRequestVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryEditRequestVM.java new file mode 100644 index 0000000..cebb93a --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryEditRequestVM.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.viewmodel.admin.industry; + +import com.mindskip.xzs.viewmodel.BaseVM; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 15 + * @Description: + */ +@Data +public class IndustryEditRequestVM extends BaseVM { + private Integer id; + + @NotBlank + private String name; +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryPageRequestVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryPageRequestVM.java new file mode 100644 index 0000000..f370ab8 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryPageRequestVM.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.viewmodel.admin.industry; + +import com.mindskip.xzs.base.BasePage; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 15 + * @Description: + */ +@Data +public class IndustryPageRequestVM extends BasePage { + private Integer id; + + @NotBlank + private String name; +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryResponseVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryResponseVM.java new file mode 100644 index 0000000..71c7647 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/industry/IndustryResponseVM.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.viewmodel.admin.industry; + +import com.mindskip.xzs.viewmodel.BaseVM; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 15 + * @Description: + */ +@Data +public class IndustryResponseVM extends BaseVM { + private Integer id; + + @NotBlank + private String name; +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionEditRequestVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionEditRequestVM.java index c866169..777e0ee 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionEditRequestVM.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionEditRequestVM.java @@ -13,8 +13,13 @@ public class QuestionEditRequestVM { private Integer id; @NotNull private Integer questionType; + @NotNull - private Integer subjectId; + private Integer industryId; + + @NotNull + private Integer skillId; + @NotBlank private String title; diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionPageRequestVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionPageRequestVM.java index 271d922..1711cf0 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionPageRequestVM.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionPageRequestVM.java @@ -10,4 +10,7 @@ public class QuestionPageRequestVM extends BasePage { private Integer level; private Integer subjectId; private Integer questionType; + + private Integer industryId; + private Integer skillId; } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionResponseVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionResponseVM.java index 5937ef7..00015ee 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionResponseVM.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionResponseVM.java @@ -16,6 +16,10 @@ public class QuestionResponseVM extends BaseVM { private Integer subjectId; + private Integer industryId; + + private Integer skillId; + private Integer createUser; private String score; diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillEditRequestVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillEditRequestVM.java new file mode 100644 index 0000000..cbb75d1 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillEditRequestVM.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.viewmodel.admin.skill; + +import com.mindskip.xzs.viewmodel.BaseVM; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 15 + * @Description: + */ +@Data +public class SkillEditRequestVM extends BaseVM { + private Integer id; + + @NotBlank + private String name; +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillPageRequestVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillPageRequestVM.java new file mode 100644 index 0000000..6e2d8f2 --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillPageRequestVM.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.viewmodel.admin.skill; + +import com.mindskip.xzs.base.BasePage; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 15 + * @Description: + */ +@Data +public class SkillPageRequestVM extends BasePage { + private Integer id; + + @NotBlank + private String name; +} diff --git a/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillResponseVM.java b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillResponseVM.java new file mode 100644 index 0000000..979a58a --- /dev/null +++ b/source/xzs/src/main/java/com/mindskip/xzs/viewmodel/admin/skill/SkillResponseVM.java @@ -0,0 +1,19 @@ +package com.mindskip.xzs.viewmodel.admin.skill; + +import com.mindskip.xzs.viewmodel.BaseVM; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Auther: Kevin Cui + * @Date: 2020/12/24 15 + * @Description: + */ +@Data +public class SkillResponseVM extends BaseVM { + private Integer id; + + @NotBlank + private String name; +} diff --git a/source/xzs/src/main/resources/application-dev.yml b/source/xzs/src/main/resources/application-dev.yml index 1654ea4..a007400 100644 --- a/source/xzs/src/main/resources/application-dev.yml +++ b/source/xzs/src/main/resources/application-dev.yml @@ -3,9 +3,9 @@ logging: spring: redis: - host: 192.168.0.96 + host: localhost datasource: - url: jdbc:mysql://192.168.0.96:3306/xzs?useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true + url: jdbc:mysql://localhost:3306/xzs?useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true username: root - password: 123456 + password: lanfoo driver-class-name: com.mysql.cj.jdbc.Driver diff --git a/source/xzs/src/main/resources/mapper/QuestionMapper.xml b/source/xzs/src/main/resources/mapper/QuestionMapper.xml index aacb580..e03614a 100644 --- a/source/xzs/src/main/resources/mapper/QuestionMapper.xml +++ b/source/xzs/src/main/resources/mapper/QuestionMapper.xml @@ -5,6 +5,8 @@ + + @@ -16,7 +18,7 @@ - id, question_type, subject_id, score, grade_level, difficult, correct, info_text_content_id, + id, question_type, subject_id, industry_id, skill_id, score, grade_level, difficult, correct, info_text_content_id, create_user, status, create_time, deleted diff --git a/source/xzs/src/main/resources/mapper/SkillMapper.xml b/source/xzs/src/main/resources/mapper/SkillMapper.xml new file mode 100644 index 0000000..9dbf826 --- /dev/null +++ b/source/xzs/src/main/resources/mapper/SkillMapper.xml @@ -0,0 +1,69 @@ + + + + + + + + + id, `name` + + + + delete from t_skill + where id = #{id,jdbcType=INTEGER} + + + insert into t_skill (`name`) + values (#{name,jdbcType=VARCHAR}) + + + insert into t_skill + + + `name`, + + + + + #{name,jdbcType=VARCHAR}, + + + + + update t_skill + + + `name` = #{name,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_skill + set `name` = #{name,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + + + \ No newline at end of file