增加对文件名称的模糊查询,时间查询

master
孙亮 1 year ago
parent 06d39aefbf
commit 33d5d22121

@ -990,23 +990,44 @@ namespace IBKLinker_Minio.Controller.MinioController
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("GetStoragePath")] [HttpPost, Route("GetStoragePath")]
public RequestEntity GetStoragePath(string FileName) public RequestEntity GetStoragePath(GetStoragePathModel PathData)
{ {
RequestEntity request = new RequestEntity(); RequestEntity request = new RequestEntity();//定义返回集合
try try
{ {
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db")) using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
{ {
string sql = string.Empty; string sql = string.Empty;
IList<MinioStoragePath> result = new List<MinioStoragePath>(); IList<MinioStoragePath> result = new List<MinioStoragePath>();//定义查询到的list
if (!string.IsNullOrEmpty(FileName.ToString())) if (PathData != null)//传输数据不为空
{
if (!string.IsNullOrEmpty(PathData.FileName.ToString()))//如果有名称模糊查询
{
sql += " and FILE_NAME like'%" + PathData.FileName + "%'";
}
if (PathData.Upk >0) //如果在子文件夹内
{
sql += " and UPK = '"+ PathData .Upk+ "'";
}
if (!string.IsNullOrEmpty(PathData.BeginTime))//如果有开始时间
{ {
sql += " and FILE_NAME like'%" + FileName + "%'"; sql += string.Format(" and CREATE_TIME >= to_date('{0}', 'yyyy/mm/dd hh24:mi:ss')", PathData.BeginTime);//开始时间
}
if (!string.IsNullOrEmpty(PathData.EndTime))//如果有结束时间
{
sql += string.Format(" and CREATE_TIME <= to_date('{0}', 'yyyy/mm/dd hh24:mi:ss')", PathData.EndTime);//结束时间
} }
request.data = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + " and CLEAR_FLAG='0' ORDER BY PK"); request.data = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + " and CLEAR_FLAG='0' ORDER BY PK");
request.code = "0"; request.code = "0";
} }
else
{
request.code = "1";
request.msg = "查询失败,请检查查询条件!";
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {

Loading…
Cancel
Save