拆表及行业,技能添加 by kevin.cui
This commit is contained in:
parent
fc58997116
commit
a28e6dcd25
@ -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;
|
||||
|
@ -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<Industry>> list() {
|
||||
List<Industry> industries = industryService.allIndustry();
|
||||
return RestResponse.ok(industries);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/industry/page", method = RequestMethod.POST)
|
||||
public RestResponse<PageInfo<IndustryResponseVM>> pageList(@RequestBody IndustryPageRequestVM model) {
|
||||
PageInfo<Industry> pageInfo = industryService.page(model);
|
||||
PageInfo<IndustryResponseVM> 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<IndustryEditRequestVM> 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();
|
||||
}
|
||||
}
|
@ -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<Skill>> list() {
|
||||
List<Skill> industries = skillService.allSkill();
|
||||
return RestResponse.ok(industries);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skill/page", method = RequestMethod.POST)
|
||||
public RestResponse<PageInfo<SkillResponseVM>> pageList(@RequestBody SkillPageRequestVM model) {
|
||||
PageInfo<Skill> pageInfo = skillService.page(model);
|
||||
PageInfo<SkillResponseVM> 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<SkillEditRequestVM> 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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
31
source/xzs/src/main/java/com/mindskip/xzs/domain/Skill.java
Normal file
31
source/xzs/src/main/java/com/mindskip/xzs/domain/Skill.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -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<Skill> {
|
||||
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<Skill> page(SkillPageRequestVM requestVM);
|
||||
|
||||
List<Skill> allSkill();
|
||||
|
||||
}
|
@ -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<Industry> {
|
||||
PageInfo<Industry> page(IndustryPageRequestVM requestVM);
|
||||
|
||||
List<Industry> allIndustry();
|
||||
}
|
@ -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<Skill> {
|
||||
PageInfo<Skill> page(SkillPageRequestVM requestVM);
|
||||
|
||||
List<Skill> allSkill();
|
||||
}
|
@ -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<Industry> 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<Industry> page(IndustryPageRequestVM requestVM) {
|
||||
return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
|
||||
industryMapper.page(requestVM)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Industry> allIndustry() {
|
||||
return industryMapper.allIndustry();
|
||||
}
|
||||
}
|
@ -57,7 +57,7 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> 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<Question> 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<Question> 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());
|
||||
|
@ -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<Skill> 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<Skill> page(SkillPageRequestVM requestVM) {
|
||||
return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
|
||||
skillMapper.page(requestVM)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Skill> allSkill() {
|
||||
return skillMapper.allSkill();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -10,4 +10,7 @@ public class QuestionPageRequestVM extends BasePage {
|
||||
private Integer level;
|
||||
private Integer subjectId;
|
||||
private Integer questionType;
|
||||
|
||||
private Integer industryId;
|
||||
private Integer skillId;
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ public class QuestionResponseVM extends BaseVM {
|
||||
|
||||
private Integer subjectId;
|
||||
|
||||
private Integer industryId;
|
||||
|
||||
private Integer skillId;
|
||||
|
||||
private Integer createUser;
|
||||
|
||||
private String score;
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="question_type" jdbcType="INTEGER" property="questionType" />
|
||||
<result column="subject_id" jdbcType="INTEGER" property="subjectId" />
|
||||
<result column="industry_id" jdbcType="INTEGER" property="industryId" />
|
||||
<result column="skill_id" jdbcType="INTEGER" property="skillId" />
|
||||
<result column="score" jdbcType="INTEGER" property="score" />
|
||||
<result column="grade_level" jdbcType="INTEGER" property="gradeLevel" />
|
||||
<result column="difficult" jdbcType="INTEGER" property="difficult" />
|
||||
@ -16,7 +18,7 @@
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
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
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
@ -53,6 +55,12 @@
|
||||
<if test="subjectId != null">
|
||||
subject_id,
|
||||
</if>
|
||||
<if test="industryId != null">
|
||||
industry_id,
|
||||
</if>
|
||||
<if test="skillId != null">
|
||||
skill_id,
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score,
|
||||
</if>
|
||||
@ -91,6 +99,12 @@
|
||||
<if test="subjectId != null">
|
||||
#{subjectId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="industryId != null">
|
||||
#{industryId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="skillId != null">
|
||||
#{skillId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
#{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
@ -129,6 +143,12 @@
|
||||
<if test="subjectId != null">
|
||||
subject_id = #{subjectId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="industryId != null">
|
||||
industry_id = #{industryId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="skillId != null">
|
||||
skill_id = #{skillId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
@ -196,6 +216,12 @@
|
||||
<if test="questionType != null ">
|
||||
and question_type= #{questionType}
|
||||
</if>
|
||||
<if test="industryId != null ">
|
||||
and industry_id= #{industryId}
|
||||
</if>
|
||||
<if test="skillId != null ">
|
||||
and skill_id= #{skillId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
69
source/xzs/src/main/resources/mapper/SkillMapper.xml
Normal file
69
source/xzs/src/main/resources/mapper/SkillMapper.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?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.mindskip.xzs.repository.SkillMapper">
|
||||
<resultMap id="BaseResultMap" type="com.mindskip.xzs.domain.Skill">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from t_skill
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from t_skill
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mindskip.xzs.domain.Skill" useGeneratedKeys="true">
|
||||
insert into t_skill (`name`)
|
||||
values (#{name,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mindskip.xzs.domain.Skill" useGeneratedKeys="true">
|
||||
insert into t_skill
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.mindskip.xzs.domain.Skill">
|
||||
update t_skill
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.mindskip.xzs.domain.Skill">
|
||||
update t_skill
|
||||
set `name` = #{name,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="page" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.skill.SkillEditRequestVM">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM t_skill
|
||||
<where>
|
||||
<if test="id != null ">
|
||||
and id= #{id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="allSkill" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from t_skill
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user