WITH x
AS (SELECT #{personId} as userID, #{startDate} as startDate, #{endDate} as endDate from dual)
SELECT (SELECT COUNT (*) thesisCount
FROM KY_ACHIEVETHESIS A
JOIN KY_ACHIEVEMENT B ON A.THESISID = B.ACHIEVECONTENTID
JOIN KY_ACHIEVEPERSON C
ON C.ACHIEVEITEMID = B.ACHIEVEITEMID, x
WHERE B.ACHIEVETYPE = '论文' AND C.PERSONID = x.userID
AND A.STATUS = 0
AND (A.publishDate >= x.startDate OR x.startDate IS NULL)
AND (A.publishDate <= x.endDate OR x.endDate IS NULL)) LW
FROM DUAL
HansonQ
_朝歌_
元狼