insert into plc_device(device_code, device_name, tenant_id, scene_id, ip, port1, location, access_protocol, length, device_status, create_by, create_time, update_by, update_time,station,data_type,device_mode_id)
values (#{deviceCode}, #{deviceName}, #{tenantId}, #{sceneId}, #{ip}, #{port1}, #{location}, #{accessProtocol}, #{length}, #{deviceStatus}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime},#{station},#{dataType},#{deviceModeId})
insert into plc_device(device_code, device_name, tenant_id, scene_id, ip, port1, location, access_protocol, length, device_status, create_by, create_time, update_by, update_time)
values
(#{entity.deviceCode}, #{entity.deviceName}, #{entity.tenantId}, #{entity.sceneId}, #{entity.ip}, #{entity.port1}, #{entity.location}, #{entity.accessProtocol}, #{entity.length}, #{entity.deviceStatus}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
insert into plc_device(device_code, device_name, tenant_id, scene_id, ip, port1, location, access_protocol, length, device_status, create_by, create_time, update_by, update_time)
values
(#{entity.deviceCode}, #{entity.deviceName}, #{entity.tenantId}, #{entity.sceneId}, #{entity.ip}, #{entity.port1}, #{entity.location}, #{entity.accessProtocol}, #{entity.length}, #{entity.deviceStatus}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
on duplicate key update
device_code = values(device_code),
device_name = values(device_name),
tenant_id = values(tenant_id),
scene_id = values(scene_id),
ip = values(ip),
port1 = values(port1),
location = values(location),
access_protocol = values(access_protocol),
length = values(length),
device_status = values(device_status),
create_by = values(create_by),
create_time = values(create_time),
update_by = values(update_by),
update_time = values(update_time)
update plc_device
device_code = #{deviceCode},
device_name = #{deviceName},
tenant_id = #{tenantId},
scene_id = #{sceneId},
ip = #{ip},
port1 = #{port1},
location = #{location},
access_protocol = #{accessProtocol},
length = #{length},
device_status = #{deviceStatus},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
data_type = #{dataType},
station = #{station},
where device_id = #{deviceId}
delete from plc_device where device_id = #{deviceId}