diff --git a/DSWeb/Areas/Account/DAL/Chfee_ForeignPay/Chfee_ForeignPayDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_ForeignPay/Chfee_ForeignPayDAL.cs index ce1d5b92..3cea72a4 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_ForeignPay/Chfee_ForeignPayDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_ForeignPay/Chfee_ForeignPayDAL.cs @@ -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") { diff --git a/DSWeb/Areas/Account/DAL/Chfee_invoiceapplication/Chfee_InvoiceapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_invoiceapplication/Chfee_InvoiceapplicationDAL.cs index 205d0575..62669d3e 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_invoiceapplication/Chfee_InvoiceapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_invoiceapplication/Chfee_InvoiceapplicationDAL.cs @@ -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") { diff --git a/DSWeb/Areas/Account/DAL/Chfee_recvapplication/Chfee_RecvapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_recvapplication/Chfee_RecvapplicationDAL.cs index ac7073c3..a65db9d3 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_recvapplication/Chfee_RecvapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_recvapplication/Chfee_RecvapplicationDAL.cs @@ -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") { diff --git a/DSWeb/Areas/MvcShipping/DAL/MsChDui/MsChDuiDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsChDui/MsChDuiDAL.cs index 6712298a..bcd4ef8a 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsChDui/MsChDuiDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsChDui/MsChDuiDAL.cs @@ -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") {