尝试简化权限子句 20241010

ShenZhenCHJY
dengyu 1 month ago
parent 3b186ab65c
commit 668d61dd81

@ -15,6 +15,7 @@ using HcUtility.Comm;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.Account.Models.ChfeeDetail;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using org.junit.rules;
namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
{
@ -1937,18 +1938,20 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
{
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 INPUTBY 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 SALE 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 CUSTSERVICE 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 = " (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 INPUTBY 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 SALE 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 CUSTSERVICE 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 in(OP, SALE,DOC ,CUSTSERVICE) and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR INPUTBY in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR SALE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR CUSTSERVICE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')))";
//str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
// + " OR INPUTBY in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR SALE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR CUSTSERVICE 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 in(OP, SALE,DOC ,CUSTSERVICE) and COMPANYID='{companyid}' )";
}
else if (visiblerange == "0")
{

@ -25,6 +25,7 @@ using System.Linq;
using DSWeb.Common.DB;
using System.Data.Entity.Migrations;
using DSWeb.Areas.OA.Models.WorkFlow;
using org.junit.rules;
namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
{
@ -3363,20 +3364,21 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
{
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 INPUTBY 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 SALE 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 DOC 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 CUSTSERVICE 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 = " (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 INPUTBY 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 SALE 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 DOC 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 CUSTSERVICE 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 in(OP,INPUTBY, SALE,DOC ,CUSTSERVICE) and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR INPUTBY in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR SALE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR DOC in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR CUSTSERVICE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')))";
//str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
// + " OR INPUTBY in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR SALE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR DOC in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR CUSTSERVICE 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 in(OP,INPUTBY, SALE,DOC ,CUSTSERVICE) and COMPANYID='{companyid}' )";
}
else if (visiblerange == "5")
{

@ -1809,11 +1809,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
{
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 INPUTBY 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 SALE 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 CUSTSERVICE 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 = " (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 INPUTBY 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 SALE 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 CUSTSERVICE 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 in(OP,INPUTBY, SALE ,CUSTSERVICE) and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{

@ -15,6 +15,7 @@ using DSWeb.MvcShipping.Models.MsChFee;
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
using System.Data.SqlClient;
using DSWeb.MvcShipping.DAL.MsInfoClient;
using org.junit.rules;
namespace DSWeb.MvcShipping.DAL.MsChDui
{
@ -1956,20 +1957,22 @@ namespace DSWeb.MvcShipping.DAL.MsChDui
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " (b.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 b.SALE 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 b.DOC 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 b.CUSTSERVICE 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 = " (b.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 b.SALE 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 b.DOC 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 b.CUSTSERVICE 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 in(b.OP, b.SALE,b.DOC ,b.CUSTSERVICE) and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " (b.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR b.SALE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR b.DOC in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " OR b.CUSTSERVICE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
+ " )";
//str = " (b.OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR b.SALE in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR b.DOC in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "'))"
//+ " OR b.CUSTSERVICE 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 in(b.OP, b.SALE,b.DOC ,b.CUSTSERVICE) and COMPANYID='{companyid}')";
}
else if (visiblerange == "5")
{
@ -2079,14 +2082,15 @@ namespace DSWeb.MvcShipping.DAL.MsChDui
{
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=(select GID from [company] where codename='" + companyid + "')) and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')))";
//+ " OR INPUTBY 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 = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID=(select GID from [company] where codename='" + companyid + "')) and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')))";
////+ " OR INPUTBY 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 =OP and COMPANYID='{companyid}' and DEPTNAME='{deptname}')";
}
else if (visiblerange == "1")
{
str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID=(select GID from [company] where codename='" + companyid + "'))))";
//+ " OR INPUTBY in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "')))";
//str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID=(select GID from [company] where codename='" + companyid + "'))))";
// //+ " OR INPUTBY 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 =OP and COMPANYID='{companyid}')";
}
else if (visiblerange == "5")
{

Loading…
Cancel
Save