<![CDATA[select t1.* from (SELECT (SELECT ARRAY_TO_JSON(ARRAY_AGG(T.*)) FROM (SELECT M2.ID AS SRFKEY, M2.NAME AS SRFMAJORTEXT FROM RES_PARTNER_RES_PARTNER_CATEGORY_REL M1 LEFT JOIN RES_PARTNER_CATEGORY M2 ON M1.CATEGORY_ID = M2.ID WHERE M1.PARTNER_ID =T1.ID ) T) AS CATEGORY_ID, t1.COMPANY_ID, t31.NAME AS COMPANY_ID_TEXT, t1.COUNTRY_ID, t41.NAME AS COUNTRY_ID_TEXT, t1.EMAIL, t1.FUNCTION, t1.ID, t1.MOBILE, t1.NAME, t1.PHONE, t1.STATE_ID, t51.NAME AS STATE_ID_TEXT, t1.TITLE, t11.NAME AS TITLE_TEXT, t1.TYPE, t1.VAT FROM RES_PARTNER t1 LEFT JOIN RES_PARTNER_TITLE t11 ON t1.TITLE = t11.ID LEFT JOIN RES_COMPANY t21 ON t1.COMPANY_ID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN RES_COUNTRY t41 ON t1.COUNTRY_ID = t41.ID LEFT JOIN RES_COUNTRY_STATE t51 ON t1.STATE_ID = t51.ID ) t1 where id=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.BARCODE, (SELECT ARRAY_TO_JSON(ARRAY_AGG(T.*)) FROM (SELECT M2.ID AS SRFKEY, M2.NAME AS SRFMAJORTEXT FROM RES_PARTNER_RES_PARTNER_CATEGORY_REL M1 LEFT JOIN RES_PARTNER_CATEGORY M2 ON M1.CATEGORY_ID = M2.ID WHERE M1.PARTNER_ID =T1.ID ) T) AS CATEGORY_ID, t1.COMPANY_ID, t31.NAME AS COMPANY_ID_TEXT, t1.COUNTRY_ID, t41.NAME AS COUNTRY_ID_TEXT, t1.EMAIL, t1.FUNCTION, t1.ID, t1.MOBILE, t1.NAME, t1.PARENT_ID, t81.NAME AS PARENT_NAME, t1.PHONE, t1.REF, t1.STATE_ID, t51.NAME AS STATE_ID_TEXT, t1.TITLE, t11.NAME AS TITLE_TEXT, t1.TYPE, t1.USER_ID, t71.NAME AS USER_NAME, t1.VAT FROM RES_PARTNER t1 LEFT JOIN RES_PARTNER_TITLE t11 ON t1.TITLE = t11.ID LEFT JOIN RES_COMPANY t21 ON t1.COMPANY_ID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN RES_COUNTRY t41 ON t1.COUNTRY_ID = t41.ID LEFT JOIN RES_COUNTRY_STATE t51 ON t1.STATE_ID = t51.ID LEFT JOIN RES_USERS t61 ON t1.USER_ID = t61.ID LEFT JOIN RES_PARTNER t71 ON t61.PARTNER_ID = t71.ID LEFT JOIN RES_PARTNER t81 ON t1.PARENT_ID = t81.ID ) t1 where id=#{id}]]>
<![CDATA[ SELECT t1.COMPANY_ID, t31.NAME AS COMPANY_ID_TEXT, t1.COUNTRY_ID, t41.NAME AS COUNTRY_ID_TEXT, t1.EMAIL, t1.FUNCTION, t1.ID, t1.MOBILE, t1.NAME, t1.PHONE, t1.STATE_ID, t51.NAME AS STATE_ID_TEXT, t1.TITLE, t11.NAME AS TITLE_TEXT, t1.TYPE, t1.VAT FROM RES_PARTNER t1 LEFT JOIN RES_PARTNER_TITLE t11 ON t1.TITLE = t11.ID LEFT JOIN RES_COMPANY t21 ON t1.COMPANY_ID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN RES_COUNTRY t41 ON t1.COUNTRY_ID = t41.ID LEFT JOIN RES_COUNTRY_STATE t51 ON t1.STATE_ID = t51.ID
<![CDATA[ SELECT t1.BARCODE, t1.COMPANY_ID, t31.NAME AS COMPANY_ID_TEXT, t1.COUNTRY_ID, t41.NAME AS COUNTRY_ID_TEXT, t1.EMAIL, t1.FUNCTION, t1.ID, t1.MOBILE, t1.NAME, t1.PARENT_ID, t81.NAME AS PARENT_NAME, t1.PHONE, t1.REF, t1.STATE_ID, t51.NAME AS STATE_ID_TEXT, t1.TITLE, t11.NAME AS TITLE_TEXT, t1.TYPE, t1.USER_ID, t71.NAME AS USER_NAME, t1.VAT FROM RES_PARTNER t1 LEFT JOIN RES_PARTNER_TITLE t11 ON t1.TITLE = t11.ID LEFT JOIN RES_COMPANY t21 ON t1.COMPANY_ID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN RES_COUNTRY t41 ON t1.COUNTRY_ID = t41.ID LEFT JOIN RES_COUNTRY_STATE t51 ON t1.STATE_ID = t51.ID LEFT JOIN RES_USERS t61 ON t1.USER_ID = t61.ID LEFT JOIN RES_PARTNER t71 ON t61.PARTNER_ID = t71.ID LEFT JOIN RES_PARTNER t81 ON t1.PARENT_ID = t81.ID
]]>
</sql>
<!--数据查询[View]-->
<sqlid="View"databaseId="postgresql">
<![CDATA[ SELECT (SELECT ARRAY_TO_JSON(ARRAY_AGG(T.*)) FROM (SELECT M2.ID AS SRFKEY, M2.NAME AS SRFMAJORTEXT FROM RES_PARTNER_RES_PARTNER_CATEGORY_REL M1 LEFT JOIN RES_PARTNER_CATEGORY M2 ON M1.CATEGORY_ID = M2.ID WHERE M1.PARTNER_ID =T1.ID ) T) AS CATEGORY_ID, t1.COMPANY_ID, t31.NAME AS COMPANY_ID_TEXT, t1.COUNTRY_ID, t41.NAME AS COUNTRY_ID_TEXT, t1.EMAIL, t1.FUNCTION, t1.ID, t1.MOBILE, t1.NAME, t1.PHONE, t1.STATE_ID, t51.NAME AS STATE_ID_TEXT, t1.TITLE, t11.NAME AS TITLE_TEXT, t1.TYPE, t1.VAT FROM RES_PARTNER t1 LEFT JOIN RES_PARTNER_TITLE t11 ON t1.TITLE = t11.ID LEFT JOIN RES_COMPANY t21 ON t1.COMPANY_ID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN RES_COUNTRY t41 ON t1.COUNTRY_ID = t41.ID LEFT JOIN RES_COUNTRY_STATE t51 ON t1.STATE_ID = t51.ID
<![CDATA[ SELECT t1.BARCODE, (SELECT ARRAY_TO_JSON(ARRAY_AGG(T.*)) FROM (SELECT M2.ID AS SRFKEY, M2.NAME AS SRFMAJORTEXT FROM RES_PARTNER_RES_PARTNER_CATEGORY_REL M1 LEFT JOIN RES_PARTNER_CATEGORY M2 ON M1.CATEGORY_ID = M2.ID WHERE M1.PARTNER_ID =T1.ID ) T) AS CATEGORY_ID, t1.COMPANY_ID, t31.NAME AS COMPANY_ID_TEXT, t1.COUNTRY_ID, t41.NAME AS COUNTRY_ID_TEXT, t1.EMAIL, t1.FUNCTION, t1.ID, t1.MOBILE, t1.NAME, t1.PARENT_ID, t81.NAME AS PARENT_NAME, t1.PHONE, t1.REF, t1.STATE_ID, t51.NAME AS STATE_ID_TEXT, t1.TITLE, t11.NAME AS TITLE_TEXT, t1.TYPE, t1.USER_ID, t71.NAME AS USER_NAME, t1.VAT FROM RES_PARTNER t1 LEFT JOIN RES_PARTNER_TITLE t11 ON t1.TITLE = t11.ID LEFT JOIN RES_COMPANY t21 ON t1.COMPANY_ID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN RES_COUNTRY t41 ON t1.COUNTRY_ID = t41.ID LEFT JOIN RES_COUNTRY_STATE t51 ON t1.STATE_ID = t51.ID LEFT JOIN RES_USERS t61 ON t1.USER_ID = t61.ID LEFT JOIN RES_PARTNER t71 ON t61.PARTNER_ID = t71.ID LEFT JOIN RES_PARTNER t81 ON t1.PARENT_ID = t81.ID
<![CDATA[select t1.* from (SELECT t1.ACTIVE, t1.AMOUNT, t1.COMPANY_ID, t21.NAME AS COMPANY_NAME, t1.CREATE_DATE, t1.CREATE_UID, t81.NAME AS CREATE_UNAME, t1.DEBUG_LOGGING, t1.DELIVERY_TYPE, t1.FIXED_PRICE, t1.FREE_OVER, t1.GET_RETURN_LABEL_FROM_PORTAL, t1.ID, t1.INTEGRATION_LEVEL, t1.INVOICE_POLICY, t1.IS_PUBLISHED, t1.MARGIN, t1.NAME, t1.PRODUCT_ID, t41.NAME AS PRODUCT_NAME, t1.PROD_ENVIRONMENT, t1.RETURN_LABEL_ON_DELIVERY, t1.SEQUENCE, t1.WRITE_DATE, t1.WRITE_UID, t61.NAME AS WRITE_UNAME, t1.ZIP_FROM, t1.ZIP_TO FROM DELIVERY_CARRIER t1 LEFT JOIN RES_COMPANY t11 ON t1.COMPANY_ID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN PRODUCT_PRODUCT t31 ON t1.PRODUCT_ID = t31.ID LEFT JOIN PRODUCT_TEMPLATE t41 ON t31.PRODUCT_TMPL_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.WRITE_UID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.CREATE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID ) t1 where id=#{id}]]>
<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>
<!--数据查询[Default]-->
<sqlid="Default"databaseId="postgresql">
<![CDATA[ SELECT t1.ACTIVE, t1.AMOUNT, t1.COMPANY_ID, t21.NAME AS COMPANY_NAME, t1.CREATE_DATE, t1.CREATE_UID, t81.NAME AS CREATE_UNAME, t1.DEBUG_LOGGING, t1.DELIVERY_TYPE, t1.FIXED_PRICE, t1.FREE_OVER, t1.GET_RETURN_LABEL_FROM_PORTAL, t1.ID, t1.INTEGRATION_LEVEL, t1.INVOICE_POLICY, t1.IS_PUBLISHED, t1.MARGIN, t1.NAME, t1.PRODUCT_ID, t41.NAME AS PRODUCT_NAME, t1.PROD_ENVIRONMENT, t1.RETURN_LABEL_ON_DELIVERY, t1.SEQUENCE, t1.WRITE_DATE, t1.WRITE_UID, t61.NAME AS WRITE_UNAME, t1.ZIP_FROM, t1.ZIP_TO FROM DELIVERY_CARRIER t1 LEFT JOIN RES_COMPANY t11 ON t1.COMPANY_ID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN PRODUCT_PRODUCT t31 ON t1.PRODUCT_ID = t31.ID LEFT JOIN PRODUCT_TEMPLATE t41 ON t31.PRODUCT_TMPL_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.WRITE_UID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.CREATE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID
]]>
</sql>
<!--数据查询[View]-->
<sqlid="View"databaseId="postgresql">
<![CDATA[ SELECT t1.ACTIVE, t1.AMOUNT, t1.COMPANY_ID, t21.NAME AS COMPANY_NAME, t1.CREATE_DATE, t1.CREATE_UID, t81.NAME AS CREATE_UNAME, t1.DEBUG_LOGGING, t1.DELIVERY_TYPE, t1.FIXED_PRICE, t1.FREE_OVER, t1.GET_RETURN_LABEL_FROM_PORTAL, t1.ID, t1.INTEGRATION_LEVEL, t1.INVOICE_POLICY, t1.IS_PUBLISHED, t1.MARGIN, t1.NAME, t1.PRODUCT_ID, t41.NAME AS PRODUCT_NAME, t1.PROD_ENVIRONMENT, t1.RETURN_LABEL_ON_DELIVERY, t1.SEQUENCE, t1.WRITE_DATE, t1.WRITE_UID, t61.NAME AS WRITE_UNAME, t1.ZIP_FROM, t1.ZIP_TO FROM DELIVERY_CARRIER t1 LEFT JOIN RES_COMPANY t11 ON t1.COMPANY_ID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN PRODUCT_PRODUCT t31 ON t1.PRODUCT_ID = t31.ID LEFT JOIN PRODUCT_TEMPLATE t41 ON t31.PRODUCT_TMPL_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.WRITE_UID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.CREATE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID