李旭东
2023-12-08 7efc6ed86025b610cab109a2e9f83362740d8ed4
hd/pipe/materialsManage/src/main/resources/mapping/WeighMapper.xml
@@ -711,4 +711,403 @@
        types=2
        where weighbridge_id=#{weighbridgeId}
    </update>
    <select id="materialStockInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.MaterialStockRecordDto">
    SELECT
   s.dict_name AS materialName,
   t.material_value AS materialValue
FROM
   t_material_stock t
   LEFT JOIN sys_dict s ON t.material_name = s.dict_id
    </select>
    <select id="steelInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.SteelDto">
        select
         steel_name as steelName,
         steel_model as steelModel,
         stock as stock
         from sys_steel
    </select>
    <select id="assistGoodInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.AssistGoodDto">
        select s.assist_name as assistName,
        d.dict_name as assistType,
        s.stock as stock
         from  sys_assist_good s left join sys_dict d on  s.assist_type=d.dict_id
    </select>
    <select id="mouldInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.MouldDto">
        select
         mould_num as mouldNum,
         free as free,
         current_cycle_time as currentCycleTime
         from sys_mould
    </select>
    <select id="steelType" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
        select
         steel_id as steelId,
         steel_name as steelName,
         steel_model as steelModel,
         stock as stock
         from
            sys_steel
    </select>
    <insert id="steelRecordIn" >
        insert into sys_steel_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="steelId != null">
                steel_id,
            </if>
            <if test="stockType != null">
                stock_type,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="changeStock != null">
                change_stock,
            </if>
            <if test="supplierId != null">
                supplier_id,
            </if>
            <if test="factoryName != null">
                factory_name,
            </if>
            <if test="brand != null">
                brand,
            </if>
            <if test="lineCode != null">
                line_code,
            </if>
            <if test="proId != null">
                pro_id,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="companyId != null">
                company_id,
            </if>
            <if test="carName != null">
                car_name,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="steelId != null">
                #{steelId,jdbcType=VARCHAR},
            </if>
            <if test="stockType != null">
                #{stockType,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="changeStock != null">
                #{changeStock,jdbcType=DOUBLE},
            </if>
            <if test="supplierId != null">
                #{supplierId,jdbcType=VARCHAR},
            </if>
            <if test="factoryName != null">
                #{factoryName,jdbcType=VARCHAR},
            </if>
            <if test="brand != null">
                #{brand,jdbcType=VARCHAR},
            </if>
            <if test="lineCode != null">
                #{lineCode,jdbcType=VARCHAR},
            </if>
            <if test="proId != null">
                #{proId,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="companyId != null">
                #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="carName != null">
                #{carName,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="steelUp" >
        update sys_steel set
        stock=#{doubleValue}
        where steel_id=#{steelId}
    </update>
    <select id="materialWarehouseRecordList" resultType="com.thhy.materials.modules.biz.weigh.entity.TSuMaterialWarehouseRecord">
        select
        id,
        table_num as tableNum,
        name_of_origin as nameOfOrigin,
        material_name as materialName,
        incoming_quantity as incomingQuantity,
        in_time as inTime,
        status as status,
        inspection_date as inspectionDate,
        report_number as reportNumber,
        create_time as createTime,
        `type`
         from t_su_material_warehouse_record
        where 1=1
        <if test="tableNum!=null and tableNum!='' ">
            and table_num=#{tableNum}
        </if>
        <if test="type!=null and type!='' ">
            and `type`=#{type}
        </if>
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and create_time between #{strTime} and #{endTime}
        </if>
        order by create_time desc
    </select>
    <insert id="materialWarehouseRecordInsert" >
        insert into t_su_material_warehouse_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="tableNum != null">
                table_num,
            </if>
            <if test="nameOfOrigin != null">
                name_of_origin,
            </if>
            <if test="materialName != null">
                material_name,
            </if>
            <if test="incomingQuantity != null">
                incoming_quantity,
            </if>
            <if test="inTime != null">
                in_time,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="inspectionDate != null">
                inspection_date,
            </if>
            <if test="reportNumber != null">
                report_number,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="updateUser != null">
                update_user,
            </if>
            <if test="isUse != null">
                is_use,
            </if>
            <if test="companyId != null">
                company_id,
            </if>
            <if test="type != null">
                type,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="tableNum != null">
                #{tableNum,jdbcType=INTEGER},
            </if>
            <if test="nameOfOrigin != null">
                #{nameOfOrigin,jdbcType=VARCHAR},
            </if>
            <if test="materialName != null">
                #{materialName,jdbcType=VARCHAR},
            </if>
            <if test="incomingQuantity != null">
                #{incomingQuantity,jdbcType=DOUBLE},
            </if>
            <if test="inTime != null">
                #{inTime,jdbcType=TIMESTAMP},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="inspectionDate != null">
                #{inspectionDate,jdbcType=TIMESTAMP},
            </if>
            <if test="reportNumber != null">
                #{reportNumber,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                #{updateUser,jdbcType=VARCHAR},
            </if>
            <if test="isUse != null">
                #{isUse,jdbcType=INTEGER},
            </if>
            <if test="companyId != null">
                #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                #{type,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
    <update id="materialWarehouseRecordUpdate" >
        update t_su_material_warehouse_record
        <set>
            <if test="tableNum != null">
                table_num = #{tableNum,jdbcType=INTEGER},
            </if>
            <if test="nameOfOrigin != null">
                name_of_origin = #{nameOfOrigin,jdbcType=VARCHAR},
            </if>
            <if test="materialName != null">
                material_name = #{materialName,jdbcType=VARCHAR},
            </if>
            <if test="incomingQuantity != null">
                incoming_quantity = #{incomingQuantity,jdbcType=DOUBLE},
            </if>
            <if test="inTime != null">
                in_time = #{inTime,jdbcType=TIMESTAMP},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="inspectionDate != null">
                inspection_date = #{inspectionDate,jdbcType=TIMESTAMP},
            </if>
            <if test="reportNumber != null">
                report_number = #{reportNumber,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                create_user = #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                update_user = #{updateUser,jdbcType=VARCHAR},
            </if>
            <if test="isUse != null">
                is_use = #{isUse,jdbcType=INTEGER},
            </if>
            <if test="companyId != null">
                company_id = #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                type = #{type,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=VARCHAR}
    </update>
    <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>