|
@@ -83,19 +83,37 @@ public interface IotDeviceRunLogMapper extends BaseMapperX<IotDeviceRunLogDO> {
|
|
|
* @param deviceIds 设备ID集合
|
|
|
* @return fill_content字段数值总和
|
|
|
*/
|
|
|
- @TenantIgnore
|
|
|
+ /* @TenantIgnore
|
|
|
@Select("SELECT SUM(CAST(fill_content AS DECIMAL(15,3))) " +
|
|
|
"FROM rq_iot_device_run_log " +
|
|
|
"WHERE dept_id = #{deptId} " +
|
|
|
"AND device_id IN (${deviceIds}) " +
|
|
|
"AND point_name = '当日注气量' " +
|
|
|
"AND create_time BETWEEN #{startOfYear} AND #{currentTime}")
|
|
|
+ BigDecimal selectCurrentYearFillContentSum(@Param("deptId") Long deptId,
|
|
|
+ @Param("deviceIds") Collection<Long> deviceIds,
|
|
|
+ @Param("startOfYear") LocalDateTime startOfYear,
|
|
|
+ @Param("currentTime") LocalDateTime currentTime); */
|
|
|
+
|
|
|
+ @TenantIgnore
|
|
|
+ @Select("<script>" +
|
|
|
+ "SELECT SUM(CAST(fill_content AS DECIMAL(15,3))) " +
|
|
|
+ "FROM rq_iot_device_run_log " +
|
|
|
+ "WHERE dept_id = #{deptId} " +
|
|
|
+ "AND device_id IN " +
|
|
|
+ " <foreach item='id' collection='deviceIds' open='(' separator=',' close=')'>" +
|
|
|
+ " #{id}" +
|
|
|
+ " </foreach>" +
|
|
|
+ "AND point_name = '当日注气量' " +
|
|
|
+ "AND create_time BETWEEN #{startOfYear} AND #{currentTime}" +
|
|
|
+ "</script>")
|
|
|
BigDecimal selectCurrentYearFillContentSum(@Param("deptId") Long deptId,
|
|
|
@Param("deviceIds") Collection<Long> deviceIds,
|
|
|
@Param("startOfYear") LocalDateTime startOfYear,
|
|
|
@Param("currentTime") LocalDateTime currentTime);
|
|
|
|
|
|
// 可以在Service层提供便捷方法
|
|
|
+ @TenantIgnore
|
|
|
default BigDecimal selectCurrentYearFillContentSum(Long deptId, Collection<Long> deviceIds) {
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
LocalDateTime startOfYear = LocalDate.of(Year.now().getValue(), 1, 1).atStartOfDay();
|