sql提交

This commit is contained in:
liang.chao 2024-04-23 09:35:44 +08:00
parent 62f2330ffb
commit 3fedcde616
1 changed files with 25 additions and 0 deletions

View File

@ -934,4 +934,29 @@
<select id="selectTaskStatus" resultType="java.lang.Integer">
select task_status from tm_task where task_id = #{taskId}
</select>
<select id="selectNumByTypeId" resultType="java.lang.Integer">
SELECT
ROUND(SUM( res.auditNum )- SUM( res.backNum ),0) AS backNum
FROM
(
SELECT
bad.audit_num AS auditNum,
0 AS backNum
FROM
back_apply_details bad
WHERE
bad.parent_id = #{parentId}
AND bad.type_id = #{typeId} UNION
SELECT
0 AS auditNum,
SUM(
IFNULL( bcd.back_num, 0 )) AS backNum
FROM
back_check_details bcd
WHERE
bcd.parent_id = #{parentId}
AND bcd.type_id = #{typeId}
) res
HAVING backNum > -1
</select>
</mapper>