张磊磊
2023-12-04 fef815b467232a73b461fbee87e4d430a585adec
hd/pipe/materialsManage/src/main/resources/mapping/WeighMapper.xml
@@ -1023,4 +1023,91 @@
    <delete id="materialWarehouseRecordDel" parameterType="java.lang.String">
        delete from t_su_material_warehouse_record where id=#{id}
    </delete>
    <select id="headThingJsDateValue" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataValue">
        SELECT
   DATE_FORMAT( upload_time, "%Y-%m-%d %H:00:00" ) AS uploadTime,
   TRUNCATE(SUM(pm10)/count(pm10),0) as pm10,
   TRUNCATE(SUM(pm25)/count(pm25),0) as pm25,
   TRUNCATE(SUM(tsp)/count(tsp),0) as tsp,
   TRUNCATE(SUM(temperature)/count(temperature),1) as temperature,
   TRUNCATE(SUM(humidity)/count(humidity),1) as humidity,
   TRUNCATE(SUM(wind_speed)/count(wind_speed),1) as windSpeed
FROM
   t_data_value
WHERE
 year(upload_time)=year(NOW()) AND MONTH(upload_time)=MONTH(NOW()) and  DAY(upload_time)=DAY(NOW())
-- upload_time BETWEEN "2023-11-08 00:00:00" and "2023-11-08 23:59:59"
GROUP BY
   DATE_FORMAT( upload_time, "%Y-%m-%d %H:00:00" );
    </select>
    <select id="headThingJsDateSmock" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataSmock">
        select
    smoke_id as smokeId,
    `time` as `time`,
    I00 as i00,
    I01 as i01,
    I02 as i02,
    I03 as i03,
    I04 as i04,
    I05 as i05,
    I06 as i06,
    I07 as i07,
    I10 as i10,
    I11 as i11,
    Q00 as q00,
    Q01 as q01,
    Q02 as q02,
    Q03 as q03,
    Q04 as q04,
    Q05 as q05,
    VB0 as vb0,
    VB10 as vb10,
    VB11 as vb11,
    VB12 as vb12
     from  t_data_smock
     order by  `time` desc
    limit 0,1
    </select>
    <select id="headThingJsDateValueByOne" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataValue">
        select
 data_id as dataId,
 device_id as deviceId,
  device_name as deviceName,
   account_number as accountNumber,
    upload_time as uploadTime,
     pm25 as pm25,
      pm10 as pm10,
      tsp as tsp,
      temperature as temperature,
    humidity as humidity,
     data6 as data6,
      wind_speed as windSpeed,
      wind_direction as windDirection,
       tvoc as tvoc,
        no2 as no2,
        co as co,
         so2 as so2,
          o3 as o3,
          noise as noise
         from t_data_value
         order by  upload_time desc
         limit 0,1
    </select>
    <select id="headThingJsDateValueMonth" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataValue">
        SELECT
   DATE_FORMAT( upload_time, "%Y-%m-%d" ) AS uploadTime,
   TRUNCATE(SUM(pm10)/count(pm10),0) as pm10,
   TRUNCATE(SUM(pm25)/count(pm25),0) as pm25,
   TRUNCATE(SUM(tsp)/count(tsp),0) as tsp,
   TRUNCATE(SUM(temperature)/count(temperature),1) as temperature,
   TRUNCATE(SUM(humidity)/count(humidity),1) as humidity,
   TRUNCATE(SUM(wind_speed)/count(wind_speed),1) as windSpeed
FROM
   t_data_value
WHERE
  year(upload_time)=year(NOW()) AND MONTH(upload_time)=MONTH(NOW())
 -- upload_time BETWEEN "2023-11-01 00:00:00" and "2023-11-30 23:59:59"
GROUP BY
   DATE_FORMAT( upload_time, "%Y-%m-%d" );
    </select>
</mapper>