管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-08-21 168fa6d53cf21bedeb65b299603b6961b93c1b41
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using DataLoader.Model;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
 
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;
        }
    }
}