|
@@ -360,9 +360,9 @@
|
|
|
|
|
|
<select id="getLedgerItem" resultType="java.lang.Integer">
|
|
|
<if test="itemIdList != null and itemIdList.size > 0">
|
|
|
- select count(*)
|
|
|
- from t_device_ledger_item
|
|
|
- where item_id in
|
|
|
+ select count(*)
|
|
|
+ from t_device_ledger_item
|
|
|
+ where item_id in
|
|
|
<foreach collection="itemIdList" item="itemId" open="(" separator="," close=")">
|
|
|
#{itemId}
|
|
|
</foreach>
|
|
@@ -387,16 +387,15 @@
|
|
|
)) a
|
|
|
INNER JOIN t_alarm_config b ON a.item_id = b.item_id
|
|
|
WHERE b.is_start = 1)
|
|
|
- AND BETWEEN create_time #{startTime}
|
|
|
+ AND alarm_time BETWEEN #{startTime}
|
|
|
AND #{endTime}
|
|
|
- group by item_id
|
|
|
</select>
|
|
|
|
|
|
<select id="getAlarmLogList" resultType="com.example.opc_common.entity.AlarmLog">
|
|
|
SELECT c.*
|
|
|
- FROM t_alarm_log c INNER JOIN (SELECT item_id,max(alarm_time) FROM t_alarm_log GROUP BY item_id) d ON
|
|
|
+ FROM t_alarm_log c INNER JOIN (SELECT item_id,max(alarm_time) AS alarm_time FROM t_alarm_log GROUP BY item_id) d ON
|
|
|
c.item_id=d.item_id AND c.alarm_time=d.alarm_time
|
|
|
- WHERE item_id IN (SELECT a.item_id
|
|
|
+ WHERE c.item_id IN (SELECT a.item_id
|
|
|
FROM (SELECT item_id
|
|
|
FROM t_device_ledger_item
|
|
|
WHERE device_ledger_id IN
|
|
@@ -411,24 +410,24 @@
|
|
|
)) a
|
|
|
INNER JOIN t_alarm_config b ON a.item_id = b.item_id
|
|
|
WHERE b.is_start = 1)
|
|
|
- AND BETWEEN create_time #{startTime}
|
|
|
+ AND c.alarm_time BETWEEN #{startTime}
|
|
|
AND #{endTime}
|
|
|
</select>
|
|
|
|
|
|
<select id="getLedgerByDirectoryId" resultType="com.example.opc_common.entity.DeviceLedger">
|
|
|
- select <include refid="deviceLedger"/>
|
|
|
+ select
|
|
|
+ <include refid="deviceLedger"/>
|
|
|
from t_device_ledger
|
|
|
where directory_id = #{directoryId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getItemByLedgerId" resultType="com.example.opc_common.entity.Item">
|
|
|
- select
|
|
|
- ti.id,
|
|
|
- ti.item_group_id,
|
|
|
- ti.item_read_name,
|
|
|
- ti.describe
|
|
|
+ select ti.id,
|
|
|
+ ti.item_group_id,
|
|
|
+ ti.item_read_name,
|
|
|
+ ti.describe
|
|
|
from t_device_ledger_item tdli
|
|
|
- left join t_item ti on tdli.item_id = ti.id
|
|
|
+ left join t_item ti on tdli.item_id = ti.id
|
|
|
where tdli.device_ledger_id = #{deviceLedgerId}
|
|
|
</select>
|
|
|
|