Commit d4f2f83e authored by 吴卿华's avatar 吴卿华

修改多选择

parent 6d6a8764
...@@ -16,6 +16,12 @@ ...@@ -16,6 +16,12 @@
</description> </description>
<dependencies> <dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.40</version>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
......
...@@ -164,23 +164,23 @@ public class TBankSubjectController extends BaseController ...@@ -164,23 +164,23 @@ public class TBankSubjectController extends BaseController
} }
} }
/**答案*/ /**答案*/
if ("A".equals(row.getCell(9).toString())){ // if ("A".equals(row.getCell(9).toString())){
excelEntity.setAnswer(0); // excelEntity.setAnswer(0);
}else if ("B".equals(row.getCell(9).toString())){ // }else if ("B".equals(row.getCell(9).toString())){
excelEntity.setAnswer(1); // excelEntity.setAnswer(1);
}else if ("C".equals(row.getCell(9).toString())){ // }else if ("C".equals(row.getCell(9).toString())){
excelEntity.setAnswer(2); // excelEntity.setAnswer(2);
}else if ("D".equals(row.getCell(9).toString())){ // }else if ("D".equals(row.getCell(9).toString())){
excelEntity.setAnswer(3); // excelEntity.setAnswer(3);
}else if ("E".equals(row.getCell(9).toString())){ // }else if ("E".equals(row.getCell(9).toString())){
excelEntity.setAnswer(4); // excelEntity.setAnswer(4);
}else if ("F".equals(row.getCell(9).toString())){ // }else if ("F".equals(row.getCell(9).toString())){
excelEntity.setAnswer(5); // excelEntity.setAnswer(5);
}else if ("G".equals(row.getCell(9).toString())){ // }else if ("G".equals(row.getCell(9).toString())){
excelEntity.setAnswer(6); // excelEntity.setAnswer(6);
}else if ("H".equals(row.getCell(9).toString())){ // }else if ("H".equals(row.getCell(9).toString())){
excelEntity.setAnswer(7); // excelEntity.setAnswer(7);
} // }
excelEntity.setTopicOption(String.valueOf(jsonArray)); excelEntity.setTopicOption(String.valueOf(jsonArray));
excelEntity.setDatetime(new Date()); excelEntity.setDatetime(new Date());
list.add(excelEntity); list.add(excelEntity);
......
package com.zehong.web.controller.train; package com.zehong.web.controller.train;
import com.alibaba.fastjson.JSON;
import com.zehong.common.annotation.Log; import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController; import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
...@@ -65,7 +66,10 @@ public class TTrainCourseController extends BaseController ...@@ -65,7 +66,10 @@ public class TTrainCourseController extends BaseController
@ApiOperation("用户课程考试") @ApiOperation("用户课程考试")
@GetMapping("/examination") @GetMapping("/examination")
public AjaxResult examination(Long userCourseId,String answers){ public AjaxResult examination(Long userCourseId,String answers){
Map<String,Object> map = tTrainCourseService.examination(userCourseId, answers.split(",")); String n="["+answers+']';
//字符串转换成二维数组
Integer[][] integers = JSON.parseObject(n, Integer[][].class);
Map<String,Object> map = tTrainCourseService.examination(userCourseId,integers);
return AjaxResult.success(map); return AjaxResult.success(map);
} }
/** /**
......
...@@ -26,7 +26,7 @@ import com.zehong.common.core.page.TableDataInfo; ...@@ -26,7 +26,7 @@ import com.zehong.common.core.page.TableDataInfo;
/** /**
* 培训课程题库Controller * 培训课程题库Controller
* *
* @author zehong * @author zehong
* @date 2022-09-19 * @date 2022-09-19
*/ */
...@@ -133,4 +133,12 @@ public class TTrainCourseTopicController extends BaseController ...@@ -133,4 +133,12 @@ public class TTrainCourseTopicController extends BaseController
public AjaxResult bachAddTopic(@RequestBody BatchTopicVo batchTopicVo){ public AjaxResult bachAddTopic(@RequestBody BatchTopicVo batchTopicVo){
return toAjax(tTrainCourseTopicService.bachAddTopic(batchTopicVo)); return toAjax(tTrainCourseTopicService.bachAddTopic(batchTopicVo));
} }
/**
* 培训课程管理批量导入试题
*/
@PostMapping("/addTTrainCourseTopic")
public AjaxResult addTTrainCourseTopic(@RequestBody BatchTopicVo batchTopicVo){
return toAjax(tTrainCourseTopicService.addTTrainCourseTopic(batchTopicVo));
}
} }
...@@ -36,13 +36,24 @@ public class TBankSubject extends BaseEntity ...@@ -36,13 +36,24 @@ public class TBankSubject extends BaseEntity
/** 答案 */ /** 答案 */
@Excel(name = "正确答案(必填)") @Excel(name = "正确答案(必填)")
private int answer; private String answer;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime; private Date datetime;
/** 题目类型 1单选 2多选 3判断 */
private Integer topicType;
public Integer getTopicType() {
return topicType;
}
public void setTopicType(Integer topicType) {
this.topicType = topicType;
}
public void setSubjectId(Long subjectId) public void setSubjectId(Long subjectId)
{ {
this.subjectId = subjectId; this.subjectId = subjectId;
...@@ -84,11 +95,11 @@ public class TBankSubject extends BaseEntity ...@@ -84,11 +95,11 @@ public class TBankSubject extends BaseEntity
return serialVersionUID; return serialVersionUID;
} }
public int getAnswer() { public String getAnswer() {
return answer; return answer;
} }
public void setAnswer(int answer) { public void setAnswer(String answer) {
this.answer = answer; this.answer = answer;
} }
......
...@@ -53,7 +53,7 @@ public class TTrainCourse extends BaseEntity ...@@ -53,7 +53,7 @@ public class TTrainCourse extends BaseEntity
@Excel(name = "课程视频") @Excel(name = "课程视频")
private String video; private String video;
/** 答题合格*/ /** 答题合格分数*/
@Excel(name = "答题合格分数") @Excel(name = "答题合格分数")
private Integer qualifiedNum; private Integer qualifiedNum;
......
...@@ -42,16 +42,6 @@ public class TTrainCourseTopic extends BaseEntity ...@@ -42,16 +42,6 @@ public class TTrainCourseTopic extends BaseEntity
/** 题目类型 1单选 2多选 3判断 */ /** 题目类型 1单选 2多选 3判断 */
private Integer topicType; private Integer topicType;
/** 答题合格分数*/
private Integer qualifiedNum;
public Integer getQualifiedNum() {
return qualifiedNum;
}
public void setQualifiedNum(Integer qualifiedNum) {
this.qualifiedNum = qualifiedNum;
}
public static long getSerialVersionUID() { public static long getSerialVersionUID() {
return serialVersionUID; return serialVersionUID;
......
...@@ -42,4 +42,16 @@ public class UserCourseVo { ...@@ -42,4 +42,16 @@ public class UserCourseVo {
private Integer trainState; private Integer trainState;
/**总分*/
private Integer totalScore;
/**多选题分数*/
private Integer multipleChoiceScore;
/**判断题分数*/
private Integer judgmentScore;
/**单选题分数*/
private Integer singleChoiceScore;
} }
...@@ -10,15 +10,15 @@ import com.zehong.system.domain.vo.UserCourseVo; ...@@ -10,15 +10,15 @@ import com.zehong.system.domain.vo.UserCourseVo;
/** /**
* 培训课程Service接口 * 培训课程Service接口
* *
* @author zehong * @author zehong
* @date 2022-09-19 * @date 2022-09-19
*/ */
public interface ITTrainCourseService public interface ITTrainCourseService
{ {
/** /**
* 查询培训课程 * 查询培训课程
* *
* @param courseId 培训课程ID * @param courseId 培训课程ID
* @return 培训课程 * @return 培训课程
*/ */
...@@ -33,7 +33,7 @@ public interface ITTrainCourseService ...@@ -33,7 +33,7 @@ public interface ITTrainCourseService
/** /**
* 查询培训课程列表 * 查询培训课程列表
* *
* @param tTrainCourse 培训课程 * @param tTrainCourse 培训课程
* @return 培训课程集合 * @return 培训课程集合
*/ */
...@@ -41,7 +41,7 @@ public interface ITTrainCourseService ...@@ -41,7 +41,7 @@ public interface ITTrainCourseService
/** /**
* 新增培训课程 * 新增培训课程
* *
* @param tTrainCourse 培训课程 * @param tTrainCourse 培训课程
* @return 结果 * @return 结果
*/ */
...@@ -49,7 +49,7 @@ public interface ITTrainCourseService ...@@ -49,7 +49,7 @@ public interface ITTrainCourseService
/** /**
* 修改培训课程 * 修改培训课程
* *
* @param tTrainCourse 培训课程 * @param tTrainCourse 培训课程
* @return 结果 * @return 结果
*/ */
...@@ -58,7 +58,7 @@ public interface ITTrainCourseService ...@@ -58,7 +58,7 @@ public interface ITTrainCourseService
/** /**
* 批量删除培训课程 * 批量删除培训课程
* *
* @param courseIds 需要删除的培训课程ID * @param courseIds 需要删除的培训课程ID
* @return 结果 * @return 结果
*/ */
...@@ -66,7 +66,7 @@ public interface ITTrainCourseService ...@@ -66,7 +66,7 @@ public interface ITTrainCourseService
/** /**
* 删除培训课程信息 * 删除培训课程信息
* *
* @param courseId 培训课程ID * @param courseId 培训课程ID
* @return 结果 * @return 结果
*/ */
...@@ -85,7 +85,7 @@ public interface ITTrainCourseService ...@@ -85,7 +85,7 @@ public interface ITTrainCourseService
/** /**
* 考试 * 考试
*/ */
public Map<String,Object> examination(Long userCourseId,String[] answers); public Map<String,Object> examination(Long userCourseId,Integer[][] answers);
/** /**
* 考试发布 * 考试发布
......
...@@ -7,15 +7,15 @@ import java.util.List; ...@@ -7,15 +7,15 @@ import java.util.List;
/** /**
* 培训课程题库Service接口 * 培训课程题库Service接口
* *
* @author zehong * @author zehong
* @date 2022-09-19 * @date 2022-09-19
*/ */
public interface ITTrainCourseTopicService public interface ITTrainCourseTopicService
{ {
/** /**
* 查询培训课程题库 * 查询培训课程题库
* *
* @param topicId 培训课程题库ID * @param topicId 培训课程题库ID
* @return 培训课程题库 * @return 培训课程题库
*/ */
...@@ -23,7 +23,7 @@ public interface ITTrainCourseTopicService ...@@ -23,7 +23,7 @@ public interface ITTrainCourseTopicService
/** /**
* 查询培训课程题库列表 * 查询培训课程题库列表
* *
* @param tTrainCourseTopic 培训课程题库 * @param tTrainCourseTopic 培训课程题库
* @return 培训课程题库集合 * @return 培训课程题库集合
*/ */
...@@ -32,7 +32,7 @@ public interface ITTrainCourseTopicService ...@@ -32,7 +32,7 @@ public interface ITTrainCourseTopicService
/** /**
* 新增培训课程题库 * 新增培训课程题库
* *
* @param tTrainCourseTopic 培训课程题库 * @param tTrainCourseTopic 培训课程题库
* @return 结果 * @return 结果
*/ */
...@@ -40,7 +40,7 @@ public interface ITTrainCourseTopicService ...@@ -40,7 +40,7 @@ public interface ITTrainCourseTopicService
/** /**
* 修改培训课程题库 * 修改培训课程题库
* *
* @param tTrainCourseTopic 培训课程题库 * @param tTrainCourseTopic 培训课程题库
* @return 结果 * @return 结果
*/ */
...@@ -48,7 +48,7 @@ public interface ITTrainCourseTopicService ...@@ -48,7 +48,7 @@ public interface ITTrainCourseTopicService
/** /**
* 批量删除培训课程题库 * 批量删除培训课程题库
* *
* @param topicIds 需要删除的培训课程题库ID * @param topicIds 需要删除的培训课程题库ID
* @return 结果 * @return 结果
*/ */
...@@ -56,7 +56,7 @@ public interface ITTrainCourseTopicService ...@@ -56,7 +56,7 @@ public interface ITTrainCourseTopicService
/** /**
* 删除培训课程题库信息 * 删除培训课程题库信息
* *
* @param topicId 培训课程题库ID * @param topicId 培训课程题库ID
* @return 结果 * @return 结果
*/ */
...@@ -68,4 +68,11 @@ public interface ITTrainCourseTopicService ...@@ -68,4 +68,11 @@ public interface ITTrainCourseTopicService
* @return int * @return int
*/ */
int bachAddTopic(BatchTopicVo batchTopicVo); int bachAddTopic(BatchTopicVo batchTopicVo);
/**
* 培训课程管理批量导入试题
* @param batchTopicVo
* @return
*/
int addTTrainCourseTopic(BatchTopicVo batchTopicVo);
} }
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.StatisticsTrainCourse; import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse; import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic; import com.zehong.system.domain.TTrainCourseTopic;
...@@ -19,6 +21,8 @@ import org.springframework.stereotype.Service; ...@@ -19,6 +21,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -163,6 +167,23 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService ...@@ -163,6 +167,23 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
v.setState(4); v.setState(4);
} }
} }
for (int i=0;i<list.size();i++){
int totalScore=0;
Long courseId = list.get(i).getCourseId();
//查询课程下面的题
List<TTrainCourseTopic> tTrainCourseTopics = tTrainCourseTopicMapper.selectCourseTopicList(courseId);
for (int t=0;t<tTrainCourseTopics.size();t++){
if (tTrainCourseTopics.get(t).getTopicType()==1){
totalScore=totalScore+list.get(i).getSingleChoiceScore();
}else if (tTrainCourseTopics.get(t).getTopicType()==2){
totalScore=totalScore+list.get(i).getMultipleChoiceScore();
}else if (tTrainCourseTopics.get(t).getTopicType()==3){
totalScore=totalScore+list.get(i).getJudgmentScore();
}
}
list.get(i).setTotalScore(totalScore);
}
return list; return list;
} }
...@@ -183,32 +204,96 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService ...@@ -183,32 +204,96 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map<String,Object> examination (Long userCourseId,String[] answers){ public Map<String,Object> examination (Long userCourseId,Integer[][] answers){
System.out.println(answers[0]);
//查询用户课程信息
TTrainUserCourse userCourse = tTrainUserCourseMapper.selectTTrainUserCourseById(userCourseId); TTrainUserCourse userCourse = tTrainUserCourseMapper.selectTTrainUserCourseById(userCourseId);
TTrainCourseTopic topic = new TTrainCourseTopic(); TTrainCourseTopic topic = new TTrainCourseTopic();
/**添加所属课程id*/
topic.setCourseId(userCourse.getCourseId()); topic.setCourseId(userCourse.getCourseId());
/**查询培训课程题库列表*/
List<TTrainCourseTopic> list = tTrainCourseTopicMapper.selectTTrainCourseTopicList(topic); List<TTrainCourseTopic> list = tTrainCourseTopicMapper.selectTTrainCourseTopicList(topic);
/**查询培训课程*/
TTrainCourse c = tTrainCourseMapper.selectTTrainCourseById(userCourse.getCourseId());
/**获取各个题目类型多少分*/
//多选题分数
Integer multipleChoiceScore = c.getMultipleChoiceScore();
//单选题分数
Integer singleChoiceScore = c.getSingleChoiceScore();
//判断题分数
Integer judgmentScore = c.getJudgmentScore();
//答题合格分数
Integer qualifiedNum = c.getQualifiedNum();
//已获得分数
int num = 0; int num = 0;
// for(Integer i=0;i<answers.length;i++){
/**
* 大循环 共有多少答案 此循环最后只算出 得了多少分
*/
for (int i=0;i<answers.length;i++){
/**答题是否正确 0 不正确 1正确*/
int PassedNot =0;
/*题目答案*/
String answer = list.get(i).getAnswer();
System.out.println("答案:"+answer);
//答案转换成数组
Integer[] integers = JSON.parseObject(answer, Integer[].class);
/**判断所选答案是否与正确答案长度相等*/
if (integers.length==answers[i].length){
boolean adopt=true;
for (int n=0;n<integers.length;n++){
if (integers[n]!=answers[i][n]){
adopt=false;
break;
}
}
if (adopt){
/** 1单选 2多选 3判断*/
if (list.get(i).getTopicType()==1){
System.out.println(num);
num=num+singleChoiceScore;
}else if (list.get(i).getTopicType()==2){
System.out.println(num);
num=num+multipleChoiceScore;
}else if (list.get(i).getTopicType()==3){
System.out.println(num);
num=num+judgmentScore;
}
}
}
/**
* 小循环 循环出每次的答案
*/
// for (int s=0;s<answers[i].length;s++){
// System.out.println("所选答案"+answers[i][s]);
// }
}
for(Integer i=0;i<answers.length;i++){
// String demosub = list.get(i).getAnswer().substring(1,list.get(i).getAnswer().length()-1); // String demosub = list.get(i).getAnswer().substring(1,list.get(i).getAnswer().length()-1);
// if(Integer.parseInt(answers[i])==demosub){ // if(Integer.parseInt(answers[i])==demosub){
// num++; // num++;
// } // }
// } }
/**已获得分数*/
userCourse.setExaminationResult(num); userCourse.setExaminationResult(num);
/**生成日期*/
userCourse.setExaminationTime(new Date()); userCourse.setExaminationTime(new Date());
TTrainCourse c = tTrainCourseMapper.selectTTrainCourseById(userCourse.getCourseId()); /**判断已获得分数 是否通过 1未通过 2已通过*/
if(num>=c.getQualifiedNum()){ if(num>=qualifiedNum){
userCourse.setState(2); userCourse.setState(2);
}else { }else {
userCourse.setState(1); userCourse.setState(1);
} }
tTrainUserCourseMapper.updateTTrainUserCourse(userCourse); tTrainUserCourseMapper.updateTTrainUserCourse(userCourse);
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("answer",num); map.put("answer",num); //得分分数
map.put("qualifiedNum",c.getQualifiedNum()); map.put("qualifiedNum",c.getQualifiedNum()); //答题合格分数
map.put("topicNum",list.size()); map.put("topicNum",list.size()); //题目数据
return map; return map;
} }
......
...@@ -169,4 +169,42 @@ public class TTrainCourseTopicServiceImpl implements ITTrainCourseTopicService ...@@ -169,4 +169,42 @@ public class TTrainCourseTopicServiceImpl implements ITTrainCourseTopicService
course.setTopicNum(course.getTopicNum() + count); course.setTopicNum(course.getTopicNum() + count);
return tTrainCourseMapper.updateTTrainCourse(course); return tTrainCourseMapper.updateTTrainCourse(course);
} }
/**
* 培训课程管理批量导入试题
* @param batchTopicVo
* @return
*/
@Override
public int addTTrainCourseTopic(BatchTopicVo batchTopicVo) {
if(CollectionUtil.isEmpty(batchTopicVo.getTopicInfos()) || StringUtils.isEmpty(String.valueOf(batchTopicVo.getCourseId()))){
return 0;
}
List<TTrainCourseTopic> topics = new ArrayList<>();
int count = 0;
for(BatchTopicVo.TopicInfos topic : batchTopicVo.getTopicInfos()){
//获取题库试题
TBankSubject tBankSubject = new TBankSubject();
tBankSubject.setBankId(topic.getBankId());
List<TBankSubject> bankSubjects = tBankSubjectMapper.selectTBankSubjectList(tBankSubject);
//获取随机试题
Collections.shuffle(bankSubjects);
for(int i = 0;i<topic.getQuan();i++){
TTrainCourseTopic courseTopic = new TTrainCourseTopic();
courseTopic.setCourseId(batchTopicVo.getCourseId());
courseTopic.setTopicTitle(bankSubjects.get(i).getTopicTitle());
courseTopic.setTopicOption(bankSubjects.get(i).getTopicOption());
courseTopic.setAnswer(String.valueOf(bankSubjects.get(i).getAnswer()));
courseTopic.setCreateTime(new Date());
topics.add(courseTopic);
}
count += topic.getQuan();
}
//批量新增试题
tTrainCourseTopicMapper.batchInsertTTrainCourseTopic(topics);
//更新试题数量
TTrainCourse course = tTrainCourseMapper.selectTTrainCourseById(batchTopicVo.getCourseId());
course.setTopicNum(course.getTopicNum() + count);
return tTrainCourseMapper.updateTTrainCourse(course);
}
} }
...@@ -11,10 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -11,10 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="topicOption" column="topic_option" /> <result property="topicOption" column="topic_option" />
<result property="answer" column="answer" /> <result property="answer" column="answer" />
<result property="datetime" column="datetime" /> <result property="datetime" column="datetime" />
<result property="topicType" column="topic_type" />
</resultMap> </resultMap>
<sql id="selectTBankSubjectVo"> <sql id="selectTBankSubjectVo">
select subject_id, bank_id, topic_title, topic_option, answer, datetime from t_bank_subject select subject_id, bank_id, topic_title, topic_option, answer, datetime ,topic_type from t_bank_subject
</sql> </sql>
<select id="selectTBankSubjectList" parameterType="TBankSubject" resultMap="TBankSubjectResult"> <select id="selectTBankSubjectList" parameterType="TBankSubject" resultMap="TBankSubjectResult">
...@@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicOption != null">topic_option,</if> <if test="topicOption != null">topic_option,</if>
<if test="answer != null">answer,</if> <if test="answer != null">answer,</if>
<if test="datetime != null">datetime,</if> <if test="datetime != null">datetime,</if>
<if test="topicType != null">topic_type,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bankId != null">#{bankId},</if> <if test="bankId != null">#{bankId},</if>
...@@ -48,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -48,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicOption != null">#{topicOption},</if> <if test="topicOption != null">#{topicOption},</if>
<if test="answer != null">#{answer},</if> <if test="answer != null">#{answer},</if>
<if test="datetime != null">#{datetime},</if> <if test="datetime != null">#{datetime},</if>
<if test="topicType != null">#{topicType},</if>
</trim> </trim>
</insert> </insert>
...@@ -59,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -59,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicOption != null">topic_option = #{topicOption},</if> <if test="topicOption != null">topic_option = #{topicOption},</if>
<if test="answer != null">answer = #{answer},</if> <if test="answer != null">answer = #{answer},</if>
<if test="datetime != null">datetime = #{datetime},</if> <if test="datetime != null">datetime = #{datetime},</if>
<if test="topicType != null">topic_type = #{topicType},</if>
</trim> </trim>
where subject_id = #{subjectId} where subject_id = #{subjectId}
</update> </update>
......
...@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null and createUser != ''"> and c.create_user = #{createUser}</if> <if test="createUser != null and createUser != ''"> and c.create_user = #{createUser}</if>
<if test="isDel != null "> and c.is_del = #{isDel}</if> <if test="isDel != null "> and c.is_del = #{isDel}</if>
<if test="dataKind != null and dataKind != ''"> and data_kind = #{dataKind}</if> <if test="dataKind != null and dataKind != ''"> and data_kind = #{dataKind}</if>
<if test="dataKind == null and dataKind != ''"> and data_kind != '1'</if>
<if test="testStartTime != null "> and test_start_time = #{testStartTime}</if> <if test="testStartTime != null "> and test_start_time = #{testStartTime}</if>
<if test="testEndTime != null "> and test_end_time = #{testEndTime}</if> <if test="testEndTime != null "> and test_end_time = #{testEndTime}</if>
<if test="testPersons != null and testPersons != ''"> and test_persons = #{testPersons}</if> <if test="testPersons != null and testPersons != ''"> and test_persons = #{testPersons}</if>
...@@ -170,7 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -170,7 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT uc.user_course_id AS userCourseId,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState, SELECT uc.user_course_id AS userCourseId,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime, uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType, c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType,
p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum,c.multiple_choice_score as multipleChoiceScore,
c.judgment_score as judgmentScore,c.single_choice_score as singleChoiceScore
FROM t_train_user_course uc FROM t_train_user_course uc
LEFT JOIN t_train_course c ON c.`course_id` = uc.`course_id` LEFT JOIN t_train_course c ON c.`course_id` = uc.`course_id`
LEFT JOIN t_train_plan p ON p.`plan_id` = c.`course_type` LEFT JOIN t_train_plan p ON p.`plan_id` = c.`course_type`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment