Browse Source

优化报表误差

java110 2 years ago
parent
commit
43bb85ea50

+ 3 - 5
java110-db/src/main/resources/mapper/community/RoomV1ServiceDaoImplMapper.xml

@@ -60,8 +60,8 @@
         <if test="roomArea !=null and roomArea != ''">
             and t.room_area= #{roomArea}
         </if>
-        <if test="userId !=null and userId != ''">
-            and t.user_id= #{userId}
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
         </if>
         <if test="roomId !=null and roomId != ''">
             and t.room_id= #{roomId}
@@ -93,9 +93,7 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
-        <if test="communityId !=null and communityId != ''">
-            and t.community_id= #{communityId}
-        </if>
+
         <if test="apartment !=null and apartment != ''">
             and t.apartment= #{apartment}
         </if>

+ 3 - 2
java110-db/src/main/resources/mapper/user/QuestionTitleValueV1ServiceDaoImplMapper.xml

@@ -115,8 +115,9 @@
     </select>
 
     <select id="queryQuestionOwnerTitleValues" parameterType="Map" resultType="Map">
-        select qa.qa_id qaId,t.qa_value qaValue,t.seq,count(1) personCount
+        select qt.title_type titleType,qa.qa_id qaId,t.qa_value qaValue,t.seq,count(uqav.user_qa_id) personCount
         from question_title_value t
+        inner join question_title qt on t.title_id = qt.title_id and qt.status_cd = '0'
         inner join question_answer_title_rel qatr on t.title_id = qatr.title_id and qatr.status_cd = '0'
         inner join question_answer qa on qatr.qa_id = qa.qa_id and qa.status_cd = '0'
         left join user_question_answer_value uqav on qa.qa_id = uqav.qa_id and t.value_id = uqav.value_id and t.title_id = uqav.title_id and uqav.status_cd = '0'
@@ -134,7 +135,7 @@
                 #{item}
             </foreach>
         </if>
-        group by qa.qa_id,t.qa_value,t.seq
+        group by qt.title_type,qa.qa_id,t.qa_value,t.seq
         order by t.seq
 
 

+ 1 - 1
service-user/src/main/java/com/java110/user/cmd/question/ListOwnerVoteCmd.java

@@ -47,7 +47,7 @@ public class ListOwnerVoteCmd extends Cmd {
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
 
         QuestionAnswerDto questionAnswerDto = BeanConvertUtil.covertBean(reqJson, QuestionAnswerDto.class);
-
+        questionAnswerDto.setQaType(QuestionAnswerDto.QA_TYPE_VOTE);
         int count = questionAnswerV1InnerServiceSMOImpl.queryQuestionAnswersCount(questionAnswerDto);
 
         List<QuestionAnswerDto> questionAnswerDtos = null;