ccj 2 年 前
コミット
0448db8720

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CostManagementInfoServiceImpl.java

@@ -64,6 +64,13 @@ public class CostManagementInfoServiceImpl extends ServiceImpl<CostManagementInf
 //        List<CostManagementInfo> costManagementInfoList = this.selectList(costManagementInfoWrapper);
         Map<String, Object> pageView = new HashMap<>();
         pageView.put("compId",compId);
+        if(AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null){
+            String userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
+            //洮南瀚城合营人员查看
+            if("647b84ee01044e2a8d4fdc1943ce3d01,23eff8bab2ed4af38a1be1315ce7046d,d958ef5aa62849039802356a63f6e7ca".contains(userId)){
+                pageView.put("jointVentureParties","洮南市二龙乡瀚城农产品有限公司");
+            }
+        }
         List<CostManagementInfo> costManagementInfoList = baseMapper.getListByCondition(pageView);
         return costManagementInfoList;
     }

+ 24 - 12
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CostManagementInfoMapper.xml

@@ -4,18 +4,30 @@
 
     <select id="getListByCondition" resultType="com.yh.saas.plugin.yiliangyiyun.entity.CostManagementInfo">
         SELECT
-            wo.warehouse_name as warehouseName,
-            wo.goods_name as goodsName,
-            SUM(wo.surplus_weight) as storage,
-            ROUND(AVG(wo.avg_cost),3 )as cost
+            wbi.warehouse_name AS warehouseName,
+            wpsi.goods_name AS goodsName,
+            wpsi.`storage` AS STORAGE,
+            ROUND(AVG(wo.avg_cost), 3) AS cost
         FROM
-            warehousing_order wo
-        left join warehouse_base_info wbi on wbi.warehouse_name = wo.warehouse_name and wbi.warehouse_type = 1
-        WHERE
-            wo.delete_flag = 0
-        AND wo.surplus_weight > 0
-        and wbi.delete_flag = 0
-        and wo.comp_id = #{compId}
-        GROUP BY wo.goods_name,wo.warehouse_name
+            warehouse_base_info wbi
+        LEFT JOIN warehousing_order wo ON wbi.warehouse_name = wo.warehouse_name
+        AND wo.delete_flag = 0
+        AND wbi.comp_id = wo.comp_id
+        LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id
+        AND wpi.delete_flag = 0
+        LEFT JOIN warehouse_position_storage_info wpsi ON wpsi.position_id = wpi.id
+        AND wpsi.delete_flag = 0
+        AND wpsi.goods_name = wo.goods_name
+        WHERE 1=1
+        and wpsi.`storage` > 0
+        AND wbi.warehouse_type = 1
+        AND wbi.delete_flag = 0
+        AND wbi.comp_id =#{compId}
+        <if test="jointVentureParties != null">
+            AND wbi.joint_venture_parties = #{jointVentureParties}
+        </if>
+        GROUP BY
+            wpsi.goods_name,
+            wbi.warehouse_name
     </select>
 </mapper>