Przeglądaj źródła

代储点粮情

lvzhikai 5 lat temu
rodzic
commit
349e78ffad

+ 9 - 6
src/main/java/com/chinaitop/depot/agent/temperature/mapper/BusinessAgentTemperatureMapper.xml

@@ -652,8 +652,8 @@
652 652
     depot.depot_id agentOrgId,
653 653
     depot.depot_id agentStoreOrgId,
654 654
     '0' sign,
655
-    depot.agent_depot_name agentName,
656
-    store.depot_name agentDepotName,
655
+    agent.agent_name agentName,
656
+    depot.agent_depot_name agentDepotName,
657 657
     store.storehouse_name storehouseName,
658 658
     tt.storehouse lspz,
659 659
     tt.time detectionTime,
@@ -676,11 +676,14 @@
676 676
     tt.updatetime updatetime
677 677
     FROM
678 678
     business_agent_depot depot
679
-    LEFT JOIN business_agent_storehouse agentStore ON depot.id = agentStore.agent_depot_id
680
-    AND agentStore.org_id = #{orgId,jdbcType=INTEGER}
681
-    LEFT JOIN basic_storehouse store ON store.storehouse_id = agentStore.storehouse_id
682
-    AND store.org_id = #{orgId,jdbcType=INTEGER}
679
+    LEFT JOIN business_agent agent ON depot.agent_id = agent.id
680
+    AND agent.org_id = #{orgId,jdbcType=INTEGER}
681
+    INNER JOIN business_agent_storehouse agentStore ON depot.id = agentStore.agent_depot_id
682
+    INNER JOIN basic_storehouse store ON store.storehouse_id = agentStore.storehouse_id
683
+    AND store.del_flag = 1
683 684
     LEFT JOIN t_testdata tt ON depot.depot_id = tt.org_id
685
+    AND tt.storehouse = store.storehouse_code
686
+    AND tt.org_id != #{orgId,jdbcType=INTEGER}
684 687
     AND tt.updatetime >= depot.updatetime
685 688
     WHERE
686 689
     tt.iLq_yq = '0'