| | |
| | | private static string selectLayerSql = "select id from lf.sys_layer where pid = @pid and en_name = @en_name"; |
| | | |
| | | /// <summary> |
| | | /// 是/否发布过 |
| | | /// 是/否发布过 * |
| | | /// </summary> |
| | | public static bool IsPublish(int metaid) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 是/否发布过 |
| | | /// 是/否发布过 * |
| | | /// </summary> |
| | | public static bool IsPublish(string dirid, string type = "DOM") |
| | | { |
| | |
| | | int count = obj == null ? 0 : Convert.ToInt32(obj); |
| | | |
| | | return count > 0; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取发布ID |
| | | /// </summary> |
| | | public static int GetPushlishId(int metaid) |
| | | { |
| | | string sql = string.Format("select pubid from lf.sys_meta_pub where metaid={0} order by id desc limit 1", metaid); |
| | | object obj = Tools.DBHelper.GetScalar(sql); |
| | | |
| | | return null == obj ? 0 : Convert.ToInt32(obj); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新发布数据的坐标 |
| | | /// 更新发布数据 |
| | | /// </summary> |
| | | public static int UpdatePublishCoord(int pid, string json) |
| | | public static int UpdatePublish(int pubid, string name, int userId, string geom, string url = null) |
| | | { |
| | | string sql = string.Format("update lf.sys_publish set json = @json where id = {0}", pid); |
| | | DbParameter dp = new NpgsqlParameter("@json", json); |
| | | string str = null == geom ? "" : string.Format(", geom={0}", geom); |
| | | str += null == url ? "" : string.Format(", url='{0}'", url); |
| | | string sql = string.Format("update lf.sys_publish set name=@name, update_user=@userId, update_time=now(){0} where id=@id;update lf.sys_layer set cn_name=@name where pubid=@id;", str); |
| | | |
| | | return Tools.DBHelper.ExecuteNonQuery(sql, dp); |
| | | DbParameter dp1 = new NpgsqlParameter("@name", name); |
| | | DbParameter dp2 = new NpgsqlParameter("@userId", userId); |
| | | DbParameter dp3 = new NpgsqlParameter("@id", pubid); |
| | | |
| | | return Tools.DBHelper.ExecuteNonQuery(sql, dp1, dp2, dp3); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public static int InsertPublish(SysPublish sys) |
| | | { |
| | | List<DbParameter> list = Tools.GetParams<SysPublish>(insertPublishSql, sys); |
| | | string sql = string.Format(insertPublishSql, sys.geom == null ? "null" : sys.geom); |
| | | string sql = string.Format(insertPublishSql, string.IsNullOrEmpty(sys.geom) ? "null" : sys.geom); |
| | | |
| | | object obj = Tools.DBHelper.GetScalar(sql, list.ToArray()); |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询发布数据 |
| | | /// </summary> |
| | | public static List<SysPublish> SelectPublishs(List<int> ids) |
| | | { |
| | | string sql = string.Format("select id, name, url, path, type, status, dirid, depid, min, max, json, create_user, create_time, update_user, update_time, st_astext(geom) geom, bak from lf.sys_publish where id in ({0}) order by id desc", string.Join(",", ids)); |
| | | DataTable dt = Tools.DBHelper.GetDataTable(sql); |
| | | List<SysPublish> list = ModelHandler.FillModel<SysPublish>(dt); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取参数列表 |
| | | /// </summary> |
| | | public static List<DbParameter> GetParams<T>(string sql, T t) |