继续优化权限查询子句

ShenZhenCHJY
dengyu 1 month ago
parent 668d61dd81
commit cad72e6525

@ -2625,12 +2625,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoicehexiao
{
var rangeDa = new RangeDA();
var deptid = rangeDa.GetDEPTGID(userid);
str = " OP in (select showname from vw_user where deptid='" + deptid + "') ";
//str = " OP in (select showname from vw_user where deptid='" + deptid + "') ";
str = $"exists(select 1 from vw_user where SHOWNAME=OP and COMPANYID='{companyid}' and deptid='{deptid}')";
}
else if (visiblerange == "1")
{
str = " OP in (select showname from vw_user where COMPANYID='" + companyid + "') ";
//str = " OP in (select showname from vw_user where COMPANYID='" + companyid + "') ";
str = $"exists(select 1 from vw_user where SHOWNAME=OP and COMPANYID='{companyid}')";
}
else if (visiblerange == "5")
{

@ -9,6 +9,7 @@ using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.EntityDA;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using org.junit.rules;
namespace DSWeb.MvcShipping.DAL.MsCodeExcelExpFormatDAL
{
@ -375,12 +376,13 @@ namespace DSWeb.MvcShipping.DAL.MsCodeExcelExpFormatDAL
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))";
//str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))";
str = $" exists(select 1 from vw_user where SHOWNAME =S.OP and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')) ";
//str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')) ";
str = $" exists(select 1 from vw_user where SHOWNAME =S.OP and COMPANYID='{companyid}' )";
}
else if (visiblerange == "0")
{

@ -15,6 +15,7 @@ using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
using System.Linq;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcShipping.Models.MsChFee;
using org.junit.rules;
namespace DSWeb.MvcShipping.DAL.MsCodeExcelImpFormatDAL
{
@ -748,12 +749,13 @@ namespace DSWeb.MvcShipping.DAL.MsCodeExcelImpFormatDAL
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))";
//str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))";
str = $" exists(select 1 from vw_user where SHOWNAME =S.OP and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')) ";
//str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')) ";
str = $" exists(select 1 from vw_user where SHOWNAME =S.OP and COMPANYID='{companyid}' )";
}
else if (visiblerange == "0")
{

@ -9,6 +9,7 @@ using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.EntityDA;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using org.junit.rules;
namespace DSWeb.MvcShipping.DAL.MsCodeServiceFeeTemplateDAL
{
@ -413,12 +414,13 @@ namespace DSWeb.MvcShipping.DAL.MsCodeServiceFeeTemplateDAL
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))";
//str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))";
str = $" exists(select 1 from vw_user where SHOWNAME =S.OP and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')) ";
//str = " S.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')) ";
str = $" exists(select 1 from vw_user where SHOWNAME =S.OP and COMPANYID='{companyid}' )";
}
else if (visiblerange == "0")
{

@ -17,6 +17,7 @@ using HcUtility.Core;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.Models.MsSeaeOrder;
using org.junit.rules;
namespace DSWeb.MvcShipping.DAL.MsOpAireDAL
@ -1472,10 +1473,10 @@ namespace DSWeb.MvcShipping.DAL.MsOpAireDAL
{
var rangeDa = new RangeDA();
var deptid = rangeDa.GetDEPTGID(userid);
str = " (B.OP in (select showname from vw_user where deptgid='" + deptid + "') OR B.SALE in (select showname from vw_user where deptgid='" + deptid + "') OR B.CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') "
+ " OR B.DOC in (select showname from vw_user where deptgid='" + deptid + "') OR B.FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') OR B.INPUTBY in (select showname from vw_user where deptgid='" + deptid + "'))";
//str = " (B.OP in (select showname from vw_user where deptgid='" + deptid + "') OR B.SALE in (select showname from vw_user where deptgid='" + deptid + "') OR B.CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') "
//+ " OR B.DOC in (select showname from vw_user where deptgid='" + deptid + "') OR B.FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') OR B.INPUTBY in (select showname from vw_user where deptgid='" + deptid + "'))";
str = $" exists(select 1 from vw_user where SHOWNAME in (B.OP,B.SALE,B.CUSTSERVICE,B.FRCUSTSERVICE,B.INPUTBY) and COMPANYID='{companyid}' and deptgid='{deptid}')";
}
else
{

@ -4941,8 +4941,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaiDAL
{
var rangeDa = new RangeDA();
var deptid = rangeDa.GetDEPTGID(userid);
str = " (OP in (select showname from vw_user where deptgid='" + deptid + "') OR SALE in (select showname from vw_user where deptgid='" + deptid + "') OR CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') "
+ " OR DOC in (select showname from vw_user where deptgid='" + deptid + "') OR FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') OR INPUTBY in (select showname from vw_user where deptgid='" + deptid + "'))";
//str = " (OP in (select showname from vw_user where deptgid='" + deptid + "') OR SALE in (select showname from vw_user where deptgid='" + deptid + "') OR CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') "
//+ " OR DOC in (select showname from vw_user where deptgid='" + deptid + "') OR FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') OR INPUTBY in (select showname from vw_user where deptgid='" + deptid + "'))";
str = $" exists(select 1 from vw_user where SHOWNAME in(OP,SALE,DOC,INPUTBY,CUSTSERVICE,FRCUSTSERVICE) and deptgid='{deptid}') ";
}
else if (visiblerange == "1")
{

@ -1810,8 +1810,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSocCtnDAL
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))"
+ " OR CREATEUSER in (select GID from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')))";
//str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))"
//+ " OR CREATEUSER in (select GID from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')))";
str = $" exists(select 1 from vw_user where SHOWNAME in(OP,CREATEUSER) and COMPANYID='{companyid}'and DEPTNAME='{deptname}') ";
}
else if (visiblerange == "1")
{

Loading…
Cancel
Save