修改圖資api
This commit is contained in:
parent
b0b9500bd3
commit
33a0a3c477
@ -100,8 +100,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
var sqlString = @$"SELECT *
|
var sqlString = @$"SELECT *
|
||||||
FROM graph_manage 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
|
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
|
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 v2.system_value in @sub_system_tag AND gm.deleted = 0
|
WHERE v2.system_value in @sub_system_tag AND gm.deleted = 0
|
||||||
ORDER BY gm.priority, gm.created_at desc";
|
ORDER BY gm.priority, gm.created_at desc";
|
||||||
|
|
||||||
@ -115,8 +115,9 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
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 };
|
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 *
|
||||||
FROM graph_manage gm
|
FROM graph_manage gm
|
||||||
JOIN variable v2 ON gm.sub_system_id = v2.id AND v2.system_type = @graph_manage_layer2 AND v2.deleted = 0
|
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
|
||||||
WHERE v2.id in @sub_system_id AND gm.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 v2.system_value in @sub_system_tag AND gm.deleted = 0
|
||||||
AND (code like '%@keyWord%' OR name like '%@keyWord%' OR oriOrgName like '%@keyWord%' OR donOrgName like '%@keyWord%')
|
AND (code like '%@keyWord%' OR name like '%@keyWord%' OR oriOrgName like '%@keyWord%' OR donOrgName like '%@keyWord%')
|
||||||
ORDER BY gm.priority, gm.created_at desc", wParam);
|
ORDER BY gm.priority, gm.created_at desc", wParam);
|
||||||
}
|
}
|
||||||
@ -143,12 +144,12 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
var sqlString = @$"SELECT *
|
var sqlString = @$"SELECT *
|
||||||
FROM graph_manage 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
|
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
|
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
|
||||||
WHERE v2.system_value = @sub_system_tag AND gm.deleted = 0 AND gm.code = @code
|
WHERE gm.id = @id
|
||||||
ORDER BY gm.priority, gm.created_at desc";
|
ORDER BY gm.priority, gm.created_at desc";
|
||||||
|
|
||||||
var param = 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, @code = gi.code };
|
var param = new { @id = gi.id };
|
||||||
|
|
||||||
graManList = await backendRepository.GetOneAsync<GraphList>(sqlString, param);
|
graManList = await backendRepository.GetOneAsync<GraphList>(sqlString, param);
|
||||||
|
|
||||||
@ -179,9 +180,9 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = @$"UPDATE graph_manage SET deleted = 1, updated_at = @time, updated_by = @user WHERE code = @code AND sub_system_tag = @sub_system_tag AND main_system_tag = @main_system_tag";
|
var sqlString = @$"UPDATE graph_manage SET deleted = 1, updated_at = @time, updated_by = @user WHERE id = @id";
|
||||||
|
|
||||||
var param = new { @code = gi.code, @sub_system_tag = gi.sub_system_tag, @main_system_tag = gi.main_system_tag, @time = DateTime.Now, @user = myUser.userinfo_guid };
|
var param = new { @id = gi.id, @time = DateTime.Now, @user = myUser.userinfo_guid };
|
||||||
|
|
||||||
await backendRepository.ExecuteSql(sqlString, param);
|
await backendRepository.ExecuteSql(sqlString, param);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -204,8 +205,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sWhere = @$"deleted = 0 AND code = @code AND sub_system_tag = @sub_system_tag AND main_system_tag = @main_system_tag";
|
var sWhere = @$"deleted = 0 AND id = @id";
|
||||||
var gm = await backendRepository.GetOneAsync<GraphInsInfo>("graph_manage", sWhere, new { @code = gii.code, @sub_system_tag = gii.sub_system_tag, @main_system_tag = gii.main_system_tag});
|
var gm = await backendRepository.GetOneAsync<GraphInsInfo>("graph_manage", sWhere, new { @id = gii.id });
|
||||||
|
|
||||||
if (gm == null)
|
if (gm == null)
|
||||||
{
|
{
|
||||||
@ -214,6 +215,16 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
return apiResult;
|
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 });
|
||||||
|
|
||||||
|
if (gm != null)
|
||||||
|
{
|
||||||
|
apiResult.Code = "0002";
|
||||||
|
apiResult.Data = "無法找到圖資";
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, object> graph_manage = new Dictionary<string, object>();
|
Dictionary<string, object> graph_manage = new Dictionary<string, object>();
|
||||||
|
|
||||||
//edit file
|
//edit file
|
||||||
@ -264,7 +275,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
graph_manage.Add("@oriSavName", fileName);
|
graph_manage.Add("@oriSavName", fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
graph_manage.Add("@code", gii.code);
|
||||||
graph_manage.Add("@name", gii.name);
|
graph_manage.Add("@name", gii.name);
|
||||||
graph_manage.Add("@main_system_tag", gii.main_system_tag);
|
graph_manage.Add("@main_system_tag", gii.main_system_tag);
|
||||||
graph_manage.Add("@sub_system_tag", gii.sub_system_tag);
|
graph_manage.Add("@sub_system_tag", gii.sub_system_tag);
|
||||||
@ -272,7 +283,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
graph_manage.Add("@updated_by", myUser.userinfo_guid);
|
graph_manage.Add("@updated_by", myUser.userinfo_guid);
|
||||||
//graph_manage.Add("@priority", gii.priority);
|
//graph_manage.Add("@priority", gii.priority);
|
||||||
|
|
||||||
await backendRepository.UpdateOneByCustomTable(graph_manage, "graph_manage", "code='" + gm.code + "'" + " and sub_system_tag ='" + gm.sub_system_tag + "' and main_system_tag = '" + gm.main_system_tag + "'");
|
await backendRepository.UpdateOneByCustomTable(graph_manage, "graph_manage", "id = " + gii.id);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = "修改成功";
|
apiResult.Data = "修改成功";
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ namespace FrontendWebApi.Models
|
|||||||
{
|
{
|
||||||
public class GraphList
|
public class GraphList
|
||||||
{
|
{
|
||||||
|
public int id { get; set; }
|
||||||
public string code { get; set; }
|
public string code { get; set; }
|
||||||
public string main_system_tag { get; set; }
|
public string main_system_tag { get; set; }
|
||||||
public int sub_system_tag { get; set; }
|
public int sub_system_tag { get; set; }
|
||||||
@ -20,6 +21,7 @@ namespace FrontendWebApi.Models
|
|||||||
|
|
||||||
public class GraphInsInfo
|
public class GraphInsInfo
|
||||||
{
|
{
|
||||||
|
public int id { get; set; }
|
||||||
public string code { get; set; }
|
public string code { get; set; }
|
||||||
public string main_system_tag { get; set; }
|
public string main_system_tag { get; set; }
|
||||||
public string sub_system_tag { get; set; }
|
public string sub_system_tag { get; set; }
|
||||||
@ -35,6 +37,7 @@ namespace FrontendWebApi.Models
|
|||||||
|
|
||||||
public class GraphInfo: Actor
|
public class GraphInfo: Actor
|
||||||
{
|
{
|
||||||
|
public int id { get; set; }
|
||||||
public string code { get; set; }
|
public string code { get; set; }
|
||||||
public string main_system_tag { get; set; }
|
public string main_system_tag { get; set; }
|
||||||
public List<int> sub_system_tag { get; set; }
|
public List<int> sub_system_tag { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user