新增题目配置,支持无差别题目配置;

beetlsql3-dev
Mlxa0324 2 years ago
parent 685ec4c9e8
commit 86cdbdd677

@ -124,7 +124,7 @@ public class FunctionConsoleService extends CoreBaseService<CoreFunction> {
* @param userId
* @return
*/
@Cacheable(value=USER_FUNCTION_TREE_CACHE, key="#userId", unless = "#result == null || #result.size() == 0", cacheManager = "cacheManager1Day")
@Cacheable(value=USER_FUNCTION_TREE_CACHE, key="#userId", unless = "#result == null || #result.length() == 0", cacheManager = "cacheManager1Day")
public String getFunctionIdByUser(Long userId){
return this.roleFunctionConsoleDao.getFunctionIdByUser(userId);
}

@ -7,6 +7,7 @@ import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.web.JsonResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.beetl.sql.clazz.kit.BeetlSQLException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
import org.springframework.boot.web.error.ErrorAttributeOptions;
@ -172,10 +173,10 @@ public class CustomErrorController extends AbstractErrorController {
}
protected String getErrorMessage(Throwable ex) {
if(ex instanceof PlatformException || ex instanceof IllegalArgumentException
if(ex instanceof PlatformException || ex instanceof IllegalArgumentException || ex instanceof BeetlSQLException
|| ex instanceof ConstraintViolationException) {
return ex.getMessage();
}else{
return ex.getCause() == null ? ex.getMessage() : ex.getCause().getMessage();
} else{
return "服务器错误,请联系管理员";
}

@ -27,14 +27,14 @@ public interface CoreDictDao extends BaseMapper<CoreDict> {
List<CoreDict> findAllList(String type);
//根据表名、字段名查询 主键名和注释 和 字段名和注释
@Cacheable(value = "core.coreDict.findPkAndValue", key = "#tableName+#columnName")
@Cacheable(value = "coreDictDao.findPkAndValue", key = "#tableName+#columnNames")
List<Map<String,Object>> findPkAndValue (String tableName, String columnNames);
//根据表名、字段名查询 注释
List<Map<String,Object>> findComment (String tableName,String columnNames);
//动态表名、字段名查询并包装成coreDict实体
@Cacheable(value = "core.coreDict:findALlListByTable", key = "#idName+#filedName+#tableCode+#tableName+#params")
@Cacheable(value = "coreDictDao:findALlListByTable", key = "#idName+#filedName+#tableCode+#tableName+#params")
List<CoreDict> findALlListByTable (String idName,String filedName,String tableCode,String tableName,String[] params);
/**

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{BA33ABB7-B246-4DB0-85DE-396EDDB46458}" Label="" LastModificationDate="1667578189" Name="cjks" Objects="1229" Symbols="96" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
<?PowerDesigner AppLocale="UTF16" ID="{BA33ABB7-B246-4DB0-85DE-396EDDB46458}" Label="" LastModificationDate="1667746197" Name="cjks" Objects="1218" Symbols="96" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -17135,13 +17135,13 @@ COLLATE = utf8_general_ci</a:PhysicalOptions>
</o:Column>
<o:Column Id="o980">
<a:ObjectID>7CC923C5-15FB-416F-9848-3A6074318CB7</a:ObjectID>
<a:Name>course_info_id</a:Name>
<a:Code>course_info_id</a:Code>
<a:Name>teacher_open_course_merge_course_info_id</a:Name>
<a:Code>teacher_open_course_merge_course_info_id</a:Code>
<a:CreationDate>1623836619</a:CreationDate>
<a:Creator>lx</a:Creator>
<a:ModificationDate>1663937886</a:ModificationDate>
<a:Modifier>lx</a:Modifier>
<a:Comment>课程ID</a:Comment>
<a:ModificationDate>1667746197</a:ModificationDate>
<a:Modifier>87966</a:Modifier>
<a:Comment>开课课程ID</a:Comment>
<a:DataType>bigint</a:DataType>
</o:Column>
<o:Column Id="o981">

File diff suppressed because it is too large Load Diff

@ -358,4 +358,7 @@ ALTER TABLE teacher_open_course_merge_resources_info ADD COLUMN resources_info_f
ALTER TABLE teacher_open_course_merge_schedule_session ADD COLUMN teacher_open_course_schedule_session_open_on_holidays tinyint(1) COMMENT '节假日是否排课';
ALTER TABLE teacher_open_course_merge_schedule_session ADD COLUMN teacher_open_course_schedule_session_class_list varchar(4000) COMMENT '开课节次和班级的组合JSON格式';
ALTER TABLE teacher_open_course_merge_schedule_session ADD COLUMN teacher_open_course_schedule_session_class_list varchar(4000) COMMENT '开课节次和班级的组合JSON格式';
-- 回显用
ALTER TABLE resources_question_snapshot ADD COLUMN teacher_open_course_merge_resources_question_id bigint COMMENT '开课题目ID';

@ -8,6 +8,7 @@ import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.mapper.annotation.SqlResource;
import org.beetl.sql.mapper.annotation.Update;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
@ -29,6 +30,8 @@ public interface TeacherOpenCourseMergeCourseInfoDao extends BaseMapper<TeacherO
@Update
int updateGivenByIds(TeacherOpenCourseMergeCourseInfoQuery teacherOpenCourseMergeCourseInfoQuery);
List<TeacherOpenCourseMergeCourseInfo> getByIds(String ids);
@Cacheable(value = "teacherOpenCourseMergeCourseInfoDao.getById", key="#id", unless = "#result == null")
default TeacherOpenCourseMergeCourseInfo getById(Long id) {
List<TeacherOpenCourseMergeCourseInfo> list = getByIds(id.toString());
return ObjectUtil.isNotEmpty(list) ? list.get(0) : null;

@ -29,7 +29,10 @@ public class ResourcesQuestionSnapshot extends BaseEntity{
//开课课程ID
@Dict(type = "teacher_open_course_merge_course_info.course_info_name.course_info_status=1")
private Long teacherOpenCourseMergeCourseInfoId ;
//开课题目ID 回显用
private Long teacherOpenCourseMergeResourcesQuestionId ;
//题型(1单选 2多选 3判断)
private Integer questionType ;
@ -296,4 +299,12 @@ public class ResourcesQuestionSnapshot extends BaseEntity{
public void setTeacherOpenCourseMergeCourseInfoId(Long teacherOpenCourseMergeCourseInfoId) {
this.teacherOpenCourseMergeCourseInfoId = teacherOpenCourseMergeCourseInfoId;
}
public Long getTeacherOpenCourseMergeResourcesQuestionId() {
return teacherOpenCourseMergeResourcesQuestionId;
}
public void setTeacherOpenCourseMergeResourcesQuestionId(Long teacherOpenCourseMergeResourcesQuestionId) {
this.teacherOpenCourseMergeResourcesQuestionId = teacherOpenCourseMergeResourcesQuestionId;
}
}

@ -6,6 +6,7 @@ import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.annotation.DictEnum;
import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -179,6 +180,43 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
@InsertIgnore
private List<ResourcesQuestionSnapshot> resourcesQuestionSnapshotList;
/**
*
*
*/
@FetchSql("SELECT " +
" t.question_type AS question_type, " +
" ( SELECT count( 1 ) FROM teacher_open_course_merge_resources_question ta WHERE ta.question_type = t.question_type AND ta.question_status = 1 ) AS total_count, " +
" count( 1 ) AS select_count, " +
" min( t.question_score ) single_score, " +
" min( t.question_score ) * count( 1 ) AS single_type_total_score, " +
" GROUP_CONCAT( t.teacher_open_course_merge_resources_question_id ) AS resources_question_id_plural " +
"FROM " +
" resources_question_snapshot t " +
"WHERE " +
" 1 = 1 " +
" AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
" " +
" AND t.question_status = 1 " +
"GROUP BY " +
" t.question_type "
)
@UpdateIgnore
@InsertIgnore
private List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions;
/**
*
*/
@UpdateIgnore
@InsertIgnore
// 题目ID集合
@FetchSql("select group_concat(t.teacher_open_course_merge_resources_question_id) " +
"from resources_question_snapshot t where t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# \n" +
"and t.question_status = 1 \n"
)
private String resourcesQuestionIdPlural;
public void setAvgSuccessCount(Integer avgSuccessCount) {
this.avgSuccessCount = avgSuccessCount;
tryToUpdateAvgSuccessRate();

@ -1,12 +1,14 @@
package com.ibeetl.jlw.entity.dto;
import cn.jlw.validate.ValidateConfig;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.beetl.sql.annotation.entity.AutoID;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@ -22,12 +24,16 @@ import java.math.BigDecimal;
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TeacherOpenCourseQuestionSettingDTO {
/**
*
*/
@NotNull(message = "题型不能为空!", groups = ValidateConfig.ADD.class)
// 用于主键缓存
@AutoID
private ResourcesQuestionTypeEnum questionType;
/**

@ -0,0 +1,24 @@
package com.ibeetl.jlw.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.beetl.sql.annotation.entity.EnumMapping;
/**
*
*
* @author mlx
*/
@Getter
@EnumMapping("name")
@AllArgsConstructor
public enum CopyFromEnum {
// 从系统配置的课程中获取
FROM_SYSTEM("系统端"),
// 从教师开课中获取
FROM_OPEN_COURSE("开课端");
private String text;
}

@ -186,7 +186,7 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
return courseInfoDao.getCourseInfoValues(courseInfoQuery);
}
@Cacheable(value = "courseInfoService.getById", key = "#courseInfoId", unless = "#courseInfoId == null")
@Cacheable(value = "courseInfoService.getById", key = "#courseInfoId", unless = "#result == null")
public CourseInfo getById(Long courseInfoId){
CourseInfo courseInfo = courseInfoDao.getById(courseInfoId);

@ -1,6 +1,8 @@
package com.ibeetl.jlw.service;
import cn.hutool.core.util.EnumUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.jlw.util.ToolUtils;
import com.ibeetl.admin.core.service.CoreBaseService;
@ -14,6 +16,8 @@ import com.ibeetl.jlw.entity.CourseInfo;
import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.jlw.entity.ResourcesQuestion;
import com.ibeetl.jlw.entity.UniversitiesCollegesJurisdictionExperimentalSystem;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO;
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
import com.ibeetl.jlw.web.query.CourseInfoQuery;
import com.ibeetl.jlw.web.query.ResourcesQuestionQuery;
import org.apache.commons.lang3.StringUtils;
@ -23,12 +27,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.assertj.core.util.Lists;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.*;
import java.math.BigDecimal;
@ -36,10 +42,13 @@ import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import static cn.hutool.core.util.ArrayUtil.join;
import static com.ibeetl.jlw.entity.ResourcesQuestionOptionEntity.shuffleOrderOptions;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.joining;
/**
@ -57,6 +66,7 @@ public class ResourcesQuestionService extends CoreBaseService<ResourcesQuestion>
@Autowired private CourseInfoDao courseInfoDao;
@Autowired private CorePlatformService platformService;
@Autowired private ResourcesQuestionService resourcesQuestionService;
public PageQuery<ResourcesQuestion> queryByCondition(PageQuery query){
PageQuery ret = resourcesQuestionDao.queryByCondition(query);
@ -659,4 +669,89 @@ public class ResourcesQuestionService extends CoreBaseService<ResourcesQuestion>
resourcesQuestionQuery.setQuestionStatus(1);
return getValuesByQuery(resourcesQuestionQuery);
}
/**
* ID
*
*
* @param noDiffResourcesQuestionIdPlural IDResourcesQuestion
* @return
*/
public Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionIds(
@NotEmpty(message = "系统题目ID不能为空") String noDiffResourcesQuestionIdPlural) {
// 只查询正常状态的题目列表
ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery();
resourcesQuestionQuery.setQuestionStatus(1);
resourcesQuestionQuery.setResourcesQuestionIds(noDiffResourcesQuestionIdPlural);
List<ResourcesQuestion> valuesByQuery = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery);
return buildSettingDtoListByNoDiffQuestionList(valuesByQuery);
}
/**
*
*
*
* @param resourcesQuestionList
* @return
*/
public <T extends ResourcesQuestion> Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionList(
List<T> resourcesQuestionList) {
return buildSettingDtoListByNoDiffQuestionList(resourcesQuestionList, ResourcesQuestion::getResourcesQuestionId);
}
/**
*
*
*
* @param resourcesQuestionList
* @return
*/
public <T extends ResourcesQuestion> Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionList(
List<T> resourcesQuestionList, Function<T, Long> function) {
if (ObjectUtil.isEmpty(resourcesQuestionList)) {
return null;
}
// 先构建初始的属性
Function<T, TeacherOpenCourseQuestionSettingDTO> buildFunc =
item -> TeacherOpenCourseQuestionSettingDTO.builder()
.questionType(EnumUtil.likeValueOf(ResourcesQuestionTypeEnum.class, item.getQuestionType()))
.resourcesQuestionIdPlural(function.apply(item).toString())
.singleScore(item.getQuestionScore())
.build();
// 根据类型分组
Map<ResourcesQuestionTypeEnum, List<TeacherOpenCourseQuestionSettingDTO>> groupMap =
resourcesQuestionList.stream().map(buildFunc).collect(groupingBy(TeacherOpenCourseQuestionSettingDTO::getQuestionType));
Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> result = new ConcurrentHashMap<>(5);
// 分组后的数据,再处理
groupMap.forEach((key, value) -> {
// resourcesQuestionIdPlural 上面暂存的是单个题目ID这里将所有的题目ID处理成逗号隔开的字符
String questionIds = value.stream()
.map(TeacherOpenCourseQuestionSettingDTO::getResourcesQuestionIdPlural).collect(joining(","));
// 查询到的题目的数量
Integer selectCount = ObjectUtil.defaultIfNull(value, Lists.emptyList()).size();
// 设置其他属性,如果集合长度不为空的话
if (selectCount > 0) {
TeacherOpenCourseQuestionSettingDTO teacherOpenCourseQuestionSettingDTO = value.get(0);
// 该类型下,单个题目的分数
BigDecimal singleScore = teacherOpenCourseQuestionSettingDTO.getSingleScore();
teacherOpenCourseQuestionSettingDTO.setResourcesQuestionIdPlural(questionIds)
.setSingleTypeTotalScore(NumberUtil.mul(singleScore, selectCount))
.setSelectCount(selectCount);
// 放入结果集中
result.put(key, teacherOpenCourseQuestionSettingDTO);
}
});
return result;
}
}

@ -190,14 +190,13 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param questionSettingOptions
* @param courseInfoIdPair
*/
public void insertBatchByMergeResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@Nullable List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
// 在插入之前,先清空列表。这种情况下,支持题目配置还在,重置题目列表的操作。
deleteByTeacherOpenCourseQuestionSettingIds(teacherOpenCourseQuestionSettingId.toString());
public void insertBatchByOpenResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@Nullable Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
// 题目设置,来动态获取题目
if(ObjectUtil.isNotEmpty(questionSettingOptions)) {
// 在插入之前,先清空列表。这种情况下,支持题目配置还在,重置题目列表的操作。
deleteByTeacherOpenCourseQuestionSettingIds(teacherOpenCourseQuestionSettingId.toString());
// 数据库动态设置分数,并获取题目列表
List<ResourcesQuestionSnapshot> insertList = getOpenResourcesQuestionSnapListBySettingOptions(
teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair);
@ -215,7 +214,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param courseInfoIdPair
*/
public void insertBatchBySystemResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@Nullable List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
@Nullable Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
// 在插入之前,先清空列表。这种情况下,支持题目配置还在,重置题目列表的操作。
deleteByTeacherOpenCourseQuestionSettingIds(teacherOpenCourseQuestionSettingId.toString());
@ -242,7 +241,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param courseInfoIdPair
*/
public List<ResourcesQuestionSnapshot> getByOpenCourseResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@Nullable List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
@Nullable Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
// 题目设置,来动态获取题目
if(ObjectUtil.isNotEmpty(questionSettingOptions)) {
// 数据库动态设置分数,并获取题目列表
@ -263,7 +262,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param courseInfoIdPair
*/
public List<ResourcesQuestionSnapshot> getBySystemResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@Nullable List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
@Nullable Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
// 题目设置,来动态获取题目
if(ObjectUtil.isNotEmpty(questionSettingOptions)) {
// 数据库动态设置分数,并获取题目列表
@ -283,7 +282,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param insertList
* @param courseInfoIdPair
*/
public void setNewCourseInfoId(@NotNull List<ResourcesQuestionSnapshot> insertList, @NotNull Map<Long, Long> courseInfoIdPair) {
public void setNewCourseInfoId(@NotNull Collection<ResourcesQuestionSnapshot> insertList, @NotNull Map<Long, Long> courseInfoIdPair) {
insertList.forEach(item -> {
Long courseMergeCourseInfoId = item.getTeacherOpenCourseMergeCourseInfoId();
item.setTeacherOpenCourseMergeCourseInfoId(courseInfoIdPair.getOrDefault(courseMergeCourseInfoId, courseMergeCourseInfoId));
@ -296,7 +295,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @param insertList
* @param courseInfoIdPair
*/
public void setRQNewCourseInfoId(@NotNull List<TeacherOpenCourseMergeResourcesQuestion> insertList, @NotNull Map<Long, Long> courseInfoIdPair) {
public void setRQNewCourseInfoId(@NotNull Collection<TeacherOpenCourseMergeResourcesQuestion> insertList, @NotNull Map<Long, Long> courseInfoIdPair) {
insertList.forEach(item -> {
Long courseMergeCourseInfoId = item.getTeacherOpenCourseMergeCourseInfoId();
item.setTeacherOpenCourseMergeCourseInfoId(courseInfoIdPair.getOrDefault(courseMergeCourseInfoId, courseMergeCourseInfoId));
@ -336,7 +335,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* @return
*/
public List<ResourcesQuestionSnapshot> getResourcesQuestionSnapshotList (
@NotEmpty(message = "开课题库列表不能为空!") final List<TeacherOpenCourseMergeResourcesQuestion> questionList,
@NotEmpty(message = "开课题库列表不能为空!") final Collection<TeacherOpenCourseMergeResourcesQuestion> questionList,
@NotBlank(message = "题目配置ID不能为空") Long teacherOpenCourseQuestionSettingId, Consumer<ResourcesQuestionSnapshot> otherConsumer) {
// 批量插入快照表
List<ResourcesQuestionSnapshot> snapshotList = BeanUtil.copyToList(questionList, ResourcesQuestionSnapshot.class);
@ -382,7 +381,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
*/
public List<ResourcesQuestionSnapshot> getOpenResourcesQuestionSnapListBySettingOptions (
@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@NotBlank(message = "题目设置不能为空!") List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
@NotBlank(message = "题目设置不能为空!") Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
List<ResourcesQuestionSnapshot> result = new ArrayList<>();
@ -410,7 +409,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
*/
public List<ResourcesQuestionSnapshot> getMergeResourcesQuestionSnapListByQuestionSettingOptionsBySystem (
@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId,
@NotBlank(message = "题目设置不能为空!") List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
@NotBlank(message = "题目设置不能为空!") Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
List<ResourcesQuestionSnapshot> result = new ArrayList<>();

@ -54,6 +54,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import static cn.hutool.core.util.ArrayUtil.join;
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
import static com.ibeetl.jlw.enums.CopyFromEnum.FROM_OPEN_COURSE;
import static java.util.stream.Collectors.toSet;
/**
@ -224,7 +225,7 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
}
/**
*
* -
*
*
*
@ -242,7 +243,7 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
// 开课课程2 章节节点
if(Integer.valueOf(2).equals(teacherOpenCourseMergeCourseInfoQuery.getCourseInfoType())) {
// 添加到题目配置和开课题目快照表这里null 不拷贝题目
teacherOpenCourseQuestionSettingService.addTeacherOpenCourseQuestionByCourseInfo(teacherOpenCourseMergeCourseInfoQuery, questionSettingOptions, courseInfoIdPair);
teacherOpenCourseQuestionSettingService.addFrom(teacherOpenCourseMergeCourseInfoQuery, questionSettingOptions, FROM_OPEN_COURSE, courseInfoIdPair);
}
return jsonResult;
@ -781,11 +782,13 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
// 如果课程章节没查到记录,则下面的资源也没必要执行,资源依赖课程章节
if (ObjectUtil.isNotEmpty(courseInfos)) {
// 拷贝系统题目库到教师开课
teacherOpenCourseMergeResourcesQuestionService.copyFromQuestionByCourseChapterInfoIds(teacherOpenCourseId, courseInfos, courseInfoIdPair);
// 取出来所有的课程章、节的ID。大于等于2就是章和他的子节点
teacherOpenCourseQuestionSettingService.processGroupChapterListToQuestionSetting(teacherOpenCourseId, courseInfos, courseInfoIdPair);
teacherOpenCourseMergeResourcesQuestionService.copySystemQuestionToOpenCourse(teacherOpenCourseId, courseInfos, courseInfoIdPair);
// 取出来所有的课程章、节的ID。大于等于2就是章和他的子节点.从系统题目表抽取
// teacherOpenCourseQuestionSettingService.copySystemQuestionChapterTestQuestionToOpenCourse(teacherOpenCourseId, courseInfos, courseInfoIdPair);
// 从开课题库中抽取章节练习题
teacherOpenCourseQuestionSettingService.copyOpenQuestionChapterTestQuestionToOpenCourse(teacherOpenCourseId, courseInfoIdPair);
// 拷贝系统资源库到教师开课
teacherOpenCourseMergeResourcesInfoService.copyFromQuestionByCourseChapterInfoIds(teacherOpenCourseId, courseInfos, courseInfoIdPair);
teacherOpenCourseMergeResourcesInfoService.copySystemResourcesInfoToOpenCourse(teacherOpenCourseId, courseInfos, courseInfoIdPair);
}
});
}
@ -914,6 +917,28 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
return courseInfoList;
}
/**
* IDID
*
*
*
* @param courseInfoList
* @param filterTeacherOpenCourseMergeCourseInfoId
* @param result
* @return
*/
public void getCourseResourcesByList(@NotNull Collection<TeacherOpenCourseMergeCourseInfo> courseInfoList,
@NotNull Long filterTeacherOpenCourseMergeCourseInfoId,
Collection<TeacherOpenCourseMergeCourseInfo> result){
for (TeacherOpenCourseMergeCourseInfo courseInfo : courseInfoList) {
if(courseInfo.getCourseInfoParentId() != null && courseInfo.getCourseInfoParentId().equals(filterTeacherOpenCourseMergeCourseInfoId)) {
result.add(courseInfo);
getCourseResourcesByList(courseInfoList, courseInfo.getTeacherOpenCourseMergeCourseInfoId(), result);
}
}
}
/**
* TreeID
*

@ -329,8 +329,8 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
* @param allCourseInfo
* @param courseInfoIdPair IDIDID
*/
public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
Collection<CourseInfo> allCourseInfo, @Nullable Map<Long, Long> courseInfoIdPair) {
public void copySystemResourcesInfoToOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
Collection<CourseInfo> allCourseInfo, @Nullable Map<Long, Long> courseInfoIdPair) {
ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery();
// 取出所有的课程章节ID
String courseInfoIds = allCourseInfo.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(","));
@ -350,8 +350,8 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
* @param allCourseInfoIdsJoin ID
* @param courseInfoIdPair IDIDID
*/
public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
String allCourseInfoIdsJoin, @Nullable Map<Long, Long> courseInfoIdPair) {
public void copySystemResourcesInfoToOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
String allCourseInfoIdsJoin, @Nullable Map<Long, Long> courseInfoIdPair) {
ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery();
resourcesInfoQuery.setCourseInfoIds(allCourseInfoIdsJoin);
List<ResourcesInfo> resourcesInfoList = resourcesInfoService.getValuesByQuery(resourcesInfoQuery);

@ -3,6 +3,8 @@ package com.ibeetl.jlw.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.EnumUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.jlw.util.ToolUtils;
import com.alibaba.fastjson.JSON;
@ -18,7 +20,9 @@ import com.ibeetl.jlw.entity.CourseInfo;
import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.jlw.entity.ResourcesQuestion;
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesQuestion;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionSettingVO;
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
import com.ibeetl.jlw.web.query.ResourcesQuestionQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesQuestionQuery;
import lombok.extern.slf4j.Slf4j;
@ -28,6 +32,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.assertj.core.util.Lists;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,11 +44,12 @@ import javax.validation.constraints.NotNull;
import java.io.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import static cn.hutool.core.util.ArrayUtil.join;
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toSet;
import static java.util.stream.Collectors.*;
/**
* Service
@ -379,8 +385,8 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ
* @param allCourseInfo
* @param courseInfoIdPair IDIDID
*/
public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
Collection<CourseInfo> allCourseInfo, @NotNull Map<Long, Long> courseInfoIdPair) {
public void copySystemQuestionToOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
Collection<CourseInfo> allCourseInfo, @NotNull Map<Long, Long> courseInfoIdPair) {
// 待拷贝的系统课程ID不能为空.才会执行
if (ObjectUtil.isNotEmpty(allCourseInfo)) {
@ -394,7 +400,7 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ
// 系统题目库ID集合
Set<Long> resourcesQuestionIds = resourcesQuestionList.stream().map(ResourcesQuestion::getResourcesQuestionId).collect(toSet());
// 拷贝系统题目库到教师开课
copyFromQuestion(resourcesQuestionIds, teacherOpenCourseId, courseInfoIdPair);
copyFromSystemQuestion(resourcesQuestionIds, teacherOpenCourseId, courseInfoIdPair);
}
}
@ -405,8 +411,8 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ
* @param allCourseInfoIdsJoin ID
* @param courseInfoIdPair IDIDID
*/
public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
String allCourseInfoIdsJoin, @NotNull Map<Long, Long> courseInfoIdPair) {
public void copySystemQuestionToOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
String allCourseInfoIdsJoin, @NotNull Map<Long, Long> courseInfoIdPair) {
// 待拷贝的系统课程ID不能为空.才会执行
if (ObjectUtil.isNotEmpty(allCourseInfoIdsJoin)) {
@ -418,7 +424,7 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ
// 系统题目库ID集合
Set<Long> resourcesQuestionIds = resourcesQuestionList.stream().map(ResourcesQuestion::getResourcesQuestionId).collect(toSet());
// 拷贝系统题目库到教师开课
copyFromQuestion(resourcesQuestionIds, teacherOpenCourseId, courseInfoIdPair);
copyFromSystemQuestion(resourcesQuestionIds, teacherOpenCourseId, courseInfoIdPair);
}
}
@ -428,17 +434,17 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ
* -
*
*
* @param resourcesQuestionIds
* @param systemResourcesQuestionIds
* @param teacherOpenCourseId
* @param courseInfoIdPair
* @return
*/
public void copyFromQuestion(Set<Long> resourcesQuestionIds,
@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId, Map<Long, Long> courseInfoIdPair) {
public void copyFromSystemQuestion(Set<Long> systemResourcesQuestionIds,
@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId, Map<Long, Long> courseInfoIdPair) {
if (ObjectUtil.isEmpty(resourcesQuestionIds)) { return; }
if (ObjectUtil.isEmpty(systemResourcesQuestionIds)) { return; }
// 题目ID集合
String ids = join(resourcesQuestionIds.toArray(), ",");
String ids = join(systemResourcesQuestionIds.toArray(), ",");
ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery();
resourcesQuestionQuery.setResourcesQuestionIds(ids);
// 已上架的
@ -519,4 +525,70 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ
dictParser(g);
return g;
}
/**
*
*
*
* @param resourcesQuestionList
* @return
*/
public <T extends TeacherOpenCourseMergeResourcesQuestion> Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionList(
List<T> resourcesQuestionList) {
return buildSettingDtoListByNoDiffQuestionList(resourcesQuestionList, TeacherOpenCourseMergeResourcesQuestion::getTeacherOpenCourseMergeResourcesQuestionId);
}
/**
*
*
*
* @param resourcesQuestionList
* @return
*/
public <T extends TeacherOpenCourseMergeResourcesQuestion> Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionList(
List<T> resourcesQuestionList, Function<T, Long> function) {
if (ObjectUtil.isEmpty(resourcesQuestionList)) {
return null;
}
// 先构建初始的属性
Function<T, TeacherOpenCourseQuestionSettingDTO> buildFunc =
item -> TeacherOpenCourseQuestionSettingDTO.builder()
.questionType(EnumUtil.likeValueOf(ResourcesQuestionTypeEnum.class, item.getQuestionType()))
.resourcesQuestionIdPlural(function.apply(item).toString())
.singleScore(item.getQuestionScore())
.build();
// 根据类型分组
Map<ResourcesQuestionTypeEnum, List<TeacherOpenCourseQuestionSettingDTO>> groupMap =
resourcesQuestionList.stream().map(buildFunc).collect(groupingBy(TeacherOpenCourseQuestionSettingDTO::getQuestionType));
Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> result = new ConcurrentHashMap<>(5);
// 分组后的数据,再处理
groupMap.forEach((key, value) -> {
// resourcesQuestionIdPlural 上面暂存的是单个题目ID这里将所有的题目ID处理成逗号隔开的字符
String questionIds = value.stream()
.map(TeacherOpenCourseQuestionSettingDTO::getResourcesQuestionIdPlural).collect(joining(","));
// 查询到的题目的数量
Integer selectCount = ObjectUtil.defaultIfNull(value, Lists.emptyList()).size();
// 设置其他属性,如果集合长度不为空的话
if (selectCount > 0) {
TeacherOpenCourseQuestionSettingDTO teacherOpenCourseQuestionSettingDTO = value.get(0);
// 该类型下,单个题目的分数
BigDecimal singleScore = teacherOpenCourseQuestionSettingDTO.getSingleScore();
teacherOpenCourseQuestionSettingDTO.setResourcesQuestionIdPlural(questionIds)
.setSingleTypeTotalScore(NumberUtil.mul(singleScore, selectCount))
.setSelectCount(selectCount);
// 放入结果集中
result.put(key, teacherOpenCourseQuestionSettingDTO);
}
});
return result;
}
}

@ -1,8 +1,7 @@
package com.ibeetl.jlw.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.func.Func1;
import cn.hutool.core.util.EnumUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.jlw.util.ToolUtils;
import cn.jlw.validate.ValidateConfig;
@ -13,18 +12,15 @@ import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.TeacherOpenCourseQuestionSettingDao;
import com.ibeetl.jlw.entity.CourseInfo;
import com.ibeetl.jlw.entity.ResourcesQuestion;
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeCourseInfo;
import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionSetting;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO;
import com.ibeetl.jlw.enums.CopyFromEnum;
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
import com.ibeetl.jlw.web.query.ResourcesQuestionQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeCourseInfoQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesQuestionQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionSettingQuery;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,14 +31,10 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Nullable;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import static cn.hutool.core.text.CharSequenceUtil.join;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.joining;
/**
@ -61,6 +53,8 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
@Autowired private TeacherOpenCourseQuestionLogWrongService teacherOpenCourseQuestionLogWrongService;
@Autowired private ResourcesQuestionService resourcesQuestionService;
@Autowired private CourseInfoService courseInfoService;
@Autowired private TeacherOpenCourseMergeResourcesQuestionService teacherOpenCourseMergeResourcesQuestionService;
@Autowired private TeacherOpenCourseMergeCourseInfoService teacherOpenCourseMergeCourseInfoService;
public PageQuery<TeacherOpenCourseQuestionSetting>queryByCondition(PageQuery query){
PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByCondition(query);
@ -214,14 +208,44 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
}
/**
*
*
*
*
*
*
*
*
*
*/
public void addFrom(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseMergeCourseInfoQuery teacherOpenCourseMergeCourseInfoQuery,
@Nullable Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, CopyFromEnum copyFrom, Map<Long, Long> courseInfoIdPair) {
Long teacherOpenCourseId = teacherOpenCourseMergeCourseInfoQuery.getTeacherOpenCourseId();
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
// 设置章节练习的默认配置并设置开课ID
settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId);
settingQuery.setTeacherOpenCourseQuestionSettingName(teacherOpenCourseMergeCourseInfoQuery.getCourseInfoName());
settingQuery.setQuestionSettingOptions(new ArrayList<>(questionSettingOptions));
switch (copyFrom) {
case FROM_OPEN_COURSE:
addSettingByOpenCourse(settingQuery, courseInfoIdPair);
case FROM_SYSTEM:
addSettingBySystemCourse(settingQuery, courseInfoIdPair);
break;
}
}
/**
*
*
*
*
* @param settingQuery
* @return
*/
public void addByMergeQuestion(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair ) {
public void addSettingByOpenCourse(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair ) {
if (null == settingQuery.getTeacherOpenCourseQuestionSettingStatus()) {
settingQuery.setTeacherOpenCourseQuestionSettingStatus(1);
@ -233,10 +257,38 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
// 添加到作业主表中
add(settingQuery);
// 插入快照
// 主表ID
Long teacherOpenCourseQuestionSettingId = settingQuery.getTeacherOpenCourseQuestionSettingId();
List<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions = settingQuery.getQuestionSettingOptions();
resourcesQuestionSnapshotService.insertBatchByMergeResourcesQuestion(teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair);
// 传入的开课题目IDS
String resourcesQuestionIdPlural = settingQuery.getResourcesQuestionIdPlural();
// 题目类型区分
Collection<TeacherOpenCourseQuestionSettingDTO> settingDTOList = null;
if(ObjectUtil.isNotEmpty(resourcesQuestionIdPlural)) {
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
questionQuery.setQuestionStatus(1);
questionQuery.setTeacherOpenCourseMergeResourcesQuestionIdPlural(resourcesQuestionIdPlural);
List<TeacherOpenCourseMergeResourcesQuestion> list =
teacherOpenCourseMergeResourcesQuestionService.getValuesByQueryNotWithPermission(questionQuery);
// 无差别题目IDS转换成类型区分的集合
Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> map =
teacherOpenCourseMergeResourcesQuestionService.buildSettingDtoListByNoDiffQuestionList(list);
// 设置分值
settingQuery.getQuestionSettingOptions().forEach(item -> {
TeacherOpenCourseQuestionSettingDTO settingDTO = map.get(item.getQuestionType());
if(ObjectUtil.isAllNotEmpty(settingDTO, item.getSingleScore())) {
settingDTO.setSingleScore(item.getSingleScore());
}
});
if (ObjectUtil.isNotEmpty(map)) { settingDTOList = map.values(); }
} else {
settingDTOList = settingQuery.getQuestionSettingOptions();
}
resourcesQuestionSnapshotService.insertBatchByOpenResourcesQuestion(teacherOpenCourseQuestionSettingId, settingDTOList, courseInfoIdPair);
}
@ -250,7 +302,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
* @param settingQuery
* @return
*/
public void addQuestionByTypeFromSystem(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair ) {
public void addSettingBySystemCourse(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair ) {
if (null == settingQuery.getTeacherOpenCourseQuestionSettingStatus()) {
settingQuery.setTeacherOpenCourseQuestionSettingStatus(1);
@ -269,81 +321,6 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
}
/**
* ID
*
*
* @param noDiffResourcesQuestionIdPlural IDResourcesQuestion
* @return
*/
public Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionIds(
@NotEmpty(message = "系统题目ID不能为空") String noDiffResourcesQuestionIdPlural) {
// 只查询正常状态的题目列表
ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery();
resourcesQuestionQuery.setQuestionStatus(1);
resourcesQuestionQuery.setResourcesQuestionIds(noDiffResourcesQuestionIdPlural);
List<ResourcesQuestion> valuesByQuery = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery);
return buildSettingDtoListByNoDiffQuestionList(valuesByQuery);
}
/**
*
*
*
*
* @param teacherOpenCourseId ID
* @param courseInfos
* @param courseInfoIdPair ID
*/
public void processGroupChapterListToQuestionSetting(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
Collection<CourseInfo> courseInfos, Map<Long, Long> courseInfoIdPair) {
// 章节对应下面的所有子集
Map<CourseInfo, List<CourseInfo>> courseChapterInfoIdsWithChildren = courseInfoService.getCourseChapterInfoIdsWithChildren(courseInfos);
courseChapterInfoIdsWithChildren.forEach((courseInfo, chapterInfoList) -> {
// 该列表下的所有ID合并
String allCourseInfoIds = chapterInfoList.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(","));
List<ResourcesQuestion> questionList = resourcesQuestionService.getByCourseInfoIds(allCourseInfoIds);
// 有题目才继续执行
if(ObjectUtil.isNotEmpty(questionList)) {
Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> map = buildSettingDtoListByNoDiffQuestionList(questionList);
Map<CourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions = new HashMap<>(1);
courseInfoIdWithQuestionSettingOptions.put(courseInfo, map.values());
addTeacherOpenCourseQuestionBySystemCourseInfo(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, courseInfoIdPair);
}
});
}
/**
*
*
*
*
*
*
*
*
*/
public void addTeacherOpenCourseQuestionByCourseInfo(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseMergeCourseInfoQuery teacherOpenCourseMergeCourseInfoQuery,
@Nullable Collection<TeacherOpenCourseQuestionSettingDTO> questionSettingOptions, Map<Long, Long> courseInfoIdPair) {
Long teacherOpenCourseId = teacherOpenCourseMergeCourseInfoQuery.getTeacherOpenCourseId();
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
// 设置章节练习的默认配置并设置开课ID
settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId);
settingQuery.setTeacherOpenCourseQuestionSettingName(teacherOpenCourseMergeCourseInfoQuery.getCourseInfoName());
settingQuery.setQuestionSettingOptions(new ArrayList<>(questionSettingOptions));
addQuestionByTypeFromSystem(settingQuery, courseInfoIdPair);
}
/**
*
*
@ -354,10 +331,10 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
* @param teacherOpenCourseId ID
* @param courseInfoIdWithQuestionSettingOptions KeyValueID
*/
public void addTeacherOpenCourseQuestionByCourseInfo(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<TeacherOpenCourseMergeCourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Map<Long, Long> courseInfoIdPair) {
addTeacherOpenCourseQuestionByCourseInfo(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, Integer.valueOf(2), TeacherOpenCourseMergeCourseInfo::getCourseInfoType, courseInfoIdPair);
public void addSettingByOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<TeacherOpenCourseMergeCourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Map<Long, Long> courseInfoIdPair) {
addSettingByOpenCourse(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, Integer.valueOf(2), TeacherOpenCourseMergeCourseInfo::getCourseInfoType, courseInfoIdPair);
}
@ -375,9 +352,9 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
* @param func1
* @param courseInfoIdPair
*/
public void addTeacherOpenCourseQuestionByCourseInfo(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<TeacherOpenCourseMergeCourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Object eq, @NotNull Func1<TeacherOpenCourseMergeCourseInfo, Integer> func1, @NotNull Map<Long, Long> courseInfoIdPair) {
public void addSettingByOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<TeacherOpenCourseMergeCourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Object eq, @NotNull Func1<TeacherOpenCourseMergeCourseInfo, Integer> func1, @NotNull Map<Long, Long> courseInfoIdPair) {
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
// 设置章节练习的默认配置并设置开课ID
settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId);
@ -388,7 +365,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
if(eq.equals(func1.call(courseInfo))) {
settingQuery.setQuestionSettingOptions(new ArrayList<>(settingDtoList));
settingQuery.setTeacherOpenCourseQuestionSettingName(courseInfo.getCourseInfoName());
addByMergeQuestion(settingQuery, courseInfoIdPair);
addSettingByOpenCourse(settingQuery, courseInfoIdPair);
}
} catch (Exception e) { }
});
@ -405,10 +382,10 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
* @param teacherOpenCourseId ID
* @param courseInfoIdWithQuestionSettingOptions KeyValueID
*/
public void addTeacherOpenCourseQuestionBySystemCourseInfo(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<CourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Map<Long, Long> courseInfoIdPair) {
addTeacherOpenCourseQuestionBySystemCourseInfo(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, Integer.valueOf(2), CourseInfo::getCourseInfoType, courseInfoIdPair);
public void addSettingBySystemCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<CourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Map<Long, Long> courseInfoIdPair) {
addSettingBySystemCourse(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, Integer.valueOf(2), CourseInfo::getCourseInfoType, courseInfoIdPair);
}
/**
@ -425,9 +402,9 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
* @param func1
* @param courseInfoIdPair
*/
public void addTeacherOpenCourseQuestionBySystemCourseInfo(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<CourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Object eq, @NotNull Func1<CourseInfo, Integer> func1, @NotNull Map<Long, Long> courseInfoIdPair) {
public void addSettingBySystemCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
@Nullable Map<CourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
@NotNull Object eq, @NotNull Func1<CourseInfo, Integer> func1, @NotNull Map<Long, Long> courseInfoIdPair) {
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
// 设置章节练习的默认配置并设置开课ID
settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId);
@ -438,67 +415,12 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
if(eq.equals(func1.call(courseInfo))) {
settingQuery.setQuestionSettingOptions(new ArrayList<>(settingDtoList));
settingQuery.setTeacherOpenCourseQuestionSettingName(courseInfo.getCourseInfoName());
addQuestionByTypeFromSystem(settingQuery, courseInfoIdPair);
addSettingBySystemCourse(settingQuery, courseInfoIdPair);
}
} catch (Exception e) { }
});
}
/**
*
*
*
* @param resourcesQuestionList
* @return
*/
public Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> buildSettingDtoListByNoDiffQuestionList(
List<ResourcesQuestion> resourcesQuestionList) {
if (ObjectUtil.isEmpty(resourcesQuestionList)) {
return null;
}
// 先构建初始的属性
Function<ResourcesQuestion, TeacherOpenCourseQuestionSettingDTO> buildFunc =
item -> TeacherOpenCourseQuestionSettingDTO.builder()
.questionType(EnumUtil.likeValueOf(ResourcesQuestionTypeEnum.class, item.getQuestionType()))
.resourcesQuestionIdPlural(item.getResourcesQuestionId().toString())
.singleScore(item.getQuestionScore())
.build();
// 根据类型分组
Map<ResourcesQuestionTypeEnum, List<TeacherOpenCourseQuestionSettingDTO>> groupMap =
resourcesQuestionList.stream().map(buildFunc).collect(groupingBy(TeacherOpenCourseQuestionSettingDTO::getQuestionType));
Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> result = new ConcurrentHashMap<>(5);
// 分组后的数据,再处理
groupMap.forEach((key, value) -> {
// resourcesQuestionIdPlural 上面暂存的是单个题目ID这里将所有的题目ID处理成逗号隔开的字符
String questionIds = value.stream()
.map(TeacherOpenCourseQuestionSettingDTO::getResourcesQuestionIdPlural).collect(joining(","));
// 查询到的题目的数量
Integer selectCount = ObjectUtil.defaultIfNull(value, Lists.emptyList()).size();
// 设置其他属性,如果集合长度不为空的话
if (selectCount > 0) {
TeacherOpenCourseQuestionSettingDTO teacherOpenCourseQuestionSettingDTO = value.get(0);
// 该类型下,单个题目的分数
BigDecimal singleScore = teacherOpenCourseQuestionSettingDTO.getSingleScore();
teacherOpenCourseQuestionSettingDTO.setResourcesQuestionIdPlural(questionIds)
.setSingleTypeTotalScore(NumberUtil.mul(singleScore, selectCount))
.setSelectCount(selectCount);
// 放入结果集中
result.put(key, teacherOpenCourseQuestionSettingDTO);
}
});
return result;
}
@Override
public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) {
log.info("重置开课题目配置");
@ -550,4 +472,89 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
}
}
/**
*
*
*
*
* @param teacherOpenCourseId ID
* @param courseInfos
* @param courseInfoIdPair ID
*/
public void copySystemQuestionChapterTestQuestionToOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId,
Collection<CourseInfo> courseInfos, Map<Long, Long> courseInfoIdPair) {
// 章节对应下面的所有子集
Map<CourseInfo, List<CourseInfo>> courseChapterInfoIdsWithChildren = courseInfoService.getCourseChapterInfoIdsWithChildren(courseInfos);
courseChapterInfoIdsWithChildren.forEach((courseInfo, chapterInfoList) -> {
// 该列表下的所有ID合并
String allCourseInfoIds = chapterInfoList.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(","));
List<ResourcesQuestion> questionList = resourcesQuestionService.getByCourseInfoIds(allCourseInfoIds);
// 有题目才继续执行
if(ObjectUtil.isNotEmpty(questionList)) {
Map<ResourcesQuestionTypeEnum, TeacherOpenCourseQuestionSettingDTO> map = resourcesQuestionService.buildSettingDtoListByNoDiffQuestionList(questionList);
Map<CourseInfo, Collection<TeacherOpenCourseQuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions = new HashMap<>(1);
courseInfoIdWithQuestionSettingOptions.put(courseInfo, map.values());
addSettingBySystemCourse(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, courseInfoIdPair);
}
});
}
/**
*
*
* @param teacherOpenCourseId
* @param courseInfoIdPair
*/
public void copyOpenQuestionChapterTestQuestionToOpenCourse(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId, Map<Long, Long> courseInfoIdPair) {
TeacherOpenCourseMergeCourseInfoQuery query = new TeacherOpenCourseMergeCourseInfoQuery();
query.setTeacherOpenCourseId(teacherOpenCourseId);
query.setCourseInfoStatus(1);
// 获取这个开课下的所有的课程章节信息
List<TeacherOpenCourseMergeCourseInfo> list =
teacherOpenCourseMergeCourseInfoService.getValuesByQueryNotWithPermission(query);
if (ObjectUtil.isEmpty(list)) {
return;
}
// 章节点
Set<TeacherOpenCourseMergeCourseInfo> chapterSet = list.stream()
.filter(item -> Integer.valueOf(2).equals(item.getCourseInfoType())).collect(Collectors.toSet());
// 章下面所有小节,包含章节点
Set<TeacherOpenCourseMergeCourseInfo> result = new HashSet<>(12);
for (TeacherOpenCourseMergeCourseInfo chapter : chapterSet) {
result.clear();
Long teacherOpenCourseMergeCourseInfoId = chapter.getTeacherOpenCourseMergeCourseInfoId();
teacherOpenCourseMergeCourseInfoService.getCourseResourcesByList(list, teacherOpenCourseMergeCourseInfoId, result);
result.add(chapter);
// 单个章节下的所有小节的ID。包含章节
String ids = result.stream().map(item -> item.getTeacherOpenCourseMergeCourseInfoId().toString()).collect(joining(","));
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
questionQuery.setTeacherOpenCourseMergeCourseInfoIdPlural(ids);
// 获取章下面的所有题目
List<TeacherOpenCourseMergeResourcesQuestion> resourcesQuestionList =
teacherOpenCourseMergeResourcesQuestionService.getValuesByQueryNotWithPermission(questionQuery);
TeacherOpenCourseQuestionSettingQuery questionSettingQuery = new TeacherOpenCourseQuestionSettingQuery();
questionSettingQuery.setCourseTestDefault()
.setTeacherOpenCourseQuestionSettingName(chapter.getCourseInfoName())
.setTeacherOpenCourseId(teacherOpenCourseId);
// 添加到章节练习题目配置主表
add(questionSettingQuery);
// 如果有关联的题目,则添加到题目快照表
if(ObjectUtil.isNotEmpty(resourcesQuestionList)) {
// 构造章节练习的题目快照
List<ResourcesQuestionSnapshot> resourcesQuestionSnapshots = BeanUtil.copyToList(resourcesQuestionList, ResourcesQuestionSnapshot.class);
resourcesQuestionSnapshots.forEach(item -> item.setTeacherOpenCourseQuestionSettingId(questionSettingQuery.getTeacherOpenCourseQuestionSettingId()));
// 批量添加题目快照
resourcesQuestionSnapshotService.insertBatch(resourcesQuestionSnapshots);
}
}
}
}

@ -429,7 +429,7 @@ public class TeacherOpenCourseMergeResourcesQuestionController{
*/
@PostMapping(API + "/copyFromQuestion.do")
public JsonResult copyFromQuestion(Long[] resourcesQuestionIds, Long teacherOpenCourseId) {
teacherOpenCourseMergeResourcesQuestionService.copyFromQuestion(CollectionUtil.newHashSet(resourcesQuestionIds), teacherOpenCourseId, null);
teacherOpenCourseMergeResourcesQuestionService.copyFromSystemQuestion(CollectionUtil.newHashSet(resourcesQuestionIds), teacherOpenCourseId, null);
return JsonResult.success();
}

@ -91,7 +91,7 @@ public class TeacherOpenCourseQuestionSettingController{
Assert.notNull(coreUser, "请登录后再操作");
teacherOpenCourseQuestionSettingQuery.setUserId(coreUser.getId());
teacherOpenCourseQuestionSettingQuery.setOrgId(coreUser.getOrgId());
teacherOpenCourseQuestionSettingService.addByMergeQuestion(teacherOpenCourseQuestionSettingQuery, new HashMap<>(1));
teacherOpenCourseQuestionSettingService.addSettingByOpenCourse(teacherOpenCourseQuestionSettingQuery, new HashMap<>(1));
return JsonResult.success();
}

@ -23,6 +23,8 @@ public class ResourcesQuestionSnapshotQuery extends PageParam {
private Long teacherOpenCourseQuestionSettingId;
@Query(name = "开课课程ID", display = false)
private Long teacherOpenCourseMergeCourseInfoId;
@Query(name = "开课题目ID", display = false)
private Long teacherOpenCourseMergeResourcesQuestionId;
@Query(name = "题型(1单选 2多选 3判断)", display = false)
private Integer questionType;
@Query(name = "分值", display = false)
@ -53,6 +55,7 @@ public class ResourcesQuestionSnapshotQuery extends PageParam {
private String resourcesQuestionSnapshotIdPlural;
private String teacherOpenCourseQuestionSettingIdPlural;
private String teacherOpenCourseMergeCourseInfoIdPlural;
private String teacherOpenCourseMergeResourcesQuestionIdPlural;
private String questionTypePlural;
private String questionStatusPlural;
private String userIdPlural;
@ -70,6 +73,7 @@ public class ResourcesQuestionSnapshotQuery extends PageParam {
pojo.setResourcesQuestionSnapshotId(this.getResourcesQuestionSnapshotId());
pojo.setTeacherOpenCourseQuestionSettingId(this.getTeacherOpenCourseQuestionSettingId());
pojo.setTeacherOpenCourseMergeCourseInfoId(this.getTeacherOpenCourseMergeCourseInfoId());
pojo.setTeacherOpenCourseMergeResourcesQuestionId(this.getTeacherOpenCourseMergeResourcesQuestionId());
pojo.setQuestionType(this.getQuestionType());
pojo.setQuestionScore(this.getQuestionScore());
pojo.setQuestionStem(this.getQuestionStem());

@ -10,6 +10,7 @@ import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.util.Date;
@ -21,6 +22,7 @@ import static cn.hutool.core.date.DateUtil.offset;
*
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper=false)
public class TeacherOpenCourseQuestionSettingQuery extends PageParam {
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
@ -80,7 +82,7 @@ public class TeacherOpenCourseQuestionSettingQuery extends PageParam {
* {@link TeacherOpenCourseMergeResourcesQuestion#getTeacherOpenCourseMergeCourseInfoId()}
*
*/
// private String resourcesQuestionIdPlural;
private String resourcesQuestionIdPlural;
private String teacherOpenCourseQuestionSettingIdPlural;
private String teacherOpenCourseIdPlural;

@ -23,10 +23,16 @@ queryByCondition
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)){
and t.course_info_id =#teacherOpenCourseMergeCourseInfoId#
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@ -104,11 +110,18 @@ queryByConditionQuery
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)){
and t.course_info_id =#teacherOpenCourseMergeCourseInfoId#
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@}
@ -203,9 +216,16 @@ updateGivenByIds
@}
@if(contain("teacherOpenCourseMergeCourseInfoId",_given)){
@if(isEmpty(teacherOpenCourseMergeCourseInfoId)){
course_info_id = null ,
teacher_open_course_merge_course_info_id = null ,
@}else{
teacher_open_course_merge_course_info_id = #teacherOpenCourseMergeCourseInfoId# ,
@}
@}
@if(contain("teacherOpenCourseMergeResourcesQuestionId",_given)){
@if(isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
teacher_open_course_merge_resources_question_id = null ,
@}else{
course_info_id = #teacherOpenCourseMergeCourseInfoId# ,
teacher_open_course_merge_resources_question_id = #teacherOpenCourseMergeResourcesQuestionId# ,
@}
@}
@if(contain("questionType",_given)){
@ -319,7 +339,10 @@ getResourcesQuestionSnapshotValues
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)){
and t.course_info_id =#teacherOpenCourseMergeCourseInfoId#
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@ -383,11 +406,18 @@ getValuesByQuery
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)){
and t.course_info_id =#teacherOpenCourseMergeCourseInfoId#
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@}
@ -479,5 +509,5 @@ questionTestResults
AND CONCAT( td.student_sn, td.student_name ) LIKE #'%' + studentSnOrStudentName + '%'#
@}
@if(!isEmpty(chapterId)) {
AND t.course_info_id = #chapterId#
AND t.teacher_open_course_merge_course_info_id = #chapterId#
@}
Loading…
Cancel
Save