[Backend] 針對燈具,清空資料表、新增至device_node資料表,暫時註解

This commit is contained in:
wanli 2023-01-03 22:28:06 +08:00
parent 0fef2791c1
commit ba03adc2b5

View File

@ -761,13 +761,42 @@ namespace Backend.Controllers
{ {
if (post.Count > 0) if (post.Count > 0)
{ {
//清空device_node資料表
//await backendRepository.TruncateTable("device_node");
//int node_priority = 1;
foreach(var idfc in post) foreach(var idfc in post)
{ {
Dictionary<string, object> device = new Dictionary<string, object>(); //if(idfc.device_number.IndexOf("_LT_L1") > -1)
device.Add("@device_coordinate_3d", idfc.device_coordinate_3d); //{
device.Add("@forge_dbid", idfc.forge_dbid); // //取得device_guid
// var sWhere = $@"where deleted = 0 and device_number = " + idfc.device_number;
// var device_guid = await backendRepository.GetOneAsync<string>("device_node", sWhere, "device_guid");
// //燈具
// Dictionary<string, object> device = new Dictionary<string, object>();
// device.Add("@device_node_guid", Guid.NewGuid());
// device.Add("@deleted", 0);
// device.Add("@device_guid", device_guid);
// device.Add("@device_node_coordinate_3d", idfc.device_coordinate_3d);
// device.Add("@forge_dbid", idfc.forge_dbid);
// device.Add("@priority", node_priority);
// device.Add("@created_by", myUserInfo.Userinfo_guid);
// device.Add("@created_at", DateTime.Now);
// node_priority++;
// await backendRepository.AddOneByCustomTableReturnId(device, "device_node", false);
//}
//else
//{
Dictionary<string, object> device = new Dictionary<string, object>();
device.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
device.Add("@forge_dbid", idfc.forge_dbid);
await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
//}
await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
} }
} }
apiResult.Code = "0000"; apiResult.Code = "0000";