| @@ -94,21 +94,19 @@ | |||||
| <update id="onlineBatch" parameterType="java.util.List" > | <update id="onlineBatch" parameterType="java.util.List" > | ||||
| update kw_meter | update kw_meter | ||||
| set | set | ||||
| <trim prefix="set" suffixOverrides=","> | |||||
| <trim prefix="last_total_power=case" suffix="end,"> | |||||
| <foreach collection="list" item="i" index="index"> | |||||
| <if test="i.lastTotalPower!=null"> | |||||
| when id = #{i.id} | |||||
| then #{i.lastTotalPower} | |||||
| </if> | |||||
| </foreach> | |||||
| </trim> | |||||
| online_status = 1, | |||||
| last_online_time = now() | |||||
| </trim> | |||||
| total_power= | |||||
| case | |||||
| <foreach collection="list" item="item" index="index"> | |||||
| <if test="item.totalPower!=null"> | |||||
| when id = #{item.id} then #{item.totalPower} | |||||
| </if> | |||||
| </foreach> | |||||
| end, | |||||
| online_status = 1, | |||||
| last_online_time = now() | |||||
| where id in | where id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> | |||||
| #{item.id} | |||||
| </foreach> | </foreach> | ||||
| </update> | </update> | ||||
| @@ -120,7 +118,7 @@ | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| and `online_status` = 1 | |||||
| and online_status = 1 | |||||
| </update> | </update> | ||||
| <update id="unbindBatch" parameterType="java.lang.Long"> | <update id="unbindBatch" parameterType="java.lang.Long"> | ||||