Commit 50ad3625 by wuwenlong

sql iplat/eplat to schema

parent 736c8cf2
......@@ -448,10 +448,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -490,10 +490,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -526,10 +526,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -558,10 +558,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -590,10 +590,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -632,10 +632,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -679,10 +679,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -718,10 +718,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -757,10 +757,10 @@
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
FROM ${platSchema}.TXSOG01 A
JOIN ${platSchema}.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN ${platSchema}.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN ${platSchema}.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
......@@ -774,7 +774,7 @@
<select id="queryCompanyCode" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
select COMPANY_CODE from iplat.XS_USER where 1=1
select COMPANY_CODE from ${platSchema}.XS_USER where 1=1
<isNotEmpty prepend=" AND " property="loginName">
LOGIN_NAME = #loginName#
</isNotEmpty>
......
......@@ -46,7 +46,7 @@
SELECT
ORG_ID AS "orgId",
ORG_CNAME AS "orgCname"
FROM iplat.TXSOG01
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND ORG_TYPE = 'factory' AND COMPANY_CODE = #companyCode#
AND IS_DELETED=0
......@@ -71,7 +71,7 @@
SELECT
ORG_ID AS "orgId",
ORG_CNAME AS "orgCname"
FROM iplat.TXSOG01
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND ORG_TYPE = 'factory' AND COMPANY_CODE = #companyCode#
AND IS_DELETED=0
......
......@@ -189,7 +189,7 @@
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
FROM ${platSchema}.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode#
......@@ -233,7 +233,7 @@
<select id="queryFile" resultClass="java.util.HashMap">
SELECT URL FROM iplat.TEUDM05 where RES_ID=#docId#
SELECT URL FROM ${platSchema}.TEUDM05 where RES_ID=#docId#
</select>
......@@ -351,7 +351,7 @@
<select id="queryFvalue" resultClass="java.util.HashMap">
SELECT DISTINCT FVALUE AS "fvalue" FROM iplat.TEDCC03 WHERE FKEY='docRootDir'
SELECT DISTINCT FVALUE AS "fvalue" FROM ${platSchema}.TEDCC03 WHERE FKEY='docRootDir'
</select>
<select id="pmBannerList" resultClass="java.util.HashMap">
......
......@@ -355,7 +355,7 @@
</isNotEmpty>-->
<!--<isNotEmpty prepend="and" property="companyCode">
ORG_ID in (
select ORG_ID FROM iplat.txsog01
select ORG_ID FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0'
and COMPANY_CODE = #companyCode#
<isNotEmpty prepend="and" property="orgEname">
......@@ -363,11 +363,11 @@
</isNotEmpty>
AND ORG_TYPE NOT IN ('factory','dept')
and FACTORY_CODE IN (
SELECT FACTORY_CODE FROM iplat.txsog01
SELECT FACTORY_CODE FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0' and COMPANY_CODE = #companyCode#
and ORG_ID IN (
SELECT ORG_ID FROM iplat.txsog02 T2
INNER JOIN iplat.xs_user xu ON t2.USER_ID = xu.USER_ID
SELECT ORG_ID FROM ${platSchema}.txsog02 T2
INNER JOIN ${platSchema}.xs_user xu ON t2.USER_ID = xu.USER_ID
WHERE xu.COMPANY_CODE = #companyCode#
ORDER BY T2.REC_CREATE_TIME desc
)
......
......@@ -538,7 +538,7 @@
when ITEM_CODE in ('4') then '4'
else '0' end "param1Field"
from
iplat.tedcm01
${platSchema}.tedcm01
where STATUS = '1' and CODESET_CODE = 'hpjx.hpkc.inventType'
<isNotEmpty prepend=" AND " property="itemCode">
$itemCode$
......
......@@ -235,7 +235,7 @@
ORG_ENAME AS "groupCode",
ORG_TYPE AS "orgType",
FACTORY_CODE as "factoryCode"
FROM iplat.txsog01
FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0'
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
......@@ -248,11 +248,11 @@
</isEmpty>
<isNotEmpty prepend=" AND " property="loginName">
FACTORY_CODE IN (
SELECT FACTORY_CODE FROM iplat.txsog01
SELECT FACTORY_CODE FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0' and COMPANY_CODE = #companyCode#
and ORG_ID = (
select ORG_ID from iplat.txsog02 T2
INNER JOIN iplat.xs_user xu ON t2.USER_ID = xu.USER_ID
select ORG_ID from ${platSchema}.txsog02 T2
INNER JOIN ${platSchema}.xs_user xu ON t2.USER_ID = xu.USER_ID
where xu.LOGIN_NAME = #loginName#
order by T2.REC_CREATE_TIME desc
limit 1
......@@ -273,7 +273,7 @@
select
ITEM_CODE as "groupType"
FROM
iplat.tedcm01
${platSchema}.tedcm01
where STATUS = '1' and CODESET_CODE = 'hpjx.hpjx.productionType'
<isNotEmpty prepend=" AND " property="itemCode">
$itemCode$
......
......@@ -106,16 +106,16 @@
FROM (
SELECT
@CODES as CODES,
(SELECT @CODES:=GROUP_CONCAT(PARENT_ORG_ID) FROM IPLAT.TXSOG01 WHERE FIND_IN_SET(ORG_ID, @CODES)
(SELECT @CODES:=GROUP_CONCAT(PARENT_ORG_ID) FROM ${platSchema}.TXSOG01 WHERE FIND_IN_SET(ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) as T1,
@LEVEL:=@LEVEL+1 as level
FROM IPLAT.TXSOG01,
FROM ${platSchema}.TXSOG01,
(select @CODES:=#orgId#, @LEVEL:= 0) T4
where @CODES is not null
) T2,
IPLAT.TXSOG01 T3
${platSchema}.TXSOG01 T3
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
<isNotEmpty prepend=" AND " property="orgType">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment