|
|
@@ -126,7 +126,7 @@
|
|
126
|
126
|
</if>
|
|
127
|
127
|
</select>
|
|
128
|
128
|
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
|
|
129
|
|
- select
|
|
|
129
|
+ select
|
|
130
|
130
|
<include refid="Base_Column_List" />
|
|
131
|
131
|
,
|
|
132
|
132
|
<include refid="Blob_Column_List" />
|
|
|
@@ -588,72 +588,46 @@
|
|
588
|
588
|
</update>
|
|
589
|
589
|
|
|
590
|
590
|
<select id="getDataByExample" parameterType="java.util.Map" resultType="java.util.HashMap">
|
|
591
|
|
- SELECT
|
|
592
|
|
- temperAll.*
|
|
593
|
|
- FROM
|
|
594
|
|
- (
|
|
595
|
591
|
SELECT DISTINCT
|
|
596
|
|
- temper.id id,
|
|
597
|
|
- temper.org_id orgId,
|
|
598
|
592
|
depot.depot_id agentOrgId,
|
|
599
|
593
|
depot.depot_id agentStoreOrgId,
|
|
600
|
|
- '1' sign,
|
|
601
|
594
|
agent.agent_name agentName,
|
|
602
|
595
|
depot.agent_depot_name agentDepotName,
|
|
|
596
|
+ depot.updatetime,
|
|
603
|
597
|
store.storehouse_name storehouseName,
|
|
604
|
|
- temper.lspz lspz,
|
|
605
|
|
- temper.detection_time detectionTime,
|
|
606
|
|
- temper.house_temperature houseTemperature,
|
|
607
|
|
- temper.house_humidity houseHumidity,
|
|
608
|
|
- temper.max max,
|
|
609
|
|
- temper.min min,
|
|
610
|
|
- temper.avg avg,
|
|
611
|
598
|
store.storehouse_type storehouseType,
|
|
612
|
599
|
store.design_capacity designCapacity,
|
|
613
|
|
- temper.enter_time enterTime,
|
|
614
|
|
- temper.nature nature,
|
|
615
|
|
- temper.level level,
|
|
616
|
|
- temper.actual_amount actualAmount,
|
|
617
|
|
- temper.harvest_year harvestYear,
|
|
618
|
|
- temper.gas_temperature gasTemperature,
|
|
619
|
|
- temper.gas_humidity gasHumidity,
|
|
620
|
|
- temper.keeper keeper,
|
|
621
|
|
- temper.updatetime updatetime
|
|
|
600
|
+ store.storehouse_code storehouseCode,
|
|
|
601
|
+ store.storehouse_id storehouseId,
|
|
|
602
|
+ keeper.name keeper
|
|
622
|
603
|
FROM
|
|
623
|
|
- business_agent_temperature temper
|
|
624
|
|
- LEFT JOIN business_agent agent ON agent.id = temper.agent_id
|
|
|
604
|
+ business_agent_depot depot
|
|
|
605
|
+ LEFT JOIN business_agent agent ON depot.agent_id = agent.id
|
|
625
|
606
|
AND agent.org_id = #{orgId,jdbcType=INTEGER}
|
|
626
|
|
- LEFT JOIN business_agent_depot depot ON depot.id = temper.agent_depot_id
|
|
627
|
|
- AND depot.org_id = #{orgId,jdbcType=INTEGER}
|
|
628
|
|
- LEFT JOIN basic_storehouse store ON store.storehouse_id = temper.storehouse_id
|
|
629
|
|
- AND store.library_type = 1
|
|
630
|
|
- AND store.org_id = #{orgId,jdbcType=INTEGER}
|
|
631
|
|
- WHERE temper.org_id = #{orgId,jdbcType=INTEGER}
|
|
|
607
|
+ INNER JOIN business_agent_storehouse agentStore ON depot.id = agentStore.agent_depot_id
|
|
|
608
|
+ INNER JOIN basic_storehouse store ON store.storehouse_id = agentStore.storehouse_id
|
|
|
609
|
+ AND store.del_flag = 1
|
|
|
610
|
+ LEFT JOIN basic_keeper_house keepHouse ON keepHouse.house_Id = agentStore.storehouse_id
|
|
|
611
|
+ AND depot.depot_id = keepHouse.org_id
|
|
|
612
|
+ LEFT JOIN basic_keeper keeper ON keeper.id = keepHouse.keeper_Id
|
|
|
613
|
+ WHERE depot.org_id = #{orgId,jdbcType=INTEGER}
|
|
|
614
|
+ AND depot.del_flag = 1
|
|
632
|
615
|
<if test="agentId != null">
|
|
633
|
|
- AND temper.agent_id = #{agentId,jdbcType=INTEGER}
|
|
|
616
|
+ AND agent.id = #{agentId,jdbcType=INTEGER}
|
|
634
|
617
|
</if>
|
|
635
|
618
|
<if test="agentDepotId != null">
|
|
636
|
|
- AND temper.agent_depot_id = #{agentDepotId,jdbcType=INTEGER}
|
|
|
619
|
+ AND depot.id = #{agentDepotId,jdbcType=INTEGER}
|
|
637
|
620
|
</if>
|
|
638
|
621
|
<if test="storehouseId != null">
|
|
639
|
|
- AND temper.storehouse_id = #{storehouseId,jdbcType=INTEGER}
|
|
640
|
|
- </if>
|
|
641
|
|
- <if test="startTime != null and endTime != null">
|
|
642
|
|
- AND temper.detection_time BETWEEN #{startTime} AND #{endTime}
|
|
643
|
|
- </if>
|
|
644
|
|
- <if test="temperId != null">
|
|
645
|
|
- AND temper.id = #{temperId,jdbcType=INTEGER}
|
|
|
622
|
+ AND store.storehouse_id = #{storehouseId,jdbcType=INTEGER}
|
|
646
|
623
|
</if>
|
|
647
|
|
- UNION ALL
|
|
|
624
|
+ order by depot.depot_id
|
|
|
625
|
+ </select>
|
|
|
626
|
+
|
|
|
627
|
+ <select id="getTestDataList" parameterType="java.util.Map" resultType="java.util.HashMap">
|
|
648
|
628
|
SELECT DISTINCT
|
|
649
|
629
|
tt.id id,
|
|
650
|
630
|
tt.org_id orgId,
|
|
651
|
|
- depot.depot_id agentOrgId,
|
|
652
|
|
- depot.depot_id agentStoreOrgId,
|
|
653
|
|
- '0' sign,
|
|
654
|
|
- agent.agent_name agentName,
|
|
655
|
|
- depot.agent_depot_name agentDepotName,
|
|
656
|
|
- store.storehouse_name storehouseName,
|
|
657
|
631
|
tt.storehouse lspz,
|
|
658
|
632
|
tt.time detectionTime,
|
|
659
|
633
|
tt.inTemp houseTemperature,
|
|
|
@@ -661,8 +635,6 @@
|
|
661
|
635
|
tt.max max,
|
|
662
|
636
|
tt.min min,
|
|
663
|
637
|
tt.avg avg,
|
|
664
|
|
- store.storehouse_type storehouseType,
|
|
665
|
|
- store.design_capacity designCapacity,
|
|
666
|
638
|
tt.storehouse enterTime,
|
|
667
|
639
|
tt.storehouse nature,
|
|
668
|
640
|
tt.storehouse level,
|
|
|
@@ -670,45 +642,21 @@
|
|
670
|
642
|
tt.storehouse harvestYear,
|
|
671
|
643
|
tt.outTemp gasTemperature,
|
|
672
|
644
|
tt.outH gasHumidity,
|
|
673
|
|
- keeper.name keeper,
|
|
674
|
645
|
tt.updatetime updatetime
|
|
675
|
646
|
FROM
|
|
676
|
|
- business_agent_depot depot
|
|
677
|
|
- LEFT JOIN business_agent agent ON depot.agent_id = agent.id
|
|
678
|
|
- AND agent.org_id = #{orgId,jdbcType=INTEGER}
|
|
679
|
|
- INNER JOIN business_agent_storehouse agentStore ON depot.id = agentStore.agent_depot_id
|
|
680
|
|
- INNER JOIN basic_storehouse store ON store.storehouse_id = agentStore.storehouse_id
|
|
681
|
|
- AND store.del_flag = 1
|
|
682
|
|
- LEFT JOIN basic_keeper_house keepHouse ON keepHouse.house_Id = agentStore.storehouse_id
|
|
683
|
|
- AND depot.depot_id = keepHouse.org_id
|
|
684
|
|
- LEFT JOIN basic_keeper keeper ON keeper.id = keepHouse.keeper_Id
|
|
685
|
|
- LEFT JOIN (SELECT A.id,A.storehouse,A.org_id,A.time,A.updatetime,A.iLq_yq,A.inTemp, A.inH,A.max, A.min, A.avg,A.t_points ,A.outTemp,A.outH FROM t_testdata A INNER JOIN (
|
|
686
|
|
- SELECT storehouse,MAX(updatetime) updatetime,inTemp, inH, max, min, avg ,outTemp,outH
|
|
687
|
|
- FROM t_testdata GROUP BY storehouse,DATE_FORMAT(updatetime, '%Y-%m-%d')
|
|
688
|
|
- ) B ON A.storehouse = B.storehouse AND A.updatetime = B.updatetime) tt ON depot.depot_id = tt.org_id
|
|
689
|
|
- AND tt.storehouse = store.storehouse_code
|
|
|
647
|
+ t_testdata tt
|
|
|
648
|
+ WHERE tt.iLq_yq = '0'
|
|
|
649
|
+ AND tt.org_id = #{depotId,jdbcType=VARCHAR}
|
|
|
650
|
+ AND tt.storehouse in
|
|
|
651
|
+ <foreach collection="houseCode" item="listItem" open="(" close=")" separator="," >
|
|
|
652
|
+ #{listItem}
|
|
|
653
|
+ </foreach>
|
|
690
|
654
|
AND tt.org_id != #{orgId,jdbcType=INTEGER}
|
|
691
|
|
- AND tt.updatetime >= depot.updatetime
|
|
692
|
|
- WHERE
|
|
693
|
|
- tt.iLq_yq = '0'
|
|
694
|
|
- AND depot.org_id = #{orgId,jdbcType=INTEGER}
|
|
695
|
|
- AND depot.del_flag = 1
|
|
696
|
|
- <if test="agentId != null">
|
|
697
|
|
- AND agent.id = #{agentId,jdbcType=INTEGER}
|
|
698
|
|
- </if>
|
|
699
|
|
- <if test="agentDepotId != null">
|
|
700
|
|
- AND depot.id = #{agentDepotId,jdbcType=INTEGER}
|
|
701
|
|
- </if>
|
|
702
|
|
- <if test="storehouseId != null">
|
|
703
|
|
- AND store.storehouse_id = #{storehouseId,jdbcType=INTEGER}
|
|
704
|
|
- </if>
|
|
705
|
655
|
<if test="startTime != null and endTime != null">
|
|
706
|
656
|
AND tt.time BETWEEN #{startTime} AND #{endTime}
|
|
707
|
657
|
</if>
|
|
708
|
|
- ) temperAll
|
|
709
|
|
- WHERE temperAll.orgId IS NOT NULL AND temperAll.id IS NOT NULL
|
|
710
|
|
- ORDER BY
|
|
711
|
|
- temperAll.updatetime DESC
|
|
|
658
|
+ order by tt.updatetime desc
|
|
|
659
|
+ LIMIT 100
|
|
712
|
660
|
</select>
|
|
713
|
661
|
|
|
714
|
662
|
<select id="getById" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String">
|