id, statistic_date, plan_id, pro_id, `number`, dt
  
  
  
    
    delete from oth_statistic_device
    where id = #{id,jdbcType=BIGINT}
  
  
    
    insert into oth_statistic_device (statistic_date, plan_id, pro_id, 
      `number`, dt)
    values (#{statisticDate,jdbcType=VARCHAR}, #{planId,jdbcType=BIGINT}, #{proId,jdbcType=BIGINT}, 
      #{number,jdbcType=INTEGER}, #{dt,jdbcType=TIMESTAMP})
  
  
    
    insert into oth_statistic_device
    
      
        statistic_date,
      
      
        plan_id,
      
      
        pro_id,
      
      
        `number`,
      
      
        dt,
      
    
    
      
        #{statisticDate,jdbcType=VARCHAR},
      
      
        #{planId,jdbcType=BIGINT},
      
      
        #{proId,jdbcType=BIGINT},
      
      
        #{number,jdbcType=INTEGER},
      
      
        #{dt,jdbcType=TIMESTAMP},
      
    
  
  
    
    update oth_statistic_device
    
      
        statistic_date = #{statisticDate,jdbcType=VARCHAR},
      
      
        plan_id = #{planId,jdbcType=BIGINT},
      
      
        pro_id = #{proId,jdbcType=BIGINT},
      
      
        `number` = #{number,jdbcType=INTEGER},
      
      
        dt = #{dt,jdbcType=TIMESTAMP},
      
    
    where id = #{id,jdbcType=BIGINT}
  
  
    
    update oth_statistic_device
    set statistic_date = #{statisticDate,jdbcType=VARCHAR},
      plan_id = #{planId,jdbcType=BIGINT},
      pro_id = #{proId,jdbcType=BIGINT},
      `number` = #{number,jdbcType=INTEGER},
      dt = #{dt,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  
  
  
    insert into oth_statistic_device (statistic_date,plan_id,pro_id,number,dt)
    SELECT DATE_FORMAT(t.out_line_time,'%Y-%m-%d') statistic_date,t.plan_id,plan.pro_id,count(t.device_no) number,now() dt
    from sta_device_last t
           left join pr_assembly_plan plan on t.plan_id=plan.id
    where t.status =2
      and t.out_line_time > #{maxDate}
    GROUP BY t.plan_id,DATE_FORMAT(t.out_line_time,'%Y-%m-%d')