[FrontedWebApi][圖資管理] edit 後端程序調整
This commit is contained in:
parent
33a0a3c477
commit
d522e4e801
@ -98,7 +98,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
List<GraphList> graManList = new List<GraphList>();
|
||||
try
|
||||
{
|
||||
var sqlString = @$"SELECT *
|
||||
var sqlString = @$"SELECT gm.*
|
||||
FROM graph_manage gm
|
||||
JOIN variable v1 ON v1.system_value = @main_system_tag and v1.system_type = @graph_manage_layer1 and v1.deleted = 0 AND convert(v1.system_value, nchar) = gm.main_system_tag
|
||||
JOIN variable v2 ON v1.id = v2.system_parent_id AND v2.system_type = @graph_manage_layer2 AND v2.deleted = 0 AND convert(v2.system_value, nchar) = gm.sub_system_tag
|
||||
@ -113,7 +113,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
if (gi.keyWord != null)
|
||||
{
|
||||
var wParam = new { @graph_manage_layer1 = graph_manage_layer1, graph_manage_layer2 = graph_manage_layer2, @sub_system_tag = gi.sub_system_tag, @main_system_tag = gi.main_system_tag, @keyWord = gi.keyWord };
|
||||
graManList = await backendRepository.GetAllAsync<GraphList>(@$"SELECT *
|
||||
graManList = await backendRepository.GetAllAsync<GraphList>(@$"SELECT gm.*
|
||||
FROM graph_manage gm
|
||||
JOIN variable v1 ON v1.system_value = @main_system_tag and v1.system_type = @graph_manage_layer1 and v1.deleted = 0 AND convert(v1.system_value, nchar) = gm.main_system_tag
|
||||
JOIN variable v2 ON v1.id = v2.system_parent_id AND v2.system_type = @graph_manage_layer2 AND v2.deleted = 0 and convert(v2.system_value, nchar) = gm.sub_system_tag
|
||||
@ -144,12 +144,12 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
var sqlString = @$"SELECT *
|
||||
FROM graph_manage gm
|
||||
JOIN variable v1 ON v1.system_value = gm.main_system_tag and v1.system_type = @graph_manage_layer1 and v1.deleted = 0
|
||||
JOIN variable v2 ON v1.id = v2.system_parent_id AND v2.system_type = @graph_manage_layer2 AND v2.deleted = 0 and v2.system_value = gm.sub_system_tag
|
||||
JOIN variable v1 ON convert(v1.system_value, nchar) = gm.main_system_tag and v1.system_type = @graph_manage_layer1 and v1.deleted = 0
|
||||
JOIN variable v2 ON v1.id = v2.system_parent_id AND v2.system_type = @graph_manage_layer2 AND v2.deleted = 0 and convert(v2.system_value, nchar) = gm.sub_system_tag
|
||||
WHERE gm.id = @id
|
||||
ORDER BY gm.priority, gm.created_at desc";
|
||||
|
||||
var param = new { @id = gi.id };
|
||||
var param = new { @id = gi.id , @graph_manage_layer1 = graph_manage_layer1, @graph_manage_layer2 = graph_manage_layer2 };
|
||||
|
||||
graManList = await backendRepository.GetOneAsync<GraphList>(sqlString, param);
|
||||
|
||||
@ -205,18 +205,9 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
try
|
||||
{
|
||||
var sWhere = @$"deleted = 0 AND id = @id";
|
||||
var gm = await backendRepository.GetOneAsync<GraphInsInfo>("graph_manage", sWhere, new { @id = gii.id });
|
||||
|
||||
if (gm == null)
|
||||
{
|
||||
apiResult.Code = "0001";
|
||||
apiResult.Data = "無法找到圖資";
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
sWhere = $@"deleted = 0 and id != @id and code = @code and sub_system_tag = @sub_system_tag and main_system_tag = @main_system_tag";
|
||||
gm = await backendRepository.GetOneAsync<GraphInsInfo>("graph_manage", sWhere, new { @id = gii.id, @code = gii.code, @sub_system_tag = gii.sub_system_tag, @main_system_tag = gii.main_system_tag });
|
||||
var sWhere = $@"deleted = 0 and id != @id and code = @code and sub_system_tag = @sub_system_tag and main_system_tag = @main_system_tag";
|
||||
var gm = await backendRepository.GetOneAsync<GraphInsInfo>("graph_manage", sWhere, new { @id = gii.id, @code = gii.code, @sub_system_tag = gii.sub_system_tag, @main_system_tag = gii.main_system_tag });
|
||||
|
||||
if (gm != null)
|
||||
{
|
||||
@ -225,16 +216,19 @@ namespace FrontendWebApi.ApiControllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
sWhere = @$"deleted = 0 AND id = @id";
|
||||
gm = await backendRepository.GetOneAsync<GraphInsInfo>("graph_manage", sWhere, new { @id = gii.id });
|
||||
|
||||
if (gm == null)
|
||||
{
|
||||
apiResult.Code = "0001";
|
||||
apiResult.Data = "無法找到圖資";
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
|
||||
Dictionary<string, object> graph_manage = new Dictionary<string, object>();
|
||||
|
||||
//edit file
|
||||
if (gii.oriOrgName != null || gii.donOrgName != null)
|
||||
{
|
||||
if (!System.IO.Directory.Exists(graphManageFileSaveAsPath))
|
||||
System.IO.Directory.CreateDirectory(graphManageFileSaveAsPath);
|
||||
|
||||
if (gm.oriSavName != null && gii.oriOrgName != null)
|
||||
{
|
||||
var new_guid = Guid.NewGuid();
|
||||
|
||||
//刪除原本檔案
|
||||
@ -252,19 +246,16 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
graph_manage.Add("@oriOrgName", gii.oriOrgName);
|
||||
graph_manage.Add("@oriSavName", fileName);
|
||||
}
|
||||
|
||||
if (gm.donSavName != null && gii.donOrgName != null)
|
||||
{
|
||||
var new_guid = Guid.NewGuid();
|
||||
new_guid = Guid.NewGuid();
|
||||
|
||||
//刪除原本檔案
|
||||
FolderFunction folderFunction = new FolderFunction();
|
||||
folderFunction = new FolderFunction();
|
||||
folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName));
|
||||
|
||||
var fileName = new_guid + "." + gii.donOrgName.Split('.')[1];
|
||||
fileName = new_guid + "." + gii.donOrgName.Split('.')[1];
|
||||
|
||||
var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
|
||||
fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
|
||||
|
||||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||
{
|
||||
@ -273,8 +264,55 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
graph_manage.Add("@oriOrgName", gii.donOrgName);
|
||||
graph_manage.Add("@oriSavName", fileName);
|
||||
}
|
||||
}
|
||||
|
||||
//edit file
|
||||
//if (gii.oriOrgName != null || gii.donOrgName != null)
|
||||
//{
|
||||
// if (!System.IO.Directory.Exists(graphManageFileSaveAsPath))
|
||||
// System.IO.Directory.CreateDirectory(graphManageFileSaveAsPath);
|
||||
|
||||
// if (gm.oriSavName != null && gii.oriOrgName != null)
|
||||
// {
|
||||
// var new_guid = Guid.NewGuid();
|
||||
|
||||
// //刪除原本檔案
|
||||
// FolderFunction folderFunction = new FolderFunction();
|
||||
// folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName));
|
||||
|
||||
// var fileName = new_guid + "." + gii.oriOrgName.Split('.')[1];
|
||||
|
||||
// var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
|
||||
|
||||
// using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||
// {
|
||||
// gii.oriFile.CopyTo(stream);
|
||||
// }
|
||||
|
||||
// graph_manage.Add("@oriOrgName", gii.oriOrgName);
|
||||
// graph_manage.Add("@oriSavName", fileName);
|
||||
// }
|
||||
|
||||
// if (gm.donSavName != null && gii.donOrgName != null)
|
||||
// {
|
||||
// var new_guid = Guid.NewGuid();
|
||||
|
||||
// //刪除原本檔案
|
||||
// FolderFunction folderFunction = new FolderFunction();
|
||||
// folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName));
|
||||
|
||||
// var fileName = new_guid + "." + gii.donOrgName.Split('.')[1];
|
||||
|
||||
// var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
|
||||
|
||||
// using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||
// {
|
||||
// gii.donFile.CopyTo(stream);
|
||||
// }
|
||||
|
||||
// graph_manage.Add("@oriOrgName", gii.donOrgName);
|
||||
// graph_manage.Add("@oriSavName", fileName);
|
||||
// }
|
||||
//}
|
||||
graph_manage.Add("@code", gii.code);
|
||||
graph_manage.Add("@name", gii.name);
|
||||
graph_manage.Add("@main_system_tag", gii.main_system_tag);
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 826 KiB |
Binary file not shown.
After Width: | Height: | Size: 823 KiB |
Loading…
Reference in New Issue
Block a user