yangzian 3 лет назад
Родитель
Сommit
6bae671841

+ 36 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/ReportSettlementMapper.xml

@@ -278,6 +278,7 @@
 
     <!-- 查询 头条利润表  返点类型和比列-->
     <select id="getProfitBytedance" resultType="java.util.LinkedHashMap">
+<!--
 
         SELECT
         pp.create_user_id,
@@ -306,6 +307,41 @@
         <if test="endTime !=null and endTime != ''">
             AND (cp.policy_end_date &gt;= #{startTime} or cp.policy_end_date &lt;= #{endTime})
         </if>
+
+-->
+
+        SELECT t.* from (
+        SELECT
+        cp.rebate_type AS rebateType,
+        cp.rebate_rate AS rebateRate,
+        cp.approved_status AS approvedStatus,
+        min(r.policy_date )as policyStartDate,
+        max(r.policy_date ) as policyEndDate,
+        cp.create_time as createTime
+        FROM
+        ctop_cwjs_policy_info cp
+        RIGHT JOIN ctop_cwjs_slettement_report r on r.policy_id = cp.id and r.advertiser_name = cp.advertiser_name
+        WHERE
+        cp.del_flag = 0
+        and cp.approved_status = 3
+        <if test="mediaType !=null and mediaType != ''">
+            AND cp.media_type = #{mediaType}
+        </if>
+        <if test="productName !=null and productName != ''">
+            AND r.product_name = #{productName}
+        </if>
+        GROUP BY r.policy_id
+        ) t
+<where>
+    <if test="startTime !=null and startTime != ''">
+        AND (t.policyStartDate &gt;= #{startTime} or t.policyStartDate &lt;= #{endTime})
+    </if>
+    <if test="endTime !=null and endTime != ''">
+        AND (t.policyEndDate &gt;= #{startTime} or t.policyEndDate &lt;= #{endTime})
+    </if>
+</where>
+
+
     </select>