You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
180 lines
6.3 KiB
180 lines
6.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.DAL;
|
|
using QMAPP.Entity;
|
|
using QMAPP.FJC.Entity.EM;
|
|
using QMFrameWork.Data;
|
|
using QMFrameWork.Log;
|
|
|
|
namespace QMAPP.FJC.DAL.FuntionDescriptionDAL
|
|
{
|
|
public class FuntionDescriptionDAL : BaseDAL
|
|
{
|
|
#region 获取功能模块下拉框
|
|
/// <summary>
|
|
/// 获取信息
|
|
/// </summary>
|
|
/// <param name="">条件</param>
|
|
/// <returns>信息</returns>
|
|
public List<FuntionDescription> GetModelNameCombox()
|
|
{
|
|
List<DataParameter> parameters = new List<DataParameter>();
|
|
try
|
|
{
|
|
string sql = "SELECT MODELNAME FROM T_QM_FUNTIONDESCRIPTION group by MODELNAME";
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
return session.GetList<FuntionDescription>(sql, parameters.ToArray()).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "热点查询-获取功能模块下拉框"
|
|
});
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取菜单项下拉框
|
|
/// <summary>
|
|
/// 获取信息
|
|
/// </summary>
|
|
/// <param name="">条件</param>
|
|
/// <returns>信息</returns>
|
|
public List<FuntionDescription> GetMenuNameCombox(string ModelName)
|
|
{
|
|
List<DataParameter> parameters = new List<DataParameter>();
|
|
try
|
|
{
|
|
string sql = "SELECT MENUNAME FROM T_QM_FUNTIONDESCRIPTION where MODELNAME='" + ModelName + "' group by MENUNAME";
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
return session.GetList<FuntionDescription>(sql, parameters.ToArray()).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "热点查询-获取菜单项下拉框"
|
|
});
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取列表
|
|
/// <summary>
|
|
/// 获取列表
|
|
/// </summary>
|
|
/// <param name="condition">条件</param>
|
|
/// <param name="page">数据页</param>
|
|
/// <returns>数据页</returns>
|
|
public DataPage GetCountList(FuntionDescription condition, DataPage page)
|
|
{
|
|
string sql = null;
|
|
List<DataParameter> parameters = new List<DataParameter>();
|
|
try
|
|
{
|
|
sql = this.GetQuerySql(condition, ref parameters);
|
|
//分页关键字段及排序
|
|
page.KeyName = "MODELNAME";
|
|
page.SortExpression = "MODELNAME";
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
page = session.GetDataPage<FuntionDescription>(sql, parameters.ToArray(), page);
|
|
}
|
|
return page;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "热点查询-获取列表"
|
|
});
|
|
throw;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取查询语句
|
|
/// <summary>
|
|
/// 获取查询语句
|
|
/// </summary>
|
|
/// <param name="user">查询条件</param>
|
|
/// <param name="parameters">参数</param>
|
|
/// <returns>查询语句</returns>
|
|
private string GetQuerySql(FuntionDescription condition, ref List<DataParameter> parameters)
|
|
{
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder whereBuilder = new StringBuilder();
|
|
try
|
|
{
|
|
//构成查询语句
|
|
sqlBuilder.AppendLine(" SELECT MODELNAME,MENUNAME,FUNCTIONNAME,count(1) as useCount FROM T_QM_FUNCTIONRECORDER t1,T_QM_FUNTIONDESCRIPTION t2 ");
|
|
|
|
whereBuilder.Append(" where t1.CONTROLLER=t2.CONTROLLER and t1.action=t2.action");
|
|
//查询条件
|
|
if (string.IsNullOrEmpty(condition.MODELNAME) == false)
|
|
{
|
|
whereBuilder.Append(" AND MODELNAME =@MODELNAME");
|
|
parameters.Add(new DataParameter { ParameterName = "MODELNAME", DataType = DbType.String, Value = condition.MODELNAME });
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(condition.MENUNAME.Trim()) == false)
|
|
{
|
|
whereBuilder.Append(" AND MENUNAME =@MENUNAME");
|
|
parameters.Add(new DataParameter { ParameterName = "MENUNAME", DataType = DbType.String, Value = condition.MENUNAME });
|
|
}
|
|
if (string.IsNullOrEmpty(condition.STARTCREATEDATE) == false)
|
|
{
|
|
whereBuilder.Append(" AND CREATEDATE >= @STARTCREATEDATE");
|
|
parameters.Add(new DataParameter { ParameterName = "STARTCREATEDATE", DataType = DbType.String, Value = condition.STARTCREATEDATE });
|
|
}
|
|
if (string.IsNullOrEmpty(condition.ENDCREATEDATE) == false)
|
|
{
|
|
whereBuilder.Append(" AND CREATEDATE <= @ENDCREATEDATE");
|
|
parameters.Add(new DataParameter { ParameterName = "ENDCREATEDATE", DataType = DbType.String, Value = condition.ENDCREATEDATE });
|
|
}
|
|
|
|
|
|
if (whereBuilder.Length > 0)
|
|
{
|
|
//sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
|
|
sqlBuilder.Append(whereBuilder);
|
|
}
|
|
|
|
sqlBuilder.AppendLine(" group by MODELNAME,MENUNAME,FUNCTIONNAME ");
|
|
|
|
return sqlBuilder.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|