瀏覽代碼

fix: 材料收集填写反馈的查询语句修改

zhangying 1 月之前
父節點
當前提交
27626d3606

+ 15 - 14
src/main/resources/mapping/QtTaskPubCQuery.xml

@@ -34,20 +34,21 @@
         </foreach>
     </insert>
     <select id="selectTaskReplyList" resultType="java.util.HashMap">
-        select * from ( select *from (
-               select rp.CONTENT,rp.REPLYIDENTITIES,col.orderby,rp.TASKPUBUSERID
-               from QT_TASKPUBCOLUMN col
-                      inner join QT_TASKREPLY rp
-                                 on col.TASKPUBCOLID = rp.TASKPUBCOLID and rp.TASKPUBUSERID = #{userid}
-                  where rp.TASKPUBID=#{taskpubid}
-                  order by rp.RECEIVEDATE desc
-             )  t  pivot(max(t.CONTENT) for orderby in(
-                <foreach collection="columnlist" item="it"  separator=",">
-                    '${it.orderby}'
-                </foreach>
-             ))
-        )tb1
-        order by tb1."'${orderbyColumn}'"
+        SELECT
+        <foreach collection="columnlist" item="it"  separator="," close=",">
+            MAX(CASE WHEN col.orderby = '${it.orderby}' THEN rp.CONTENT END) AS '${it.orderby}'
+        </foreach>
+        rp.REPLYIDENTITIES
+        FROM
+        QT_TASKPUBCOLUMN col
+        INNER JOIN QT_TASKREPLY rp ON col.TASKPUBCOLID = rp.TASKPUBCOLID
+        AND rp.TASKPUBUSERID = #{userid}
+        WHERE
+        rp.TASKPUBID = #{taskpubid}
+        GROUP BY
+        rp.REPLYIDENTITIES
+        ORDER BY
+        rp.RECEIVEDATE
     </select>
 
     <select id="selectTaskReplySummary" resultType="java.util.HashMap" >

+ 1 - 1
src/main/resources/static/app/main/taskpubmgr/taskreply/edit.html

@@ -69,7 +69,7 @@
                         <tbody>
                         <tr ng-repeat="it in replylist">
                             <td scope="row">{{$index+1}}</td>
-                            <td ng-repeat="cl in columnList">{{it["'"+cl.orderby+"'"]}}</td>
+                            <td ng-repeat="cl in columnList">{{it[cl.orderby.toString()]}}</td>
                             <td style="width: 120px;" ng-if="isDetail" class="text-center">
                                 <button class="btn td-btn bg-pink waves-effect" ng-if="isDetail"
                                         ng-click="edit(it.REPLYIDENTITIES)" title="删除">