Browse Source

查询答案

java110 5 years ago
parent
commit
0bccfbea6e

+ 12 - 1
java110-bean/src/main/java/com/java110/dto/questionAnswerTitle/QuestionAnswerTitleDto.java

@@ -1,9 +1,11 @@
 package com.java110.dto.questionAnswerTitle;
 package com.java110.dto.questionAnswerTitle;
 
 
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
+import com.java110.dto.questionAnswerTitleValue.QuestionAnswerTitleValueDto;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * @ClassName FloorDto
  * @ClassName FloorDto
@@ -20,7 +22,6 @@ public class QuestionAnswerTitleDto extends PageDto implements Serializable {
     public static final String TITLE_TYPE_QUESTIONS = "3003"; // 简答题
     public static final String TITLE_TYPE_QUESTIONS = "3003"; // 简答题
 
 
 
 
-
     private String titleType;
     private String titleType;
     private String titleId;
     private String titleId;
     private String objId;
     private String objId;
@@ -35,6 +36,8 @@ public class QuestionAnswerTitleDto extends PageDto implements Serializable {
 
 
     private String statusCd = "0";
     private String statusCd = "0";
 
 
+    private List<QuestionAnswerTitleValueDto> questionAnswerTitleValues;
+
 
 
     public String getTitleType() {
     public String getTitleType() {
         return titleType;
         return titleType;
@@ -116,4 +119,12 @@ public class QuestionAnswerTitleDto extends PageDto implements Serializable {
     public void setObjIds(String[] objIds) {
     public void setObjIds(String[] objIds) {
         this.objIds = objIds;
         this.objIds = objIds;
     }
     }
+
+    public List<QuestionAnswerTitleValueDto> getQuestionAnswerTitleValues() {
+        return questionAnswerTitleValues;
+    }
+
+    public void setQuestionAnswerTitleValues(List<QuestionAnswerTitleValueDto> questionAnswerTitleValues) {
+        this.questionAnswerTitleValues = questionAnswerTitleValues;
+    }
 }
 }

+ 37 - 16
java110-bean/src/main/java/com/java110/dto/questionAnswerTitleValue/QuestionAnswerTitleValueDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.questionAnswerTitleValue;
 package com.java110.dto.questionAnswerTitleValue;
 
 
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -15,11 +16,12 @@ import java.util.Date;
 public class QuestionAnswerTitleValueDto extends PageDto implements Serializable {
 public class QuestionAnswerTitleValueDto extends PageDto implements Serializable {
 
 
     private String valueId;
     private String valueId;
-private String titleId;
-private String objId;
-private String objType;
-private String qaValue;
-private String seq;
+    private String titleId;
+    private String[] titleIds;
+    private String objId;
+    private String objType;
+    private String qaValue;
+    private String seq;
 
 
 
 
     private Date createTime;
     private Date createTime;
@@ -30,37 +32,48 @@ private String seq;
     public String getValueId() {
     public String getValueId() {
         return valueId;
         return valueId;
     }
     }
-public void setValueId(String valueId) {
+
+    public void setValueId(String valueId) {
         this.valueId = valueId;
         this.valueId = valueId;
     }
     }
-public String getTitleId() {
+
+    public String getTitleId() {
         return titleId;
         return titleId;
     }
     }
-public void setTitleId(String titleId) {
+
+    public void setTitleId(String titleId) {
         this.titleId = titleId;
         this.titleId = titleId;
     }
     }
-public String getObjId() {
+
+    public String getObjId() {
         return objId;
         return objId;
     }
     }
-public void setObjId(String objId) {
+
+    public void setObjId(String objId) {
         this.objId = objId;
         this.objId = objId;
     }
     }
-public String getObjType() {
+
+    public String getObjType() {
         return objType;
         return objType;
     }
     }
-public void setObjType(String objType) {
+
+    public void setObjType(String objType) {
         this.objType = objType;
         this.objType = objType;
     }
     }
-public String getQaValue() {
+
+    public String getQaValue() {
         return qaValue;
         return qaValue;
     }
     }
-public void setQaValue(String qaValue) {
+
+    public void setQaValue(String qaValue) {
         this.qaValue = qaValue;
         this.qaValue = qaValue;
     }
     }
-public String getSeq() {
+
+    public String getSeq() {
         return seq;
         return seq;
     }
     }
-public void setSeq(String seq) {
+
+    public void setSeq(String seq) {
         this.seq = seq;
         this.seq = seq;
     }
     }
 
 
@@ -80,4 +93,12 @@ public void setSeq(String seq) {
     public void setStatusCd(String statusCd) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
+
+    public String[] getTitleIds() {
+        return titleIds;
+    }
+
+    public void setTitleIds(String[] titleIds) {
+        this.titleIds = titleIds;
+    }
 }
 }

+ 95 - 86
java110-db/src/main/resources/mapper/user/QuestionAnswerTitleValueServiceDaoImplMapper.xml

@@ -5,111 +5,120 @@
 <mapper namespace="questionAnswerTitleValueServiceDaoImpl">
 <mapper namespace="questionAnswerTitleValueServiceDaoImpl">
 
 
 
 
-
-
-
     <!-- 保存答卷选项信息 add by wuxw 2018-07-03 -->
     <!-- 保存答卷选项信息 add by wuxw 2018-07-03 -->
     <insert id="saveQuestionAnswerTitleValueInfo" parameterType="Map">
     <insert id="saveQuestionAnswerTitleValueInfo" parameterType="Map">
         insert into question_answer_title_value(
         insert into question_answer_title_value(
-value_id,title_id,obj_id,obj_type,qa_value,seq
-) values (
-#{valueId},#{titleId},#{objId},#{objType},#{qaValue},#{seq}
-)
+        value_id,title_id,obj_id,obj_type,qa_value,seq
+        ) values (
+        #{valueId},#{titleId},#{objId},#{objType},#{qaValue},#{seq}
+        )
     </insert>
     </insert>
 
 
 
 
-
     <!-- 查询答卷选项信息 add by wuxw 2018-07-03 -->
     <!-- 查询答卷选项信息 add by wuxw 2018-07-03 -->
     <select id="getQuestionAnswerTitleValueInfo" parameterType="Map" resultType="Map">
     <select id="getQuestionAnswerTitleValueInfo" parameterType="Map" resultType="Map">
-        select  t.value_id,t.value_id valueId,t.title_id,t.title_id titleId,t.obj_id,t.obj_id objId,t.status_cd,t.status_cd statusCd,t.obj_type,t.obj_type objType,t.qa_value,t.qa_value qaValue,t.seq 
-from question_answer_title_value t 
-where 1 =1 
-<if test="valueId !=null and valueId != ''">
-   and t.value_id= #{valueId}
-</if> 
-<if test="titleId !=null and titleId != ''">
-   and t.title_id= #{titleId}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
-<if test="qaValue !=null and qaValue != ''">
-   and t.qa_value= #{qaValue}
-</if> 
-<if test="seq !=null and seq != ''">
-   and t.seq= #{seq}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.value_id,t.value_id valueId,t.title_id,t.title_id titleId,t.obj_id,t.obj_id
+        objId,t.status_cd,t.status_cd statusCd,t.obj_type,t.obj_type objType,t.qa_value,t.qa_value qaValue,t.seq
+        from question_answer_title_value t
+        where 1 =1
+        <if test="valueId !=null and valueId != ''">
+            and t.value_id= #{valueId}
+        </if>
+        <if test="titleId !=null and titleId != ''">
+            and t.title_id= #{titleId}
+        </if>
+
+        <if test="titleIds !=null">
+            and t.title_id in
+            <foreach collection="titleIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
+        <if test="qaValue !=null and qaValue != ''">
+            and t.qa_value= #{qaValue}
+        </if>
+        <if test="seq !=null and seq != ''">
+            and t.seq= #{seq}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
 
     </select>
     </select>
 
 
 
 
-
-
     <!-- 修改答卷选项信息 add by wuxw 2018-07-03 -->
     <!-- 修改答卷选项信息 add by wuxw 2018-07-03 -->
     <update id="updateQuestionAnswerTitleValueInfo" parameterType="Map">
     <update id="updateQuestionAnswerTitleValueInfo" parameterType="Map">
-        update  question_answer_title_value t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="titleId !=null and titleId != ''">
-, t.title_id= #{titleId}
-</if> 
-<if test="objId !=null and objId != ''">
-, t.obj_id= #{objId}
-</if> 
-<if test="objType !=null and objType != ''">
-, t.obj_type= #{objType}
-</if> 
-<if test="qaValue !=null and qaValue != ''">
-, t.qa_value= #{qaValue}
-</if> 
-<if test="seq !=null and seq != ''">
-, t.seq= #{seq}
-</if> 
- where 1=1 <if test="valueId !=null and valueId != ''">
-and t.value_id= #{valueId}
-</if> 
+        update question_answer_title_value t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="titleId !=null and titleId != ''">
+            , t.title_id= #{titleId}
+        </if>
+        <if test="objId !=null and objId != ''">
+            , t.obj_id= #{objId}
+        </if>
+        <if test="objType !=null and objType != ''">
+            , t.obj_type= #{objType}
+        </if>
+        <if test="qaValue !=null and qaValue != ''">
+            , t.qa_value= #{qaValue}
+        </if>
+        <if test="seq !=null and seq != ''">
+            , t.seq= #{seq}
+        </if>
+        where 1=1
+        <if test="valueId !=null and valueId != ''">
+            and t.value_id= #{valueId}
+        </if>
 
 
     </update>
     </update>
 
 
     <!-- 查询答卷选项数量 add by wuxw 2018-07-03 -->
     <!-- 查询答卷选项数量 add by wuxw 2018-07-03 -->
-     <select id="queryQuestionAnswerTitleValuesCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from question_answer_title_value t 
-where 1 =1 
-<if test="valueId !=null and valueId != ''">
-   and t.value_id= #{valueId}
-</if> 
-<if test="titleId !=null and titleId != ''">
-   and t.title_id= #{titleId}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
-<if test="qaValue !=null and qaValue != ''">
-   and t.qa_value= #{qaValue}
-</if> 
-<if test="seq !=null and seq != ''">
-   and t.seq= #{seq}
-</if> 
+    <select id="queryQuestionAnswerTitleValuesCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from question_answer_title_value t
+        where 1 =1
+        <if test="valueId !=null and valueId != ''">
+            and t.value_id= #{valueId}
+        </if>
+        <if test="titleId !=null and titleId != ''">
+            and t.title_id= #{titleId}
+        </if>
+        <if test="titleIds !=null">
+            and t.title_id in
+            <foreach collection="titleIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
+        <if test="qaValue !=null and qaValue != ''">
+            and t.qa_value= #{qaValue}
+        </if>
+        <if test="seq !=null and seq != ''">
+            and t.seq= #{seq}
+        </if>
 
 
 
 
-     </select>
+    </select>
 
 
 </mapper>
 </mapper>

+ 38 - 0
service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/impl/GetQuestionAnswerTitleBMOImpl.java

@@ -1,7 +1,9 @@
 package com.java110.user.bmo.questionAnswerTitle.impl;
 package com.java110.user.bmo.questionAnswerTitle.impl;
 
 
 import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto;
 import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto;
+import com.java110.dto.questionAnswerTitleValue.QuestionAnswerTitleValueDto;
 import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO;
 import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO;
+import com.java110.intf.user.IQuestionAnswerTitleValueInnerServiceSMO;
 import com.java110.user.bmo.questionAnswerTitle.IGetQuestionAnswerTitleBMO;
 import com.java110.user.bmo.questionAnswerTitle.IGetQuestionAnswerTitleBMO;
 import com.java110.vo.ResultVo;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +20,9 @@ public class GetQuestionAnswerTitleBMOImpl implements IGetQuestionAnswerTitleBMO
     @Autowired
     @Autowired
     private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl;
     private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl;
 
 
+    @Autowired
+    private IQuestionAnswerTitleValueInnerServiceSMO questionAnswerTitleValueInnerServiceSMOImpl;
+
     /**
     /**
      * @param questionAnswerTitleDto
      * @param questionAnswerTitleDto
      * @return 订单服务能够接受的报文
      * @return 订单服务能够接受的报文
@@ -30,6 +35,8 @@ public class GetQuestionAnswerTitleBMOImpl implements IGetQuestionAnswerTitleBMO
         List<QuestionAnswerTitleDto> questionAnswerTitleDtos = null;
         List<QuestionAnswerTitleDto> questionAnswerTitleDtos = null;
         if (count > 0) {
         if (count > 0) {
             questionAnswerTitleDtos = questionAnswerTitleInnerServiceSMOImpl.queryQuestionAnswerTitles(questionAnswerTitleDto);
             questionAnswerTitleDtos = questionAnswerTitleInnerServiceSMOImpl.queryQuestionAnswerTitles(questionAnswerTitleDto);
+
+            refreshTitileValues(questionAnswerTitleDtos);
         } else {
         } else {
             questionAnswerTitleDtos = new ArrayList<>();
             questionAnswerTitleDtos = new ArrayList<>();
         }
         }
@@ -41,4 +48,35 @@ public class GetQuestionAnswerTitleBMOImpl implements IGetQuestionAnswerTitleBMO
         return responseEntity;
         return responseEntity;
     }
     }
 
 
+    private void refreshTitileValues(List<QuestionAnswerTitleDto> questionAnswerTitleDtos) {
+
+        if (questionAnswerTitleDtos == null || questionAnswerTitleDtos.size() < 1) {
+            return;
+        }
+
+        List<String> titleIds = new ArrayList<>();
+        for (QuestionAnswerTitleDto questionAnswerTitleDto : questionAnswerTitleDtos) {
+            titleIds.add(questionAnswerTitleDto.getTitleId());
+        }
+
+        QuestionAnswerTitleValueDto questionAnswerTitleValueDto = new QuestionAnswerTitleValueDto();
+        questionAnswerTitleValueDto.setTitleIds(titleIds.toArray(new String[titleIds.size()]));
+        questionAnswerTitleValueDto.setObjId(questionAnswerTitleDtos.get(0).getObjId());
+        List<QuestionAnswerTitleValueDto> questionAnswerTitleValueDtos
+                = questionAnswerTitleValueInnerServiceSMOImpl.queryQuestionAnswerTitleValues(questionAnswerTitleValueDto);
+
+        List<QuestionAnswerTitleValueDto> tmpQuestionAnswerTitleValueDtos = null;
+        for (QuestionAnswerTitleDto questionAnswerTitleDto : questionAnswerTitleDtos) {
+            tmpQuestionAnswerTitleValueDtos = new ArrayList<>();
+            for (QuestionAnswerTitleValueDto questionAnswerTitleValueDto1 : questionAnswerTitleValueDtos) {
+                if (questionAnswerTitleDto.getTitleId().equals(questionAnswerTitleValueDto1.getTitleId())) {
+                    tmpQuestionAnswerTitleValueDtos.add(questionAnswerTitleValueDto1);
+                }
+            }
+            questionAnswerTitleDto.setQuestionAnswerTitleValues(tmpQuestionAnswerTitleValueDtos);
+        }
+
+
+    }
+
 }
 }