SVN-Revision: r499
This commit is contained in:
wyf
2025-04-18 08:28:35 +00:00
parent 7d064e9555
commit 006deaa14c
3 changed files with 86 additions and 97 deletions
+20 -27
View File
@@ -1201,8 +1201,26 @@ namespace Lskj.Business.Impl
{ {
try try
{ {
string sqlValue = "select * from p_systemDlltabDetail where tab=@tab and (charindex('," + ERPInfo.Instance.UserName + ",',','+privilegeOper+',')>0 or isnull(privilegeOper,'')='') and ISNULL(isVisible,0)=0 order by orderid"; string sqlTemplate = @"WITH UserRoles AS (
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) }); SELECT r.roleName
FROM p_systemRoleOperSetTab AS ro
JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId
WHERE ro.operatorname = '{0}'
)
SELECT pm.*
FROM p_systemDlltabDetail AS pm WITH (NOLOCK)
WHERE ISNULL(pm.isvisible, 0) = 0
AND pm.tab = '{1}'
AND (
ISNULL(pm.privilegeOper, '') = ''
OR CHARINDEX(',' + '{0}' + ',', ',' + pm.privilegeOper + ',') > 0
OR EXISTS (
SELECT 1
FROM UserRoles AS ur
WHERE CHARINDEX('{{&' + ur.roleName + '&}}', pm.privilegeOper) > 0)
) ORDER BY pm.orderid;";
string sqlValue = string.Format(sqlTemplate, ERPInfo.Instance.UserName, menuCode);
return SqlHelper.ExecuteDataTable(sqlValue);
} }
catch (Exception) catch (Exception)
{ {
@@ -1260,29 +1278,4 @@ namespace Lskj.Business.Impl
/// <param name="comfirmAdvice">确认意见.</param> /// <param name="comfirmAdvice">确认意见.</param>
/// <returns>System.Int32.</returns> /// <returns>System.Int32.</returns>
public static bool isParamComplete(string storedName, string[] Param) public static bool isParamComplete(string storedName, string[] Param)
{
string whereConfig = string.Empty;
for (int i = 0; i < Param.Length; i++)
{
whereConfig += string.Format(" LOWER(PARAMETER_NAME)=LOWER('{0}') or", Param[i]);
}
string sql = string.Format("SELECT PARAMETER_NAME AS [参数名称] FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME='{1}' and ({0})", whereConfig.Substring(0, whereConfig.Length - 2), storedName);
return SqlHelper.ExecuteDataTable(sql).Rows.Count == Param.Length;
}
/// <summary>
/// 创建只读列
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static DataTable getDetail_Details(string key)
{
string sql = string.Format("select * from p_systembillsourcedetail where sourceid=0 and sourcekey='{0}' and mxflag=1 and isnull(isVisible,0)=0 order by orderid", key);
return GetDataTableResult(sql);
}
}
}
+18 -3
View File
@@ -590,15 +590,30 @@ namespace Lskj.Business.Impl
conditions = "and isnull(mxflag,0)=0"; conditions = "and isnull(mxflag,0)=0";
} }
string cond = !string.IsNullOrEmpty(sourceCond) ? string.Format(" and id in ({0})", sourceCond.Trim(',')) : string.Empty; string cond = !string.IsNullOrEmpty(sourceCond) ? string.Format(" and id in ({0})", sourceCond.Trim(',')) : string.Empty;
string sqlValue = string.Format("select * from p_systembillsource where typeCode=@typeCode" + cond + " and isnull(isVisible,0)=0 and (isnull(viewOper,'')='' or CHARINDEX(',' + '{0}' + ',', ',' + viewOper + ',')>0) order by orderid", ERPInfo.Instance.UserName); string sqlValue = string.Format(@"WITH UserRoles AS (
string sqlDetail = string.Format(@"SELECT id,sourceId,fieldName,sysName,userName,orderid,isVisible,sourceKey,privilegeView,DataFormat,isSum,ifmerge,{2} SELECT r.roleName
FROM p_systemRoleOperSetTab AS ro
JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId
WHERE ro.operatorname = '{0}'
)
select * from p_systembillsource where typeCode=@typeCode" + cond +
@" and isnull(isVisible,0)=0 and (isnull(viewOper,'')='' or CHARINDEX(',' + '{0}' + ',', ',' + viewOper + ',')>0 OR EXISTS (
SELECT 1 FROM UserRoles AS ur WHERE CHARINDEX('{{&' + ur.roleName + '&}}', viewOper) > 0)) order by orderid", ERPInfo.Instance.UserName);
string sqlDetail = string.Format(@"WITH UserRoles AS (
SELECT r.roleName
FROM p_systemRoleOperSetTab AS ro
JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId
WHERE ro.operatorname = '{0}'
)
SELECT id,sourceId,fieldName,sysName,userName,orderid,isVisible,sourceKey,privilegeView,DataFormat,isSum,ifmerge,{2}
isnull(CASE WHEN isVisible=1 OR (ISNULL(b.userList,'')='' AND ISNULL(a.PrivilegeView,'')<>'') THEN 0 ELSE width END,0) width isnull(CASE WHEN isVisible=1 OR (ISNULL(b.userList,'')='' AND ISNULL(a.PrivilegeView,'')<>'') THEN 0 ELSE width END,0) width
FROM p_systembillsourcedetail a FROM p_systembillsourcedetail a
LEFT JOIN ( LEFT JOIN (
SELECT userList,privTypeId from p_systemPrivilege b where modId = '{0}' SELECT userList,privTypeId from p_systemPrivilege b where modId = '{0}'
AND CHARINDEX(',' + '{1}' + ',', ',' + userList + ',') > 0 AND CHARINDEX(',' + '{1}' + ',', ',' + userList + ',') > 0
) b on CHARINDEX(',' + CAST(b.privTypeId AS VARCHAR(5)) + ',',',' + PrivilegeView + ',') > 0 ) b on CHARINDEX(',' + CAST(b.privTypeId AS VARCHAR(5)) + ',',',' + PrivilegeView + ',') > 0
where sourceId in (select id from p_systembillsource where typeCode=@typeCode" + cond + " and isnull(isVisible,0)=0 and (isnull(viewOper,'')='' or CHARINDEX(',' + '{1}' + ',', ',' + viewOper + ',')>0)) {3} order by sourceId,orderid", menuCode, ERPInfo.Instance.UserName, otherfield, conditions); where sourceId in (select id from p_systembillsource where typeCode=@typeCode" + cond + @" and isnull(isVisible,0)=0 and (isnull(viewOper,'')='' or CHARINDEX(',' + '{1}' + ',', ',' + viewOper + ',')>0) OR EXISTS (
SELECT 1 FROM UserRoles AS ur WHERE CHARINDEX('{{&' + ur.roleName + '&}}', viewOper) > 0)) {3} order by sourceId,orderid", menuCode, ERPInfo.Instance.UserName, otherfield, conditions);
htTable["master"] = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) }); htTable["master"] = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) });
htTable["detail"] = SqlHelper.ExecuteDataTable(sqlDetail, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) }); htTable["detail"] = SqlHelper.ExecuteDataTable(sqlDetail, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) });
+10 -29
View File
@@ -23,7 +23,8 @@ namespace Lskj.Business.Impl
/// <returns>DataTable.</returns> /// <returns>DataTable.</returns>
public static DataTable GetPurview(string condition) public static DataTable GetPurview(string condition)
{ {
if (string.IsNullOrWhiteSpace(condition)) { if (string.IsNullOrWhiteSpace(condition))
{
string allSql = string.Format("select * from p_formmenuconfigtab where len(MenuStruct)>2"); string allSql = string.Format("select * from p_formmenuconfigtab where len(MenuStruct)>2");
return GetDataTableResult(allSql); return GetDataTableResult(allSql);
} }
@@ -218,10 +219,12 @@ namespace Lskj.Business.Impl
public static bool SaveRoleOperDate(string OperId, string OperName, string departemnt, string readdate, string editdate, bool IsBrowse) public static bool SaveRoleOperDate(string OperId, string OperName, string departemnt, string readdate, string editdate, bool IsBrowse)
{ {
string sqlValue = string.Empty; string sqlValue = string.Empty;
if (IsBrowse) { if (IsBrowse)
{
sqlValue = string.Format(" if exists (select * from p_systemRoleOperSetTab s where s.operatorid='{0}') update p_systemRoleOperSetTab set ReadPurview='{4}' where operatorid = '{0}' ELSE insert into p_systemRoleOperSetTab (roleId,roleOperatorId,operatorid,operatorname,operatedate,department,ReadPurview,EditPurview) values ('0','{0}','{0}','{1}','{2}','{3}','{4}','{5}')", OperId, OperName, DateTime.Now, departemnt, readdate, ""); sqlValue = string.Format(" if exists (select * from p_systemRoleOperSetTab s where s.operatorid='{0}') update p_systemRoleOperSetTab set ReadPurview='{4}' where operatorid = '{0}' ELSE insert into p_systemRoleOperSetTab (roleId,roleOperatorId,operatorid,operatorname,operatedate,department,ReadPurview,EditPurview) values ('0','{0}','{0}','{1}','{2}','{3}','{4}','{5}')", OperId, OperName, DateTime.Now, departemnt, readdate, "");
} }
else { else
{
sqlValue = string.Format(" if exists (select * from p_systemRoleOperSetTab s where s.operatorid='{0}') update p_systemRoleOperSetTab set EditPurview='{5}' where operatorid = '{0}' ELSE insert into p_systemRoleOperSetTab (roleId,roleOperatorId,operatorid,operatorname,operatedate,department,ReadPurview,EditPurview) values ('0','{0}','{0}','{1}','{2}','{3}','{4}','{5}')", OperId, OperName, DateTime.Now, departemnt, "", editdate); sqlValue = string.Format(" if exists (select * from p_systemRoleOperSetTab s where s.operatorid='{0}') update p_systemRoleOperSetTab set EditPurview='{5}' where operatorid = '{0}' ELSE insert into p_systemRoleOperSetTab (roleId,roleOperatorId,operatorid,operatorname,operatedate,department,ReadPurview,EditPurview) values ('0','{0}','{0}','{1}','{2}','{3}','{4}','{5}')", OperId, OperName, DateTime.Now, departemnt, "", editdate);
} }
@@ -514,10 +517,11 @@ namespace Lskj.Business.Impl
if (drs.Length < 1) continue; if (drs.Length < 1) continue;
string id = drs[0]["id"] + ""; string id = drs[0]["id"] + "";
DataTable PersonnelDt = GetWorkUsers(id); DataTable PersonnelDt = GetWorkUsers(id);
foreach (DataRow dr in PersonnelDt.Rows) { foreach (DataRow dr in PersonnelDt.Rows)
{
newName += dr["员工姓名"] + ","; newName += dr["员工姓名"] + ",";
} }
name=name.Replace(role, newName.TrimEnd(','));// name = name.Replace(role, newName.TrimEnd(','));
} }
@@ -709,27 +713,4 @@ namespace Lskj.Business.Impl
//拼接添加权限分类sql //拼接添加权限分类sql
//List<string> moduleNumbers = new List<string>(); //List<string> moduleNumbers = new List<string>();
//string Sql = string.Format("delete p_systemPrivilege where roleid='{0}';", roleid); //string Sql = string.Format("delete p_sy
//foreach (DataRow item in Module.Rows)
//{
// string PurviewId = item["PurviewId"] + "";
// if (!string.IsNullOrWhiteSpace(PurviewId) && !moduleNumbers.Contains(PurviewId))
// {
// moduleNumbers.Add(PurviewId);
// DataRow dr= GetDataRowResult(string.Format("select top 1 privTypeId from p_systemPrivilege where modId='{0}' order by privTypeId desc ", PurviewId));
// int privTypeId =1;
// if (dr != null) privTypeId = int.Parse(dr["privTypeId"] + "") + 1;
// Sql += string.Format(" insert into p_systemPrivilege(privTypeId,privTypeName,modId,userList,remark,roleid) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}'); ",
// privTypeId+"", roleName, PurviewId, text,"", roleid);
// }
//}
//ExecSqlValue(Sql);
}
}
}