From 5fd5b7854ee12aaa9c3a96df0b9d04438e64d4be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=BB=BA=E4=B8=9C?= <617601767@qq.com> Date: Tue, 12 Mar 2024 11:52:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=88=91=E5=91=A2=E8=A7=81?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HadoopController.cs | 131 ------------------ Hadoop/ZKLT.Hadoop.Model/HDP_File.cs | 64 --------- Hadoop/ZKLT.Hadoop/HadoopService.cs | 42 ------ 3 files changed, 237 deletions(-) delete mode 100644 Hadoop/ZKLT.Hadoop.Model/HDP_File.cs diff --git a/Hadoop/ZKLT.Hadoop.API/Controllers/HadoopController.cs b/Hadoop/ZKLT.Hadoop.API/Controllers/HadoopController.cs index 228cfdc..e74bf7f 100644 --- a/Hadoop/ZKLT.Hadoop.API/Controllers/HadoopController.cs +++ b/Hadoop/ZKLT.Hadoop.API/Controllers/HadoopController.cs @@ -151,137 +151,6 @@ namespace ZKLT.Hadoop.API.Controllers } } - //[HttpPost("insertfile")] - //public ActionResult InsertFile(IFormFile file, [FromQuery] string id = "") - //{ - // if (file == null) - // { - // return BadRequest("文件不存在"); - // } - // try - // { - // var _file = new HDP_File(); - // if (!string.IsNullOrEmpty(id)) - // { - // _file.Id = id; - // } - // else { - // _file.Id = Guid.NewGuid().ToString(); - // } - // _file.FileName = file.FileName; - // _file.ContentType = file.ContentType; - // _file.Data = new byte[file.Length]; - // file.OpenReadStream().Read(_file.Data, 0, (int)file.Length); - // _file.FileSize = (int)file.Length; - // if (_HadoopService.Insert(new HDP_Command - // { - // TableId = "HDP_File", - // Data = HDP_Table.Class2Dictionary(_file) - // })) - // { - // return Ok(_file.Id); - // } - // else { - // return Ok(false); - // } - - // } - // catch (Exception e) - // { - // return BadRequest(e.Message); - // } - //} - - //[HttpGet("deletefile")] - //public ActionResult DeleteFile([FromQuery] string fileId) - //{ - // try - // { - // return Ok(_HadoopService.Delete(new HDP_Command - // { - // TableId = "HDP_File", - // Where = new Dictionary { - // { "Id","="} - // }, - // Data = new Dictionary { - // {"Id",fileId } - // } - // })); - // } - // catch (Exception e) - // { - // return BadRequest(e.Message); - // } - //} - - //[HttpGet("getfile")] - //public ActionResult GetFile([FromQuery] string fileId) - //{ - // try - // { - // var _file = _HadoopService.QuerySingle(new HDP_Command - // { - // TableId = "HDP_File", - // Where = new Dictionary - // { - // {"Id","=" } - // }, - // Data = new Dictionary - // { - // {"Id",fileId } - // } - // }); - // if (_file != null) - // { - // return File(_file.Data!, _file.ContentType!); - // } - // else { - // return NoContent(); - // } - // } - // catch (Exception e) - // { - // return BadRequest(e.Message); - // } - //} - - //[HttpPost("queryfile")] - //public ActionResult QueryFile(HDP_Command command) - //{ - // try - // { - // var _files = _HadoopService.Query(command); - // for (var i = 0; i < _files.Length; i++) { - // _files[i].Data = null; - // } - // return Ok(_files); - // } - // catch (Exception e) - // { - // return BadRequest(e.Message); - // } - //} - - //[HttpPost("pagefile")] - //public ActionResult PageFile(HDP_Command command) - //{ - // try - // { - // var _filesPage = _HadoopService.Page(command); - // for (var i = 0; i < _filesPage.Data!.Length; i++) - // { - // _filesPage.Data[i]!.Data = null; - // } - // return Ok(_filesPage); - // } - // catch (Exception e) - // { - // return BadRequest(e.Message); - // } - //} - - - [HttpPost("insert")] public ActionResult Insert(HDP_Command command) { diff --git a/Hadoop/ZKLT.Hadoop.Model/HDP_File.cs b/Hadoop/ZKLT.Hadoop.Model/HDP_File.cs deleted file mode 100644 index cf00eff..0000000 --- a/Hadoop/ZKLT.Hadoop.Model/HDP_File.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ZKLT.Hadoop.Model -{ - /// - /// 文件 - /// - [HDP_Table(Key = "HDP_File", Description = "文件")] - public class HDP_File - { - private string? _Id; - - private string? _FileName; - - private string? _ContentType; - - private int? _FileSize; - - private byte[]? _Data; - - private DateTime? createDate; - - /// - /// 编号 - /// - [HDP_Column(Key = "Id", Description = "编号",Length = 100,DataType = HDP_ColumnDataType.VARCHAR,IsPrimary = true,InsertDefault = "UUID()")] - public string? Id { get => _Id; set => _Id = value; } - - /// - /// 文件名 - /// - [HDP_Column(Key = "FileName",Description = "文件名",Length = 100, DataType = HDP_ColumnDataType.VARCHAR)] - public string? FileName { get => _FileName; set => _FileName = value; } - - /// - /// 文件类型 - /// - [HDP_Column(Key = "ContentType",Description = "文件类型",Length = 100,DataType = HDP_ColumnDataType.VARCHAR)] - public string? ContentType { get => _ContentType; set => _ContentType = value; } - - /// - /// 文件数据 - /// - [HDP_Column(Key = "Data",Description = "文件数据",DataType = HDP_ColumnDataType.LONGBLOB)] - public byte[]? Data { get => _Data; set => _Data = value; } - - /// - /// 创建日期 - /// - [HDP_Column(Key = "CreateDate", Description = "创建日期",DataType = HDP_ColumnDataType.DATETIME)] - public DateTime? CreateDate { get => createDate; set => createDate = value; } - - /// - /// 文件大小 - /// - [HDP_Column(Key = "FileSize",Description = "文件大小",DataType = HDP_ColumnDataType.INT)] - public int? FileSize { get => _FileSize; set => _FileSize = value; } - } -} diff --git a/Hadoop/ZKLT.Hadoop/HadoopService.cs b/Hadoop/ZKLT.Hadoop/HadoopService.cs index d1cd93d..d345032 100644 --- a/Hadoop/ZKLT.Hadoop/HadoopService.cs +++ b/Hadoop/ZKLT.Hadoop/HadoopService.cs @@ -462,48 +462,6 @@ namespace ZKLT.Hadoop return _TableService.Query(_Source, GetTable("HDP_Table")!, command.Where!, command.Data!, command.Order!); } - ///// - ///// 插入文件 - ///// - ///// 文件 - ///// 是否成功 - //public bool InsertFile(HDP_File file) - //{ - // if (!string.IsNullOrEmpty(file.Id) && _TableService.QuerySingle(_Source, GetTable("HDP_File")!, new Dictionary { - // { "Id","=" } - // }, new Dictionary { - // {"Id",file.Id } - // }) != null) - // { - // throw new ArgumentException("文件编号已存在"); - // } - - // return _TableService.Insert(_Source, GetTable("HDP_File")!, HDP_Table.Class2Dictionary(file)); - //} - - ///// - ///// 删除文件 - ///// - ///// 文件编号 - ///// 是否成功 - //public bool DeleteFile(string fileId) - //{ - // if (string.IsNullOrEmpty(fileId) || _TableService.QuerySingle(_Source, GetTable("HDP_File")!, new Dictionary { - // { "Id","=" } - // }, new Dictionary { - // {"Id",fileId } - // }) == null) - // { - // throw new ArgumentException("文件编号不存在"); - // } - - // return _TableService.Delete(_Source, GetTable("HDP_File")!, new Dictionary { - // {"Id","=" } - // }, new Dictionary { - // {"Id",fileId } - // }); - //} - /// /// 插入数据 ///