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

pms 日报 计算累计注气量

zhangcl 3 недель назад
Родитель
Сommit
df36a0e21f

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/IotDeviceMapper.java

@@ -80,6 +80,7 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
                 .inIfPresent(IotDeviceDO::getId, reqVO.getDeviceIds())
                 .likeIfPresent(IotDeviceDO::getDeviceCode, reqVO.getDeviceCode())
                 .likeIfPresent(IotDeviceDO::getDeviceName, reqVO.getDeviceName())
+                .eqIfPresent(IotDeviceDO::getDeptId, reqVO.getDeptId())
                 .eqIfPresent(IotDeviceDO::getBrand, reqVO.getBrand())
                 .eqIfPresent(IotDeviceDO::getModel, reqVO.getModel())
                 .eqIfPresent(IotDeviceDO::getDeviceStatus, reqVO.getDeviceStatus())

+ 19 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicerunlog/IotDeviceRunLogMapper.java

@@ -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();

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotopeationfill/IotOpeationFillMapper.java

@@ -92,6 +92,7 @@ public interface IotOpeationFillMapper extends BaseMapperX<IotOpeationFillDO> {
      * @param year   当前时间 年
      * @return 返回符合条件的瑞恒日报记录
      */
+    @TenantIgnore
     List<IotOpeationFillDO> selectReportsByYear(@Param("deptId")Long deptId, @Param("year")int year);
 
     @TenantIgnore