diff --git a/admin-core/src/main/resources/templates/index.html b/admin-core/src/main/resources/templates/index.html index 8c3b043c..714ebedc 100644 --- a/admin-core/src/main/resources/templates/index.html +++ b/admin-core/src/main/resources/templates/index.html @@ -356,6 +356,10 @@ /*院校登录logo*/ logoShow(); + var data = Common.postAjax("/api/resourcesQuestion/questionTypeGroupInfo.do"); + + console.log(data) + function logoShow(){ var ret = Common.getAjax('/api/base/getUniInfo.do'); if(!$.isEmpty(ret.data)){ diff --git a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionDao.java b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionDao.java index cb38ba4a..a5981208 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionDao.java @@ -9,6 +9,7 @@ import com.ibeetl.jlw.web.query.CourseInfoQuery; import com.ibeetl.jlw.web.query.ResourcesQuestionQuery; import org.beetl.sql.core.engine.PageQuery; import org.beetl.sql.mapper.BaseMapper; +import org.beetl.sql.mapper.annotation.Param; import org.beetl.sql.mapper.annotation.SqlResource; import org.beetl.sql.mapper.annotation.Update; import org.springframework.stereotype.Repository; @@ -32,10 +33,11 @@ public interface ResourcesQuestionDao extends BaseMapper{ List getValuesByQueryNotWithPermission(ResourcesQuestionQuery resourcesQuestionQuery); /** * 根据课程ID获取下面的题目类型和类型下的总题数 - * @param courseInfoId + * @param courseInfoQuery + * @param courseLabelTypePlural * @return */ - List getGroupQuestionTypeCount(Long courseInfoId); + List getGroupQuestionTypeCount(CourseInfoQuery courseInfoQuery, @Param("courseLabelTypePlural") String courseLabelTypePlural); int checkUnique(ResourcesQuestion question); diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java index 87d27068..96b9ad46 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java @@ -43,7 +43,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Nullable; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.*; @@ -787,11 +786,19 @@ public class ResourcesQuestionService extends CoreBaseService /** * 根据开课ID获取下面的题目类型和类型下的总题数 - * @param courseInfoId 可为空 + * @param courseInfoQuery * @return */ - public List getGroupQuestionTypeCount(@Nullable Long courseInfoId) { - List g = resourcesQuestionDao.getGroupQuestionTypeCount(courseInfoId); + public List getGroupQuestionTypeCount(CourseInfoQuery courseInfoQuery) { + List g = resourcesQuestionDao.getGroupQuestionTypeCount(courseInfoQuery, null); + dictParser(g); + return g; + } + + public List getTheoryCourseQuestionTypeGroupInfo(String orgIdPlural, String courseLabelTypePlural) { + CourseInfoQuery courseInfoQuery = new CourseInfoQuery(); + courseInfoQuery.setOrgIdPlural(orgIdPlural); + List g = resourcesQuestionDao.getGroupQuestionTypeCount(courseInfoQuery, courseLabelTypePlural); dictParser(g); return g; } @@ -1142,4 +1149,5 @@ public class ResourcesQuestionService extends CoreBaseService } return res; } + } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java index 34cf012a..ebf7dd79 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java @@ -646,14 +646,14 @@ public class ResourcesQuestionController{ /** * 查询题目类型下的题目数量 - * @param courseInfoId 课程章节ID 非必传 + * @param courseInfoQuery 课程信息 * @return */ @PostMapping(MODEL + "/questionTypeGroupInfo.json") @Function("resourcesQuestion.query") @ResponseBody - public JsonResult> questionTypeGroupInfo(@RequestParam(required = false) Long courseInfoId, @SCoreUser CoreUser coreUser) { - return JsonResult.success(resourcesQuestionService.getGroupQuestionTypeCount(courseInfoId)); + public JsonResult> questionTypeGroupInfo(CourseInfoQuery courseInfoQuery, @SCoreUser CoreUser coreUser) { + return JsonResult.success(resourcesQuestionService.getGroupQuestionTypeCount(courseInfoQuery)); } /** @@ -691,4 +691,30 @@ public class ResourcesQuestionController{ return JsonResult.success(resourcesQuestionService.importQuestionByWordTemplateType(fileEntityList, businessType, matchType, coreUser)); } + /** + * 教师端-题目配置页-题目设置-获取题目类型 + * @param courseInfoQuery 题目信息 + * @param coreUser + * @return + */ + @PostMapping(API + "/questionTypeGroupInfo2.do") + @ResponseBody + public JsonResult questionTypeGroupInfo2(CourseInfoQuery courseInfoQuery, @SCoreUser CoreUser coreUser) { + return JsonResult.success(resourcesQuestionService.getGroupQuestionTypeCount(courseInfoQuery)); + } + /** + * 教师端-题目配置页-题目设置-获取题目类型 + * 此接口只获取理论课程类的题目类型和数量 + * @param coreUser + * @return + */ + @PostMapping(API + "/questionTypeGroupInfo.do") + @ResponseBody + public JsonResult theoryCourseQuestionTypeGroupInfoDo(@SCoreUser CoreUser coreUser) { + + // 查询自己和超管上传的题目 + String orgIds = "1," + coreUser.getOrgId().toString(); + String courseLabelTypePlural = "理论课程类"; + return JsonResult.success(resourcesQuestionService.getTheoryCourseQuestionTypeGroupInfo(orgIds, courseLabelTypePlural)); + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/CourseInfoQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/CourseInfoQuery.java index 3d952f6c..f97fc932 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/CourseInfoQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/CourseInfoQuery.java @@ -72,6 +72,17 @@ public class CourseInfoQuery extends PageParam { // 课程章节ID多个逗号隔开 private String courseInfoIdPlural; + // 机构IDs + private String orgIdPlural; + + public String getOrgIdPlural() { + return orgIdPlural; + } + + public void setOrgIdPlural(String orgIdPlural) { + this.orgIdPlural = orgIdPlural; + } + public Long getCourseInfoId(){ return courseInfoId; } diff --git a/web/src/main/resources/sql/jlw/resourcesQuestion.md b/web/src/main/resources/sql/jlw/resourcesQuestion.md index 7a806391..94381190 100644 --- a/web/src/main/resources/sql/jlw/resourcesQuestion.md +++ b/web/src/main/resources/sql/jlw/resourcesQuestion.md @@ -377,12 +377,72 @@ getGroupQuestionTypeCount count( 1 ) AS total_count FROM resources_question t + left join course_info ta on ta.course_info_id = t.course_info_id + left join course_label tb on tb.course_label_id = ta.course_label_id WHERE 1 = 1 + AND ta.course_info_status = 1 AND t.question_status = 1 - @ // 开课ID + AND tb.course_label_status = 1 + @if(!isEmpty(courseLabelTypePlural)){ + and find_in_set(tb.course_label_type, #courseLabelTypePlural#) + @} + @if(!isEmpty(resourcesQuestionIds)){ + and find_in_set(t.resources_question_id,#resourcesQuestionIds#) + @} + @if(!isEmpty(resourcesQuestionId)){ + and t.resources_question_id =#resourcesQuestionId# + @} + @if(!isEmpty(courseInfoIds)){ + and find_in_set(t.course_info_id,#courseInfoIds#) + @} @if(!isEmpty(courseInfoId)){ - AND t.course_info_id = #courseInfoId# + and t.course_info_id =#courseInfoId# + @} + @if(!isEmpty(questionType)){ + and t.question_type =#questionType# + @} + @if(!isEmpty(questionStatus)){ + and t.question_status =#questionStatus# + @} + @if(!isEmpty(questionScore)){ + and t.question_score =#questionScore# + @} + @if(!isEmpty(questionStem)){ + and t.question_stem = #questionStem# + @} + @if(!isEmpty(questionOptionA)){ + and t.question_option_a =#questionOptionA# + @} + @if(!isEmpty(questionOptionB)){ + and t.question_option_b =#questionOptionB# + @} + @if(!isEmpty(questionOptionC)){ + and t.question_option_c =#questionOptionC# + @} + @if(!isEmpty(questionOptionD)){ + and t.question_option_d =#questionOptionD# + @} + @if(!isEmpty(questionOptionE)){ + and t.question_option_e =#questionOptionE# + @} + @if(!isEmpty(questionAnswer)){ + and t.question_answer =#questionAnswer# + @} + @if(!isEmpty(questionAnalysis)){ + and t.question_analysis =#questionAnalysis# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(ifnull(t.org_id, 1), #orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(addType)){ + and t.add_type =#addType# @} GROUP BY t.question_type