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

[电表][修复]:调整电表group by的语句

release_toaliyun_real
hupeng 6 лет назад
Родитель
Сommit
0459b27e14
2 измененных файлов: 16 добавлений и 5 удалений
  1. +1
    -1
      mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml
  2. +15
    -4
      mallinkService/src/main/resources/mapper/KwMeterDataMapper.xml

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

@@ -243,7 +243,7 @@
sum(used_power) as usedPower
FROM kw_meter_data
<include refid="dynamicWhereConditionsVo"/>
group by meter_id
group by tenant_id,box_id,meter_id
) as temp,
wx_merchant m
where mm.status = 0


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

@@ -88,8 +88,10 @@
) temp
where
create_time = temp.maxTime
and meter_id = temp.maxMeterId
group by `meter_id`
<if test=" null != meterId ">
and meter_id = temp.maxMeterId
</if>

</select>


@@ -181,7 +183,7 @@
sum(used_power) as usedPower
FROM kw_meter_data
<include refid="dynamicWhereConditionsVo"/>
group by reportTime,meter_id
group by reportTime,meter_id,box_id
) as temp join kw_meter on id = temp.meter_id
<if test=" null != status ">
and `status` = #{status}
@@ -223,7 +225,13 @@
<if test=" null != endTime and null != endTime">
sum(used_power) as usedPower,
</if>
tenant_id,box_id,meter_id
<if test=" null != meterId ">
meter_id,
</if>
<if test=" null != boxId ">
box_id,
</if>
tenant_id
FROM kw_meter_data
where 1 = 1
<if test=" null != tenantId ">
@@ -267,6 +275,9 @@
</if>

group by reportTime
<if test=" null != boxId ">
,box_id
</if>
<if test=" null != meterId ">
,meter_id
</if>


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