From 7fe636ae5fd5ab6636c250d07835ee044d3c77c8 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 17 三月 2023 19:48:21 +0800 Subject: [PATCH] 1 --- ExportMap/db/PubDBHelper.cs | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ExportMap/db/PubDBHelper.cs b/ExportMap/db/PubDBHelper.cs index 69e4ef9..c15cd16 100644 --- a/ExportMap/db/PubDBHelper.cs +++ b/ExportMap/db/PubDBHelper.cs @@ -12,7 +12,7 @@ { public class PubDBHelper { - private static string insertPublishSql = "insert into lf.sys_publish(name, url, path, type, status, dirid, depid, min, max, json, create_user, geom, bak) values (@name, @url, @path, @type, @status, @dirid, @depid, @min, @max, @json, @create_user, @geom, @bak) returning id"; + private static string insertPublishSql = "insert into lf.sys_publish(name, url, path, type, status, dirid, depid, min, max, json, create_user, geom, bak) values (@name, @url, @path, @type, @status, @dirid, @depid, @min, @max, @json, @create_user, {0}, @bak) returning id"; private static string insertMetaPubSql = "insert into lf.sys_meta_pub (metaid, pubid, create_user) select {0}, {1}, {2} from (select 1) temp where not exists (select 1 from lf.sys_meta_pub where metaid = {0} and pubid = {1})"; @@ -34,7 +34,7 @@ /// </summary> public static bool IsPublish(string dirid) { - string sql = "select count(*) from lf.sys_meta_pub a inner join lf.sys_publish b on a.pubid = b.id where b.dirid = @dirid"; + string sql = "select count(*) from lf.sys_meta_pub a inner join lf.sys_publish b on a.pubid = b.id where b.type = 'DOM' and b.dirid = @dirid"; DbParameter dp = new NpgsqlParameter("@dirid", dirid); object obj = Tool.DBHelper.GetScalar(sql, dp); @@ -60,8 +60,9 @@ public static int InsertPublish(SysPublish sys) { List<DbParameter> list = Tool.GetParams<SysPublish>(insertPublishSql, sys); + string sql = string.Format(insertPublishSql, sys.geom == null ? "null" : sys.geom); - object obj = Tool.DBHelper.GetScalar(insertPublishSql, list.ToArray()); + object obj = Tool.DBHelper.GetScalar(sql, list.ToArray()); return obj == null ? 0 : Convert.ToInt32(obj); } -- Gitblit v1.9.3