添加图层发布
parent
69e0185ded
commit
2c54915cad
|
|
@ -1,7 +1,10 @@
|
|||
using DocumentFormat.OpenXml.Office2016.Excel;
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using DocumentFormat.OpenXml.Office2016.Excel;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Utils;
|
||||
using NetTopologySuite;
|
||||
using NetTopologySuite.Features;
|
||||
using NetTopologySuite.Geometries;
|
||||
using NetTopologySuite.IO;
|
||||
|
|
@ -18,6 +21,7 @@ using OpenAuth.Repository;
|
|||
using OpenAuth.Repository.Core;
|
||||
using OpenAuth.Repository.Domain.DataMaintenance;
|
||||
using Org.BouncyCastle.Asn1.Cms;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
|
@ -100,14 +104,43 @@ namespace OpenAuth.App.ServiceApp.DataMaintenance
|
|||
//添加应用
|
||||
public async Task<Response<bool>> Add(ApplicationData app)
|
||||
{
|
||||
app.Id = YitIdHelper.NextId();
|
||||
app.CreateUserId = _auth.GetCurrentUser().User.Id;
|
||||
app.CreateTime = DateTime.Now;
|
||||
if (await Repository.AsInsertable(app).ExecuteCommandAsync() > 0)
|
||||
return new Response<bool> { Result = true };
|
||||
else
|
||||
return new Response<bool> { Result = false, Message = "添加失败" };
|
||||
using (var db = UnitWork.CreateContext())
|
||||
{
|
||||
app.Id = YitIdHelper.NextId();
|
||||
app.CreateUserId = _auth.GetCurrentUser().User.Id;
|
||||
app.CreateTime = DateTime.Now;
|
||||
if (await db.ApplicationData.AsInsertable(app).ExecuteCommandAsync() > 0)
|
||||
{
|
||||
if (app.IsServer == 1)
|
||||
{
|
||||
//先插入一条数据
|
||||
var geography = NtsGeometryServices.Instance.CreateGeometryFactory(int.Parse("4326"));
|
||||
var point = geography.CreatePoint(new Coordinate(0, 0));
|
||||
await db.Db.InsertableByDynamic(new { Id = 0, geom = point.AsText() }).AS(app.TableName).ExecuteCommandAsync();
|
||||
var response = await GeoUtil.CreateStoreAndLayer("", "EPSG:4326", app.TableName, "");
|
||||
if (response)
|
||||
{
|
||||
//删除数据
|
||||
await db.Db.Deleteable<object>().AS(app.TableName).Where("\"Id\"=@Id", new { Id = 0 }).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
if (db.Commit())
|
||||
{
|
||||
return new Response<bool> { Result = true };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Response<bool> { Result = false, Message = "添加失败" };
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
return new Response<bool> { Result = false, Message = "添加失败" };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//编辑应用
|
||||
public async Task<Response<bool>> Update(ApplicationData app)
|
||||
{
|
||||
|
|
@ -589,7 +622,7 @@ namespace OpenAuth.App.ServiceApp.DataMaintenance
|
|||
}
|
||||
else
|
||||
{
|
||||
if(updateBatchDataReq.Ids != null && updateBatchDataReq.Ids.Count > 0)
|
||||
if (updateBatchDataReq.Ids != null && updateBatchDataReq.Ids.Count > 0)
|
||||
{
|
||||
var flag = await db.Db.Updateable<object>()
|
||||
.AS(updateBatchDataReq.TableName)
|
||||
|
|
@ -606,7 +639,7 @@ namespace OpenAuth.App.ServiceApp.DataMaintenance
|
|||
.Where($"\"{updateBatchDataReq.SingleField}\" = @OldValue", new { OldValue = updateBatchDataReq.OldValue })
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (db.Commit())
|
||||
|
|
|
|||
|
|
@ -78,6 +78,12 @@ namespace OpenAuth.Repository.Domain.DataMaintenance
|
|||
/// </summary>
|
||||
public int IsServer { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:表名
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:点线面
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
|
|
|
|||
Loading…
Reference in New Issue