Просмотр исходного кода

[电表][修复]:优化电表批量更新,冗余电表最新读数

release_toaliyun_real
hupeng 6 лет назад
Родитель
Сommit
27c87867b4
1 измененных файлов: 13 добавлений и 15 удалений
  1. +13
    -15
      mallinkService/src/main/resources/mapper/KwMeterMapper.xml

+ 13
- 15
mallinkService/src/main/resources/mapper/KwMeterMapper.xml Просмотреть файл

@@ -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">


Загрузка…
Отмена
Сохранить