管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-08-21 168fa6d53cf21bedeb65b299603b6961b93c1b41
修改元数据实体类,添加数据插入方法
已修改3个文件
79 ■■■■ 文件已修改
DataLoader/CS/Importor.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/MetaHelper.cs 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/Model/SysMeta.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/Importor.cs
@@ -88,7 +88,7 @@
            vd.Meta = new SysMeta();
            vd.Meta.name = fi.Name;
            //vd.Meta.dirid = Common.DirId;
            vd.Meta.depid = 1;
            //vd.Meta.depid = 1;
            vd.Meta.verid = 0;
            vd.Meta.type = fi.Extension.ToLower().Replace(".", "");
            vd.Meta.sizes = Tools.SizeToMb(fi.Length);
@@ -198,8 +198,8 @@
            SysMeta mf = new SysMeta();
            mf.eventid = Guid.NewGuid().ToString();
            mf.metaid = 0;
            mf.dirid = vd.Meta.dirid;
            mf.depid = vd.Meta.depid;
            //mf.dirid = vd.Meta.dirid;
            //mf.depid = vd.Meta.depid;
            mf.verid = vd.Meta.verid;
            mf.name = vd.Meta.name;
            mf.type = vd.Meta.type;
DataLoader/CS/MetaHelper.cs
@@ -1,13 +1,36 @@
using System;
using DataLoader.Model;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataLoader.CS
{
    /// <summary>
    /// 元数据帮助类
    /// </summary>
    public class MetaHelper
    {
        // id, eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, update_user, update_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct
        public static string insertSql = "insert into lf.sys_meta (eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct) values (@eventid, @metaid, @verid, @name, @type, @guid, @path, @sizes, @tab, @rows, @create_user, now(), @bak, @geom, @layer, @depcode, @dircode, @ismeta, @sensortype, @acq_time, @resolution, @gridsize, @coor_sys, @epsg, @h_datum, @mata_type, @bands, @band_type, @ct) returning id";
        /// <summary>
        /// 插入数据
        /// </summary>
        public int Insert(List<SysMeta> list)
        {
            PostgreHelper db = Tools.DBHelper;
            int count = 0;
            foreach (SysMeta meta in list)
            {
                List<DbParameter> args = Tools.GetParams<SysMeta>(insertSql, meta)
                    ;
                int id = db.GetIntScalar(insertSql, args.ToArray());
                if (id > 0) count++;
            }
            return count;
        }
    }
}
DataLoader/Model/SysMeta.cs
@@ -1,4 +1,7 @@
using System;
using OSGeo.GDAL;
using System;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Policy;
namespace DataLoader.Model
{
@@ -7,15 +10,16 @@
    /// </summary>
    public class SysMeta
    {
        public SysMeta() { }
        /// <summary>
        ///
        /// </summary>
        public int id { set; get; }
        public string eventid { set; get; }
        public int metaid { set; get; }
        public int dirid { set; get; }
        public int depid { set; get; }
        public int verid { set; get; }
@@ -45,6 +49,34 @@
        public string geom { set; get; }
        public SysMeta() { }
        public string layer { set; get; }
        public string depcode { set; get; }
        public string dircode { set; get; }
        public int ismeta { set; get; }
        public string sensortype { set; get; }
        public DateTime acq_time { set; get; }
        public string resolution { set; get; }
        public string gridsize { set; get; }
        public string coor_sys { set; get; }
        public string epsg { set; get; }
        public string h_datum { set; get; }
        public string mata_type { set; get; }
        public string bands { set; get; }
        public string band_type { set; get; }
        public string ct { set; get; }
    }
}