<where><iftest="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<iftest="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[ByRes]-->
<sqlid="ByRes"databaseId="postgresql">
<![CDATA[ SELECT t1.CHANNEL_ID, t21.NAME AS CHANNEL_ID_TEXT, t1.ID, t1.PARTNER_ID, t11.NAME AS PARTNER_ID_TEXT, t1.RES_ID, t1.RES_MODEL FROM MAIL_FOLLOWERS t1 LEFT JOIN RES_PARTNER t11 ON t1.PARTNER_ID = t11.ID LEFT JOIN MAIL_CHANNEL t21 ON t1.CHANNEL_ID = t21.ID
WHERE ( t1.RES_MODEL = #{srf.webcontext.res_model} AND t1.RES_ID = #{srf.webcontext.res_id} )
<iftest="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[ByRes]-->
<sqlid="ByRes"databaseId="postgresql">
<![CDATA[ SELECT t1.ADD_SIGN, t1.AUTHOR_ID, t11.NAME AS AUTHOR_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t31.NAME AS CREATE_UID_TEXT, t1.DATE, t1.EMAIL_FROM, t1.ID, t1.MAIL_ACTIVITY_TYPE_ID, t41.NAME AS MAIL_ACTIVITY_TYPE_ID_TEXT, t1.MAIL_SERVER_ID, t1.MESSAGE_ID, t1.MESSAGE_TYPE, t1.MODEL, t1.MODERATION_STATUS, t1.MODERATOR_ID, t61.NAME AS MODERATOR_ID_TEXT, t1.NO_AUTO_THREAD, t1.PARENT_ID, t1.RECORD_NAME, t1.REPLY_TO, t1.RES_ID, t1.SUBJECT, t1.SUBTYPE_ID, t91.NAME AS SUBTYPE_ID_TEXT, t1.WEBSITE_PUBLISHED, t1.WRITE_DATE, t1.WRITE_UID, t81.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE t1 LEFT JOIN RES_PARTNER t11 ON t1.AUTHOR_ID = t11.ID LEFT JOIN RES_USERS t21 ON t1.CREATE_UID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN MAIL_ACTIVITY_TYPE t41 ON t1.MAIL_ACTIVITY_TYPE_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.MODERATOR_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.WRITE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t91 ON t1.SUBTYPE_ID = t91.ID
WHERE ( t1.MODEL = #{srf.webcontext.res_model} AND t1.RES_ID = #{srf.webcontext.res_id} )
]]>
</sql>
<!--数据查询[Default]-->
<sqlid="Default"databaseId="postgresql">
<![CDATA[ SELECT t1.ADD_SIGN, t1.AUTHOR_ID, t11.NAME AS AUTHOR_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t31.NAME AS CREATE_UID_TEXT, t1.DATE, t1.EMAIL_FROM, t1.ID, t1.MAIL_ACTIVITY_TYPE_ID, t41.NAME AS MAIL_ACTIVITY_TYPE_ID_TEXT, t1.MAIL_SERVER_ID, t1.MESSAGE_ID, t1.MESSAGE_TYPE, t1.MODEL, t1.MODERATION_STATUS, t1.MODERATOR_ID, t61.NAME AS MODERATOR_ID_TEXT, t1.NO_AUTO_THREAD, t1.PARENT_ID, t1.RECORD_NAME, t1.REPLY_TO, t1.RES_ID, t1.SUBJECT, t1.SUBTYPE_ID, t91.NAME AS SUBTYPE_ID_TEXT, t1.WEBSITE_PUBLISHED, t1.WRITE_DATE, t1.WRITE_UID, t81.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE t1 LEFT JOIN RES_PARTNER t11 ON t1.AUTHOR_ID = t11.ID LEFT JOIN RES_USERS t21 ON t1.CREATE_UID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN MAIL_ACTIVITY_TYPE t41 ON t1.MAIL_ACTIVITY_TYPE_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.MODERATOR_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.WRITE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t91 ON t1.SUBTYPE_ID = t91.ID
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message-searchByRes-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message-searchByRes-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_tracking_value-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_tracking_value-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_tracking_value-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_tracking_value-Get')")