删除我呢见相关接口

pull/1/head
潘建东 9 months ago
parent e43b603bc6
commit 5fd5b7854e

@ -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<string, string> {
// { "Id","="}
// },
// Data = new Dictionary<string, object> {
// {"Id",fileId }
// }
// }));
// }
// catch (Exception e)
// {
// return BadRequest(e.Message);
// }
//}
//[HttpGet("getfile")]
//public ActionResult GetFile([FromQuery] string fileId)
//{
// try
// {
// var _file = _HadoopService.QuerySingle<HDP_File>(new HDP_Command
// {
// TableId = "HDP_File",
// Where = new Dictionary<string, string>
// {
// {"Id","=" }
// },
// Data = new Dictionary<string, object>
// {
// {"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<HDP_File>(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<HDP_File>(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")] [HttpPost("insert")]
public ActionResult Insert(HDP_Command command) public ActionResult Insert(HDP_Command command)
{ {

@ -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
{
/// <summary>
/// 文件
/// </summary>
[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;
/// <summary>
/// 编号
/// </summary>
[HDP_Column(Key = "Id", Description = "编号",Length = 100,DataType = HDP_ColumnDataType.VARCHAR,IsPrimary = true,InsertDefault = "UUID()")]
public string? Id { get => _Id; set => _Id = value; }
/// <summary>
/// 文件名
/// </summary>
[HDP_Column(Key = "FileName",Description = "文件名",Length = 100, DataType = HDP_ColumnDataType.VARCHAR)]
public string? FileName { get => _FileName; set => _FileName = value; }
/// <summary>
/// 文件类型
/// </summary>
[HDP_Column(Key = "ContentType",Description = "文件类型",Length = 100,DataType = HDP_ColumnDataType.VARCHAR)]
public string? ContentType { get => _ContentType; set => _ContentType = value; }
/// <summary>
/// 文件数据
/// </summary>
[HDP_Column(Key = "Data",Description = "文件数据",DataType = HDP_ColumnDataType.LONGBLOB)]
public byte[]? Data { get => _Data; set => _Data = value; }
/// <summary>
/// 创建日期
/// </summary>
[HDP_Column(Key = "CreateDate", Description = "创建日期",DataType = HDP_ColumnDataType.DATETIME)]
public DateTime? CreateDate { get => createDate; set => createDate = value; }
/// <summary>
/// 文件大小
/// </summary>
[HDP_Column(Key = "FileSize",Description = "文件大小",DataType = HDP_ColumnDataType.INT)]
public int? FileSize { get => _FileSize; set => _FileSize = value; }
}
}

@ -462,48 +462,6 @@ namespace ZKLT.Hadoop
return _TableService.Query<HDP_Table>(_Source, GetTable("HDP_Table")!, command.Where!, command.Data!, command.Order!); return _TableService.Query<HDP_Table>(_Source, GetTable("HDP_Table")!, command.Where!, command.Data!, command.Order!);
} }
///// <summary>
///// 插入文件
///// </summary>
///// <param name="file">文件</param>
///// <returns>是否成功</returns>
//public bool InsertFile(HDP_File file)
//{
// if (!string.IsNullOrEmpty(file.Id) && _TableService.QuerySingle<HDP_File>(_Source, GetTable("HDP_File")!, new Dictionary<string, string> {
// { "Id","=" }
// }, new Dictionary<string, object> {
// {"Id",file.Id }
// }) != null)
// {
// throw new ArgumentException("文件编号已存在");
// }
// return _TableService.Insert(_Source, GetTable("HDP_File")!, HDP_Table.Class2Dictionary(file));
//}
///// <summary>
///// 删除文件
///// </summary>
///// <param name="fileId">文件编号</param>
///// <returns>是否成功</returns>
//public bool DeleteFile(string fileId)
//{
// if (string.IsNullOrEmpty(fileId) || _TableService.QuerySingle<HDP_File>(_Source, GetTable("HDP_File")!, new Dictionary<string, string> {
// { "Id","=" }
// }, new Dictionary<string, object> {
// {"Id",fileId }
// }) == null)
// {
// throw new ArgumentException("文件编号不存在");
// }
// return _TableService.Delete(_Source, GetTable("HDP_File")!, new Dictionary<string, string> {
// {"Id","=" }
// }, new Dictionary<string, object> {
// {"Id",fileId }
// });
//}
/// <summary> /// <summary>
/// 插入数据 /// 插入数据
/// </summary> /// </summary>

Loading…
Cancel
Save