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

master
孙亮 10 months ago
parent 06d39aefbf
commit 33d5d22121

@ -990,22 +990,43 @@ namespace IBKLinker_Minio.Controller.MinioController
/// </summary>
/// <returns></returns>
[HttpPost, Route("GetStoragePath")]
public RequestEntity GetStoragePath(string FileName)
public RequestEntity GetStoragePath(GetStoragePathModel PathData)
{
RequestEntity request = new RequestEntity();
RequestEntity request = new RequestEntity();//定义返回集合
try
{
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
{
string sql = string.Empty;
IList<MinioStoragePath> result = new List<MinioStoragePath>();
if (!string.IsNullOrEmpty(FileName.ToString()))
IList<MinioStoragePath> result = new List<MinioStoragePath>();//定义查询到的list
if (PathData != null)//传输数据不为空
{
sql += " and FILE_NAME like'%" + FileName + "%'";
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 += 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.code = "0";
}
else
{
request.code = "1";
request.msg = "查询失败,请检查查询条件!";
request.data = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + " and CLEAR_FLAG='0' ORDER BY PK");
request.code = "0";
}
}
}
catch (Exception ex)

Loading…
Cancel
Save