[後台] 修改點位同步全棟問題
This commit is contained in:
parent
7ab418c7b1
commit
80be5b1fa2
@ -556,6 +556,16 @@ namespace Backend.Controllers
|
|||||||
apiResult.Msg = "新增成功";
|
apiResult.Msg = "新增成功";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
var sql = $@"SELECT di.id FROM device_item di
|
||||||
|
WHERE di.deleted = 0 AND device_system_tag = @device_system_tag and device_name_tag = @device_name_tag and points = @points";
|
||||||
|
|
||||||
|
var deviceItemId = await backendRepository.GetAllAsync<int>(sql,
|
||||||
|
new { points = device_Item.points, device_system_tag = main_tag, device_name_tag = sub_tag });
|
||||||
|
|
||||||
|
if (deviceItemId.Count() > 0)
|
||||||
|
{
|
||||||
|
foreach (var id in deviceItemId)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
|
Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
@ -571,7 +581,9 @@ namespace Backend.Controllers
|
|||||||
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
|
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
|
||||||
};
|
};
|
||||||
|
|
||||||
await backendRepository.UpdateOneByCustomTable(Device_itemDic, "device_item", "id='" + device_Item.id + "'");
|
await backendRepository.UpdateOneByCustomTable(Device_itemDic, "device_item", "id='" + id + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "修改成功";
|
apiResult.Msg = "修改成功";
|
||||||
@ -652,7 +664,7 @@ namespace Backend.Controllers
|
|||||||
{
|
{
|
||||||
string sWhere = @$"deleted = @Deleted AND id = @id";
|
string sWhere = @$"deleted = @Deleted AND id = @id";
|
||||||
|
|
||||||
object param = new { Deleted = 0, id = id};
|
object param = new { Deleted = 0, id = id };
|
||||||
|
|
||||||
var device_Item = await backendRepository.GetOneAsync<Device_item>("device_item", sWhere, param);
|
var device_Item = await backendRepository.GetOneAsync<Device_item>("device_item", sWhere, param);
|
||||||
|
|
||||||
@ -663,7 +675,9 @@ namespace Backend.Controllers
|
|||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
await backendRepository.DeleteOne(id.ToString(), "device_item", "id");
|
string sql = $@"update device_item set deleted = 1 where device_system_tag = '{device_Item.device_system_tag}' and device_name_tag = '{device_Item.device_name_tag}' and deleted = 0
|
||||||
|
and points = '{device_Item.points}'";
|
||||||
|
await backendRepository.ExecuteSql(sql);
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "刪除成功";
|
apiResult.Msg = "刪除成功";
|
||||||
|
Loading…
Reference in New Issue
Block a user