|
@@ -9,6 +9,7 @@
|
|
|
COALESCE(SUM(COALESCE(PA.PROJECT_COST, 0)), 0) as cost
|
|
|
FROM PROJECT P
|
|
|
LEFT JOIN PROJECT_AMOUNT PA on PA.PROJECT_ID = P.ID
|
|
|
+ LEFT JOIN (SELECT PROJECT_ID,MAX(ID) as ID FROM CONTRACT WHERE FLOW_STATUS = 90 AND ISVALID = 1 GROUP BY PROJECT_ID ) T1 ON T1.PROJECT_ID = P.ID
|
|
|
<if test="params != null and params.userId != null and params.userId != ''">
|
|
|
LEFT JOIN PROJECT_WORKER_RELATION PW ON PW.PROJECT_ID = P.ID
|
|
|
</if>
|
|
@@ -32,8 +33,11 @@
|
|
|
<if test="params != null and params.lxsjOff != null">
|
|
|
AND P.LXSJ <= #{params.lxsjOff}
|
|
|
</if>
|
|
|
- <if test="params != null and params.isSign != null">
|
|
|
- AND P.IS_SIGN = #{params.isSign}
|
|
|
+ <if test="params != null and params.isSign == 1">
|
|
|
+ AND T1.ID is not null
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.isSign == 0">
|
|
|
+ AND T1.ID is null
|
|
|
</if>
|
|
|
<if test="params != null and params.xmmc != null and params.xmmc != ''">
|
|
|
<bind name="xmmc" value="'%'+params.xmmc+'%'"/>
|
|
@@ -76,6 +80,7 @@
|
|
|
FROM PROJECT P
|
|
|
LEFT JOIN PROJECT_AMOUNT PA ON PA.PROJECT_ID = P.ID
|
|
|
LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = P.ZRBM_ID
|
|
|
+ LEFT JOIN (SELECT PROJECT_ID,MAX(ID) as ID FROM CONTRACT WHERE FLOW_STATUS = 90 AND ISVALID = 1 GROUP BY PROJECT_ID ) T1 ON T1.PROJECT_ID = P.ID
|
|
|
<if test="params != null and params.isRelContract != null and params.isRelContract == 1">
|
|
|
LEFT JOIN (SELECT PID,count(1) as ccount FROM PROJECT WHERE FLOW_STATUS = 99 GROUP BY PID) CH ON CH.PID = P.ID
|
|
|
LEFT JOIN (SELECT PROJECT_ID,max(CONTRACT_NUMBER) as contractNumber FROM CONTRACT where FLOW_STATUS in (90,99) GROUP BY PROJECT_ID) C ON C.PROJECT_ID = P.ID
|
|
@@ -106,8 +111,11 @@
|
|
|
<if test="params != null and params.lxsjOff != null">
|
|
|
AND P.LXSJ <= #{params.lxsjOff}
|
|
|
</if>
|
|
|
- <if test="params != null and params.isSign != null">
|
|
|
- AND P.IS_SIGN = #{params.isSign}
|
|
|
+ <if test="params != null and params.isSign == 1">
|
|
|
+ AND T1.ID is not null
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.isSign == 0">
|
|
|
+ AND T1.ID is null
|
|
|
</if>
|
|
|
<if test="params != null and params.xmmc != null and params.xmmc != ''">
|
|
|
<bind name="xmmc" value="'%'+params.xmmc+'%'"/>
|
|
@@ -183,6 +191,7 @@
|
|
|
SUM(CASE WHEN P.XMZT = 3 THEN 1 ELSE 0 END) as terminated,
|
|
|
SUM(CASE WHEN P.XMZT = 4 THEN 1 ELSE 0 END) as accepted
|
|
|
FROM PROJECT P
|
|
|
+ LEFT JOIN (SELECT PROJECT_ID,MAX(ID) as ID FROM CONTRACT WHERE FLOW_STATUS = 90 AND ISVALID = 1 GROUP BY PROJECT_ID ) T1 ON T1.PROJECT_ID = P.ID
|
|
|
<if test="params != null and params.userId != null and params.userId != ''">
|
|
|
LEFT JOIN PROJECT_WORKER_RELATION PW ON PW.PROJECT_ID = P.ID
|
|
|
</if>
|
|
@@ -206,8 +215,11 @@
|
|
|
<if test="params != null and params.lxsjOff != null">
|
|
|
AND P.LXSJ <= #{params.lxsjOff}
|
|
|
</if>
|
|
|
- <if test="params != null and params.isSign != null">
|
|
|
- AND P.IS_SIGN = #{params.isSign}
|
|
|
+ <if test="params != null and params.isSign == 1">
|
|
|
+ AND T1.ID is not null
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.isSign == 0">
|
|
|
+ AND T1.ID is null
|
|
|
</if>
|
|
|
<if test="params != null and params.xmmc != null and params.xmmc != ''">
|
|
|
<bind name="xmmc" value="'%'+params.xmmc+'%'"/>
|
|
@@ -239,7 +251,7 @@
|
|
|
COALESCE(SUM(CASE WHEN T.XMZT = 4 THEN 1 ELSE 0 END),0) as accepted,
|
|
|
COALESCE(SUM(CASE WHEN T.XMZT = 1 THEN 1 ELSE 0 END),0) as unaccepted
|
|
|
FROM PROJECT T
|
|
|
- LEFT JOIN CONTRACT T1 ON T1.PROJECT_ID = T.ID AND T1.FLOW_STATUS = 90 AND T1.ISVALID = 1
|
|
|
+ LEFT JOIN (SELECT PROJECT_ID,MAX(ID) as ID FROM CONTRACT WHERE FLOW_STATUS = 90 AND ISVALID = 1 GROUP BY PROJECT_ID ) T1 ON T1.PROJECT_ID = T.ID
|
|
|
WHERE T.ISVALID = 1 AND T.FLOW_STATUS = 90
|
|
|
<if test="params != null and params.deptIds != null and params.deptIds.size > 0">
|
|
|
AND T.ZRBM_ID in
|
|
@@ -372,6 +384,7 @@
|
|
|
<select id="excelList" resultType="com.zjugis.business.bean.response.ProjectExcelResponse">
|
|
|
SELECT P.*,D.NAME as zrbm,PA.PROJECT_COST,PA.REIMBURSEMENT_COST,PA.TRAVEL_COST,PA.SUBCONTRACT_COST,PA.OUTSOURCE_COST,PA.PAYMENT_COST
|
|
|
FROM PROJECT P
|
|
|
+ LEFT JOIN (SELECT PROJECT_ID,MAX(ID) as ID FROM CONTRACT WHERE FLOW_STATUS = 90 AND ISVALID = 1 GROUP BY PROJECT_ID ) T1 ON T1.PROJECT_ID = P.ID
|
|
|
LEFT JOIN PROJECT_AMOUNT PA ON PA.PROJECT_ID = P.ID
|
|
|
LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = P.ZRBM_ID
|
|
|
<if test="params != null and params.userId != null and params.userId != ''">
|
|
@@ -400,8 +413,11 @@
|
|
|
<if test="params != null and params.lxsjOff != null">
|
|
|
AND P.LXSJ <= #{params.lxsjOff}
|
|
|
</if>
|
|
|
- <if test="params != null and params.isSign != null">
|
|
|
- AND P.IS_SIGN = #{params.isSign}
|
|
|
+ <if test="params != null and params.isSign == 1">
|
|
|
+ AND T1.ID is not null
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.isSign == 0">
|
|
|
+ AND T1.ID is null
|
|
|
</if>
|
|
|
<if test="params != null and params.xmmc != null and params.xmmc != ''">
|
|
|
<bind name="xmmc" value="'%'+params.xmmc+'%'"/>
|