فهرست منبع

ExamTaskDetail去掉cardId

wangliang 2 سال پیش
والد
کامیت
85f60f9681

+ 5 - 3
distributed-print-business/src/main/resources/mapper/ExamCardMapper.xml

@@ -50,7 +50,7 @@
         FROM
             exam_card a
                 LEFT JOIN
-            exam_task_detail b ON a.id = b.card_id
+            exam_task_detail b ON FIND_IN_SET(a.id, REPLACE(substring_index(substring_index(CONVERT((b.paper_attachment_ids ->>'$[*].cardId') USING utf8), ']', 1), '[',-1),'"',''))
                 LEFT JOIN
             exam_task c ON b.exam_task_id = c.id
                 LEFT JOIN
@@ -105,7 +105,8 @@
                 LEFT JOIN
             exam_card_detail b ON a.id = b.card_id
                 LEFT JOIN
-            exam_task_detail c ON a.id = c.card_id
+            exam_task_detail c ON FIND_IN_SET(a.id, REPLACE(substring_index(substring_index(CONVERT((c.paper_attachment_ids ->>'$[*].cardId')
+                                                                                                    USING utf8), ']', 1), '[',-1),'"',''))
         where a.id = #{cardId}
     </select>
     <select id="listGenericCard" resultType="com.qmth.distributed.print.business.entity.ExamCard">
@@ -169,7 +170,8 @@
                 LEFT JOIN
             exam_task_detail b ON a.id = b.exam_task_id
                 LEFT JOIN
-            exam_card c ON b.card_id = c.id
+            exam_card c ON FIND_IN_SET(c.id, REPLACE(substring_index(substring_index(CONVERT((b.paper_attachment_ids ->>'$[*].cardId')
+                                                                                             USING utf8), ']', 1), '[',-1),'"',''))
                 LEFT JOIN
             exam_card_detail d ON c.id = d.card_id
         WHERE

+ 1 - 2
distributed-print-business/src/main/resources/mapper/ExamTaskDetailMapper.xml

@@ -8,7 +8,6 @@
         <result column="exam_task_id" property="examTaskId" />
         <result column="paper_type" property="paperType" />
         <result column="paper_attachment_ids" property="paperAttachmentIds" />
-        <result column="card_id" property="cardId" />
         <result column="paper_confirm_attachment_ids" property="paperConfirmAttachmentIds" />
         <result column="remark" property="remark" />
         <result column="exposed_paper_type" property="exposedPaperType" />
@@ -18,7 +17,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-       select id,exam_task_id, paper_type, paper_attachment_ids, card_id, paper_confirm_attachment_ids, remark, exposed_paper_type, relate_paper_type, unexposed_paper_type from exam_task_detail
+       select id,exam_task_id, paper_type, paper_attachment_ids, paper_confirm_attachment_ids, remark, exposed_paper_type, relate_paper_type, unexposed_paper_type from exam_task_detail
     </sql>
     <select id="listPage" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto">
         SELECT

+ 9 - 5
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -605,7 +605,7 @@
             h.name semesterName,
             case #{source} when 'REVIEW' then ifnull(c.paper_type, a.paper_type) else a.paper_type end paperType,
             case #{source} when 'REVIEW' then ifnull(c.paper_attachment_ids, a.paper_attachment_ids) else a.paper_attachment_ids end paperAttachmentIds,
-            case #{source} when 'REVIEW' then ifnull(c.card_id, a.card_id) else a.card_id end cardId,
+            case #{source} when 'REVIEW' then ifnull(c.card_id, b.card_id) else b.card_id end cardId,
             a.paper_confirm_attachment_ids paperConfirmAttachmentIds,
             a.remark,
             a.exposed_paper_type exposedPaperType,
@@ -622,7 +622,8 @@
                 LEFT JOIN
             exam_task_paper_log c ON a.exam_task_id = c.exam_task_id and c.review = false
                 LEFT JOIN
-            exam_card b ON a.card_id = b.id
+            exam_card b ON FIND_IN_SET(b.id, REPLACE(substring_index(substring_index(CONVERT((a.paper_attachment_ids ->>'$[*].cardId')
+                                                                                             USING utf8), ']', 1), '[',-1),'"',''))
                 left join
             exam_card d on c.card_id = d.id
                 left join
@@ -709,14 +710,16 @@
                 LEFT JOIN
             exam_task_detail b ON a.id = b.exam_task_id
         WHERE
-            b.card_id = #{cardId}
+            FIND_IN_SET(#{cardId}, REPLACE(substring_index(substring_index(CONVERT((b.paper_attachment_ids ->>'$[*].cardId')
+                                                                              USING utf8), ']', 1), '[',-1),'"',''))
     </select>
     <select id="listReviewSampleInfoByExamTaskId"
             resultType="com.qmth.distributed.print.business.bean.dto.ReviewSampleDto">
         SELECT
             IFNULL(log.paper_attachment_ids,
                    det.paper_attachment_ids) AS paperAttachmentIds,
-            IFNULL(log.card_id, det.card_id) AS cardId,
+            IFNULL(log.card_id, REPLACE(substring_index(substring_index(CONVERT((det.paper_attachment_ids ->>'$[*].cardId')
+                                                                                USING utf8), ']', 1), '[',-1)) AS cardId,
             det.paper_confirm_attachment_ids AS paperConfirmAttachmentIds
         FROM
             exam_task_detail det
@@ -1116,7 +1119,8 @@
             IFNULL(b.exposed_paper_type,'') exposedPaperType,
             IFNULL(b.unexposed_paper_type,'') unexposedPaperType,
             so.name orgName,
-            b.card_id examCardId,
+            REPLACE(substring_index(substring_index(CONVERT((b.paper_attachment_ids ->>'$[*].cardId')
+            USING utf8), ']', 1), '[',-1) examCardId,
             b.paper_attachment_ids paperAttachmentIds
         FROM
             exam_task a