INSERT INTO tb_collect_device( id, dev_name, dev_type_id, dev_code, dev_type, is_active, is_online,dev_location, background_image, remark, config_data, del_flag, create_time,update_time, const_id )values (#{id},#{devName},#{typeId},#{devCode},#{devType} ,#{isActive},#{isOnline},#{devLocation},#{backImage}, #{remark},#{configData},0,now(),now(),#{constId} ) INSERT INTO tb_collect_device_attr( dev_id, attr_id,attr_name,remark, data_type, unit, attr_code, attr_val, create_time, update_time, max_value, min_value,change_val ,is_warn )values (#{devId},#{attrId},#{attrName},#{remark},#{dataType},#{unit},#{attrCode}, #{attrVal},now(),#{updateTime},#{maxVal},#{minVal},#{changeVal},#{isWarn}) update tb_collect_device set dev_name=#{devName}, dev_type_id=#{typeId}, dev_code=#{devCode}, dev_type=#{devType}, is_active=#{isActive}, is_online=#{isOnline},dev_location=#{devLocation}, background_image=#{backImage}, remark=#{remark}, config_data=#{configData},update_time=#{updateTime}, const_id=#{constId} where id=#{id} update tb_collect_device_attr set attr_name=#{attrName},remark=#{remark}, data_type=#{dataType}, unit=#{unit}, attr_code=#{attrCode}, attr_val=#{attrVal}, update_time=now(), max_value=#{maxVal}, min_value=#{minVal},change_val=#{changeVal},is_warn=#{isWarn} where attr_id=#{attrId} update tb_collect_device set del_flag=1,update_time=now() where id=#{id} delete from tb_collect_device_attr where attr_id=#{attrId}