Commit e6615292 authored by YangZhaoJun1's avatar YangZhaoJun1

Merge branch 'master' of http://103.249.252.109:90/lcy/education

parents 29523757 c5b78cd3
......@@ -6,6 +6,7 @@ import com.sun.org.apache.regexp.internal.RE;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.map.HashedMap;
import org.json.JSONArray;
import org.rcisoft.business.tquestion.entity.TQuestionOptions;
import org.rcisoft.business.tquestion.service.impl.TQuestionServiceImpl;
......@@ -149,4 +150,22 @@ public class TQuestionController extends PaginationController<TQuestion> {
MessageConstant.MESSAGE_ALERT_ERROR,
tQuestionServiceImpl.queryTQestionById(BusinessId));
}
@ApiOperation(value="根据条件查询试题", notes="根据条件查询试题")
@GetMapping(value = "/queryQuestionsByChap_IdAndQtype")
public Result queryBChapters(String chapterId) {
Map<String, Object> map = new HashedMap();
String s = new String();
map.put("List1",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "1"));
map.put("List2",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "2"));
map.put("List3",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "3"));
s = "NumOf1 : "+tQuestionServiceImpl.queryNumByType("1")+
"NumOf2 : "+tQuestionServiceImpl.queryNumByType("2")+
"NumOf3 : "+tQuestionServiceImpl.queryNumByType("3");
map.put("Num",s);
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
map);
}
}
......@@ -48,5 +48,22 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> {
"( #{item.businessId},#{item.qid},#{item.represent},#{item.alias})" +
"</foreach></script>")
int insertOptionsList(List<TQuestionOptions> optionList);
@Select("<script>select q.qtitle,q.qdesc,qo.alias,qo.describe"
+"from t_paper_chapter pc"
+"left join t_paper_chapter_section pcs on pcs.pc_id = pc.business_id"
+"left join t_paper p on p.pc_id = pc.business_id"
+"left join t_paper_detail pd on pd.p_id = p.business_id"
+"left join t_paper_section ps on ps.business_id = pd.ps_id"
+"left join t_question q on q.business_id = pd.q_id"
+"left join t_question_options qo on qo.qid = q.business_id"
+"where pc.chap_id = #{chapterId} and q.qtype = #{qtype}</script>"
)
@ResultMap(value = "BaseResultMap" )
List<TQuestion> queryQuestionsByChap_IdAndQtype( @Param("chapterId") String chapterId, @Param("qtype") String qtype);
@Select("<script>select q_num from t_paper_chapter_section where q_type = #{qtype}<script>")
String queryNumByType(String qtype);
}
......@@ -54,4 +54,14 @@ public interface TQuestionService {
int removeByIds(String idInfoList);
TQuestion queryTQestionById(String businessId);
/**
* 根据章节ID和题目类型查询题目
* @param chapterId
* @param qtype
* @return
*/
List<TQuestion> queryQuestionsByChap_IdAndQtype(String chapterId, String qtype);
String queryNumByType(String s);
}
......@@ -3,6 +3,8 @@ package org.rcisoft.business.tquestion.service.impl;
import com.google.gson.Gson;
import org.apache.commons.collections.MapUtils;
import org.json.JSONArray;
import org.rcisoft.business.tpaper.dao.TPaperRepository;
import org.rcisoft.business.tpaperchapter.entity.TPaperChapter;
import org.rcisoft.business.tquestion.dao.TQuestionOptionsRepository;
import org.rcisoft.business.tquestion.entity.TQuestionOptions;
import org.rcisoft.core.constant.MessageConstant;
......@@ -154,5 +156,16 @@ public class TQuestionServiceImpl implements TQuestionService {
return tQuestion;
}
@Override
public List<TQuestion> queryQuestionsByChap_IdAndQtype(String chapterId, String qtype) {
return tQuestionRepository.queryQuestionsByChap_IdAndQtype(chapterId,qtype);
}
@Override
public String queryNumByType(String qtype) {
return tQuestionRepository.queryNumByType(qtype);
}
}
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