于继渤 1 год назад
Родитель
Сommit
b522f43a64
1 измененных файлов с 28 добавлено и 2 удалено
  1. 28 2
      src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

+ 28 - 2
src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

@@ -743,6 +743,9 @@
         tpii.cost_price  AS "costPrice",
         tpii.cost_amt  AS "costAmt",
         tmgs.brand_id AS "brandId",
+        tmgs.sku_images AS "skuImages",
+        tmgb.brand_name  as "brandName",
+        tmgb.short_name  as "shortName",
         json_agg(json_build_object(
         'itemId', tpii.item_id,
         'intoId', tpii.into_id,
@@ -759,7 +762,9 @@
         )) AS "itemList"
         FROM
         dkic_b.t_psi_inbound_item tpii
+        LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
         LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
+        left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         <where>
             tpii.cost_price = 0
             AND tpii.into_qty != 0
@@ -773,6 +778,12 @@
             <if test="brandId != null">
                 AND tmgs.brand_id = #{brandId}::uuid
             </if>
+            <if test="intoDateStart != null">
+                AND tpi.into_date &gt;= #{intoDateStart}::timestamp with time zone
+            </if>
+            <if test="intoDateEnd != null">
+                AND tpi.into_date &lt; #{intoDateEnd}::timestamp with time zone + interval '1 day'
+            </if>
             <if test="viewNoCostDocuments !=null and viewNoCostDocuments == true">
                 AND tpii.flg_cost_check = false
             </if>
@@ -790,7 +801,10 @@
         tpii.sku_id,
         tpii.cost_price,
         tpii.cost_amt,
-        tmgs.brand_id
+        tmgs.brand_id,
+        tmgs.sku_images,
+        tmgb.brand_name,
+        tmgb.short_name
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
@@ -805,7 +819,9 @@
         ( 1 )
         FROM
         dkic_b.t_psi_inbound_item tpii
+        LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
         LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
+        left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         <where>
             tpii.cost_price = 0
             AND tpii.into_qty != 0
@@ -819,6 +835,12 @@
             <if test="brandId != null">
                 AND tmgs.brand_id = #{brandId}::uuid
             </if>
+            <if test="intoDateStart != null">
+                AND tpi.into_date &gt;= #{intoDateStart}::timestamp with time zone
+            </if>
+            <if test="intoDateEnd != null">
+                AND tpi.into_date &lt; #{intoDateEnd}::timestamp with time zone + interval '1 day'
+            </if>
             <if test="viewNoCostDocuments !=null and viewNoCostDocuments == true">
                 AND tpii.flg_cost_check = false
             </if>
@@ -837,7 +859,11 @@
         tpii.sku_name,
         tpii.sku_id,
         tpii.cost_price,
-        tpii.cost_amt ) AS "a"
+        tpii.cost_amt,
+        tmgs.brand_id,
+        tmgs.sku_images,
+        tmgb.brand_name,
+        tmgb.short_name ) AS "a"
 
 
     </select>