(select A.COMPANY_CODE,A.PROJ_CODE ,sum(ifnull(A.NUM,0)) as JHNUM,sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) as RKNUM,sum(ifnull(B.AMOUNT,0)) as CKNUM,
case when sum(ifnull(A.NUM,0)) <![CDATA[ <> ]]> sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) and sum(ifnull(A.NUM,0)) <![CDATA[ <> ]]> sum(ifnull(B.AMOUNT,0)) then 1
when sum(ifnull(A.NUM,0)) = sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) and sum(ifnull(A.NUM,0)) <![CDATA[ <> ]]> sum(ifnull(B.AMOUNT,0)) then 2
when sum(ifnull(A.NUM,0)) = sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) and sum(ifnull(A.NUM,0)) = sum(ifnull(B.AMOUNT,0)) then 3 else 0 end as PROJ_STATUS
from hpjx.T_HPSC004 a
left join hpjx.T_HPKC004 b on a.PROJ_CODE = b.PROJ_CODE and a.PRDT_CODE = b.SUB_INVENT_CODE
from ${hpjxSchema}.T_HPSC004 a
left join ${hpjxSchema}.T_HPKC004 b on a.PROJ_CODE = b.PROJ_CODE and a.PRDT_CODE = b.SUB_INVENT_CODE
group by COMPANY_CODE,PROJ_CODE) b on a.COMPANY_CODE = b.COMPANY_CODE and a.PROJ_CODE = b.PROJ_CODE
left join ( select COMPANY_CODE,PROJ_CODE,PARENT_ID
from hpjx.T_HPSC002 where PARENT_ID NOT IN ('root') AND DEL_STATUS = 0 and PRDT_TYPE = 4
from ${hpjxSchema}.T_HPSC002 where PARENT_ID NOT IN ('root') AND DEL_STATUS = 0 and PRDT_TYPE = 4
group by COMPANY_CODE,PROJ_CODE,PARENT_ID) c on a.COMPANY_CODE = c.COMPANY_CODE and a.PROJ_CODE = c.PROJ_CODE
LEFT JOIN ${hpjxSchema}.t_hpsc005 B on A.ID = B.MAT_ID
WHERE 1=1
AND PARENT_ID NOT IN ('root')
AND DEL_STATUS = 0
...
...
@@ -206,14 +206,14 @@
SELECT
<includerefid="column1"/>
,ifnull(C.CKNUM,0) as "cknum",ifnull(C.RKNUM,0) as "rknum",ifnull(C.PROJ_STATUS,1) as "projStatus"
FROM hpjx.t_hpsc002 A
LEFT JOIN hpjx.t_hpsc005 B on A.ID = B.MAT_ID
FROM ${hpjxSchema}.t_hpsc002 A
LEFT JOIN ${hpjxSchema}.t_hpsc005 B on A.ID = B.MAT_ID
LEFT JOIN (select A.COMPANY_CODE,A.PROJ_CODE,A.PRDT_CODE,A.PARENT_PRDT_NAME,sum(ifnull(A.NUM,0)) as JHNUM,sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) as RKNUM,sum(ifnull(B.AMOUNT,0)) as CKNUM,
case when sum(ifnull(A.NUM,0)) <![CDATA[ <> ]]> sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) and sum(ifnull(A.NUM,0)) <![CDATA[ <> ]]> sum(ifnull(B.AMOUNT,0)) then 1
when sum(ifnull(A.NUM,0)) = sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) and sum(ifnull(A.NUM,0)) <![CDATA[ <> ]]> sum(ifnull(B.AMOUNT,0)) then 2
when sum(ifnull(A.NUM,0)) = sum(ifnull(A.ACTUAL_COMPLETION_NUM,0)) and sum(ifnull(A.NUM,0)) = sum(ifnull(B.AMOUNT,0)) then 3 else 0 end as PROJ_STATUS
from hpjx.T_HPSC004 a
left join hpjx.T_HPKC004 b on a.PROJ_CODE = b.PROJ_CODE and a.PRDT_CODE = b.SUB_INVENT_CODE
from ${hpjxSchema}.T_HPSC004 a
left join ${hpjxSchema}.T_HPKC004 b on a.PROJ_CODE = b.PROJ_CODE and a.PRDT_CODE = b.SUB_INVENT_CODE
group by A.COMPANY_CODE,A.PROJ_CODE,A.PRDT_CODE,A.PARENT_PRDT_NAME) C on A.COMPANY_CODE = C.COMPANY_CODE and A.PROJ_CODE = C.PROJ_CODE
and A.PARENT_PRDT_NAME = C.PARENT_PRDT_NAME and A.PRDT_CODE = C.PRDT_CODE
WHERE 1=1
...
...
@@ -231,7 +231,7 @@
SELECT
COALESCE(SUM(NUM), 0) AS "num", <!-- 数量 -->
COALESCE(SUM(TOTAL_WT), 0) AS "totalWt" <!-- 重量 -->
FROM hpjx.t_hpsc002 WHERE 1=1
FROM ${hpjxSchema}.t_hpsc002 WHERE 1=1
AND PARENT_ID NOT IN ('root')
AND DEL_STATUS = 0
<includerefid="condition"/>
...
...
@@ -239,14 +239,14 @@
<selectid="count"resultClass="int">
SELECT COUNT(*)
FROM hpjx.t_hpsc002 WHERE 1=1
FROM ${hpjxSchema}.t_hpsc002 WHERE 1=1
AND PARENT_ID NOT IN ('root')
AND DEL_STATUS = 0
<includerefid="condition"/>
</select>
<insertid="insert">
INSERT INTO hpjx.t_hpsc002 (ID,
INSERT INTO ${hpjxSchema}.t_hpsc002 (ID,
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
...
...
@@ -291,17 +291,17 @@
<!-- 删除 -->
<deleteid="delete">
DELETE FROM hpjx.t_hpsc002 WHERE ID = #id#
DELETE FROM ${hpjxSchema}.t_hpsc002 WHERE ID = #id#
</delete>
<!-- 删除 -->
<deleteid="deleteByPro">
DELETE FROM hpjx.t_hpsc002 WHERE PROJ_CODE = #projCode#
DELETE FROM ${hpjxSchema}.t_hpsc002 WHERE PROJ_CODE = #projCode#