我想不通这个。
此查询在 sqlServer 中运行而没有错误:
SELECT COUNT(tjmm.MAINMISSION_PARTICIPANT_SID)
FROM T_MOVEMENT_LEG ml INNER JOIN
TJ_MVLG_PARTMOV tjmp ON ml.MOVEMENTLEG_SID = tjmp.MOVEMENTLEG_SID INNER JOIN
T_MAIN_MISSION mm INNER JOIN
T_MISSION_PARTICIPANTS mp ON mm.DETCO_MISSIONPARTICIPANT_SID = mp.MISSION_PARTICIPANT_SID INNER JOIN
T_PARTICIPANT_MOVEMENT pm ON mp.MISSION_PARTICIPANT_SID = pm.MISSION_PARTICIPANT_SID INNER JOIN
TJ_MMIS_MISPART tjmm ON mm.MAINMISSION_SID = tjmm.MAINMISSION_SID AND
mp.MISSION_PARTICIPANT_SID = tjmm.MISSION_PARTICIPANT_SID ON
tjmp.PARTICIPANTMOVEMENT_SID = pm.PARTICIPANTMOVEMENT_SID
WHERE (mm.IN_USE = 1) AND (mp.IS_OPS = 1) AND (pm.IS_OPS = 1) AND
(ml.LEGEFFECTIVE_STARTDATE < { fn NOW() }) AND (ml.LEGEFFECTIVE_ENDDATE > { fn NOW() }) AND
(ml.IS_CANCELED = 0)
将其转换为 @Formula :
@Formula("select count(tjmm.MAINMISSION_PARTICIPANT_SID) "
+ "FROM T_MOVEMENT_LEG ml INNER JOIN "
+ "TJ_MVLG_PARTMOV tjmp ON ml.MOVEMENTLEG_SID = tjmp.MOVEMENTLEG_SID INNER JOIN "
+ "T_MAIN_MISSION mm INNER JOIN "
+ "T_MISSION_PARTICIPANTS mp ON mm.DETCO_MISSIONPARTICIPANT_SID = mp.MISSION_PARTICIPANT_SID INNER JOIN "
+ "T_PARTICIPANT_MOVEMENT pm ON mp.MISSION_PARTICIPANT_SID = pm.MISSION_PARTICIPANT_SID INNER JOIN "
+ "TJ_MMIS_MISPART tjmm ON mm.MAINMISSION_SID = tjmm.MAINMISSION_SID AND "
+ "mp.MISSION_PARTICIPANT_SID = tjmm.MISSION_PARTICIPANT_SID ON "
+ "tjmp.PARTICIPANTMOVEMENT_SID = pm.PARTICIPANTMOVEMENT_SID "
+ "WHERE (mm.IN_USE = 1) AND (mp.IS_OPS = 1) AND (pm.IS_OPS = 1) AND "
+ "tjmm.MainMission_SID = MainMission_SID AND"
+ "(ml.LEGEFFECTIVE_STARTDATE < NOW()) AND (ml.LEGEFFECTIVE_ENDDATE > NOW()) AND "
+ "(ml.IS_CANCELED = 0)")
private Integer opsCount;
更改NOW()
并添加了指向 pojo Id 的链接:tjmm.MainMission_SID = MainMission_SID
任何人都知道我在公式中的错误在哪里?