<![CDATA[select t1.* from (SELECT t1.ACCESS_TOKEN, t1.ACCOUNT_ID, t121.NAME AS ACCOUNT_ID_TEXT, t1.AMOUNT_TAX, t1.AMOUNT_TOTAL, t1.AMOUNT_TOTAL_COMPANY_SIGNED, t1.AMOUNT_TOTAL_SIGNED, t1.AMOUNT_UNTAXED, t1.AMOUNT_UNTAXED_SIGNED, t1.CAMPAIGN_ID, t51.NAME AS CAMPAIGN_ID_TEXT, t1.CASH_ROUNDING_ID, t211.NAME AS CASH_ROUNDING_ID_TEXT, t1.COMMENT, t1.COMMERCIAL_PARTNER_ID, t261.NAME AS COMMERCIAL_PARTNER_ID_TEXT, t111.CURRENCY_ID AS COMPANY_CURRENCY_ID, t1.COMPANY_ID, t181.NAME AS COMPANY_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t171.NAME AS CREATE_UID_TEXT, t1.CURRENCY_ID, t71.NAME AS CURRENCY_ID_TEXT, t1.DATE, t1.DATE_DUE, t1.DATE_INVOICE, t1.FISCAL_POSITION_ID, t241.NAME AS FISCAL_POSITION_ID_TEXT, t1.ID, t1.INCOTERMS_ID, t101.NAME AS INCOTERMS_ID_TEXT, t1.INCOTERM_ID, t131.NAME AS INCOTERM_ID_TEXT, t1.JOURNAL_ID, t11.NAME AS JOURNAL_ID_TEXT, t1.MEDIUM_ID, t151.NAME AS MEDIUM_ID_TEXT, t1.MESSAGE_MAIN_ATTACHMENT_ID, t1.MOVE_ID, t1.MOVE_NAME, t1.NAME, t251.NAME AS NUMBER, t1.ORIGIN, t1.PARTNER_BANK_ID, t1.PARTNER_ID, t141.NAME AS PARTNER_ID_TEXT, t1.PARTNER_SHIPPING_ID, t61.NAME AS PARTNER_SHIPPING_ID_TEXT, t1.PAYMENT_TERM_ID, t281.NAME AS PAYMENT_TERM_ID_TEXT, t1.PURCHASE_ID, t21.NAME AS PURCHASE_ID_TEXT, t1.RECONCILED, t1.REFERENCE, t1.REFUND_INVOICE_ID, t231.NAME AS REFUND_INVOICE_ID_TEXT, t1.RESIDUAL, t1.RESIDUAL_COMPANY_SIGNED, t1.RESIDUAL_SIGNED, t1.SENT, t1.SOURCE_EMAIL, t1.SOURCE_ID, t41.NAME AS SOURCE_ID_TEXT, t1.STATE, t1.TEAM_ID, t271.NAME AS TEAM_ID_TEXT, t1.TYPE, t1.USER_ID, t201.NAME AS USER_ID_TEXT, t1.VENDOR_BILL_ID, t221.NAME AS VENDOR_BILL_ID_TEXT, t1.VENDOR_BILL_PURCHASE_ID, t31.NAME AS VENDOR_BILL_PURCHASE_ID_TEXT, t1.VENDOR_DISPLAY_NAME, t1.WEBSITE_ID, t1.WRITE_DATE, t1.WRITE_UID, t91.NAME AS WRITE_UID_TEXT FROM ACCOUNT_INVOICE t1 LEFT JOIN ACCOUNT_JOURNAL t11 ON t1.JOURNAL_ID = t11.ID LEFT JOIN PURCHASE_ORDER t21 ON t1.PURCHASE_ID = t21.ID LEFT JOIN PURCHASE_BILL_UNION t31 ON t1.VENDOR_BILL_PURCHASE_ID = t31.ID LEFT JOIN UTM_SOURCE t41 ON t1.SOURCE_ID = t41.ID LEFT JOIN UTM_CAMPAIGN t51 ON t1.CAMPAIGN_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t1.PARTNER_SHIPPING_ID = t61.ID LEFT JOIN RES_CURRENCY t71 ON t1.CURRENCY_ID = t71.ID LEFT JOIN RES_USERS t81 ON t1.WRITE_UID = t81.ID LEFT JOIN RES_PARTNER t91 ON t81.PARTNER_ID = t91.ID LEFT JOIN ACCOUNT_INCOTERMS t101 ON t1.INCOTERMS_ID = t101.ID LEFT JOIN RES_COMPANY t111 ON t1.COMPANY_ID = t111.ID LEFT JOIN ACCOUNT_ACCOUNT t121 ON t1.ACCOUNT_ID = t121.ID LEFT JOIN ACCOUNT_INCOTERMS t131 ON t1.INCOTERM_ID = t131.ID LEFT JOIN RES_PARTNER t141 ON t1.PARTNER_ID = t141.ID LEFT JOIN UTM_MEDIUM t151 ON t1.MEDIUM_ID = t151.ID LEFT JOIN RES_USERS t161 ON t1.CREATE_UID = t161.ID LEFT JOIN RES_PARTNER t171 ON t161.PARTNER_ID = t171.ID LEFT JOIN RES_PARTNER t181 ON t111.PARTNER_ID = t181.ID LEFT JOIN RES_USERS t191 ON t1.USER_ID = t191.ID LEFT JOIN RES_PARTNER t201 ON t191.PARTNER_ID = t201.ID LEFT JOIN ACCOUNT_CASH_ROUNDING t211 ON t1.CASH_ROUNDING_ID = t211.ID LEFT JOIN ACCOUNT_INVOICE t221 ON t1.VENDOR_BILL_ID = t221.ID LEFT JOIN ACCOUNT_INVOICE t231 ON t1.REFUND_INVOICE_ID = t231.ID LEFT JOIN ACCOUNT_FISCAL_POSITION t241 ON t1.FISCAL_POSITION_ID = t241.ID LEFT JOIN ACCOUNT_MOVE t251 ON t1.MOVE_ID = t251.ID LEFT JOIN RES_PARTNER t261 ON t1.COMMERCIAL_PARTNER_ID = t261.ID LEFT JOIN CRM_TEAM t271 ON t1.TEAM_ID = t271.ID LEFT JOIN ACCOUNT_PAYMENT_TERM t281 ON t1.PAYMENT_TERM_ID = t281.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.ACCESS_TOKEN, t1.ACCOUNT_ID, t121.NAME AS ACCOUNT_ID_TEXT, t1.AMOUNT_TAX, t1.AMOUNT_TOTAL, t1.AMOUNT_TOTAL_COMPANY_SIGNED, t1.AMOUNT_TOTAL_SIGNED, t1.AMOUNT_UNTAXED, t1.AMOUNT_UNTAXED_SIGNED, t1.CAMPAIGN_ID, t51.NAME AS CAMPAIGN_ID_TEXT, t1.CASH_ROUNDING_ID, t211.NAME AS CASH_ROUNDING_ID_TEXT, t1.COMMERCIAL_PARTNER_ID, t261.NAME AS COMMERCIAL_PARTNER_ID_TEXT, t111.CURRENCY_ID AS COMPANY_CURRENCY_ID, t1.COMPANY_ID, t181.NAME AS COMPANY_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t171.NAME AS CREATE_UID_TEXT, t1.CURRENCY_ID, t71.NAME AS CURRENCY_ID_TEXT, t1.DATE, t1.DATE_DUE, t1.DATE_INVOICE, t1.FISCAL_POSITION_ID, t241.NAME AS FISCAL_POSITION_ID_TEXT, t1.ID, t1.INCOTERMS_ID, t101.NAME AS INCOTERMS_ID_TEXT, t1.INCOTERM_ID, t131.NAME AS INCOTERM_ID_TEXT, t1.JOURNAL_ID, t11.NAME AS JOURNAL_ID_TEXT, t1.MEDIUM_ID, t151.NAME AS MEDIUM_ID_TEXT, t1.MESSAGE_MAIN_ATTACHMENT_ID, t1.MOVE_ID, t1.MOVE_NAME, t1.NAME, t251.NAME AS NUMBER, t1.ORIGIN, t1.PARTNER_BANK_ID, t1.PARTNER_ID, t141.NAME AS PARTNER_ID_TEXT, t1.PARTNER_SHIPPING_ID, t61.NAME AS PARTNER_SHIPPING_ID_TEXT, t1.PAYMENT_TERM_ID, t281.NAME AS PAYMENT_TERM_ID_TEXT, t1.PURCHASE_ID, t21.NAME AS PURCHASE_ID_TEXT, t1.RECONCILED, t1.REFERENCE, t1.REFUND_INVOICE_ID, t231.NAME AS REFUND_INVOICE_ID_TEXT, t1.RESIDUAL, t1.RESIDUAL_COMPANY_SIGNED, t1.RESIDUAL_SIGNED, t1.SENT, t1.SOURCE_EMAIL, t1.SOURCE_ID, t41.NAME AS SOURCE_ID_TEXT, t1.STATE, t1.TEAM_ID, t271.NAME AS TEAM_ID_TEXT, t1.TYPE, t1.USER_ID, t201.NAME AS USER_ID_TEXT, t1.VENDOR_BILL_ID, t221.NAME AS VENDOR_BILL_ID_TEXT, t1.VENDOR_BILL_PURCHASE_ID, t31.NAME AS VENDOR_BILL_PURCHASE_ID_TEXT, t1.VENDOR_DISPLAY_NAME, t1.WEBSITE_ID, t1.WRITE_DATE, t1.WRITE_UID, t91.NAME AS WRITE_UID_TEXT FROM ACCOUNT_INVOICE t1 LEFT JOIN ACCOUNT_JOURNAL t11 ON t1.JOURNAL_ID = t11.ID LEFT JOIN PURCHASE_ORDER t21 ON t1.PURCHASE_ID = t21.ID LEFT JOIN PURCHASE_BILL_UNION t31 ON t1.VENDOR_BILL_PURCHASE_ID = t31.ID LEFT JOIN UTM_SOURCE t41 ON t1.SOURCE_ID = t41.ID LEFT JOIN UTM_CAMPAIGN t51 ON t1.CAMPAIGN_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t1.PARTNER_SHIPPING_ID = t61.ID LEFT JOIN RES_CURRENCY t71 ON t1.CURRENCY_ID = t71.ID LEFT JOIN RES_USERS t81 ON t1.WRITE_UID = t81.ID LEFT JOIN RES_PARTNER t91 ON t81.PARTNER_ID = t91.ID LEFT JOIN ACCOUNT_INCOTERMS t101 ON t1.INCOTERMS_ID = t101.ID LEFT JOIN RES_COMPANY t111 ON t1.COMPANY_ID = t111.ID LEFT JOIN ACCOUNT_ACCOUNT t121 ON t1.ACCOUNT_ID = t121.ID LEFT JOIN ACCOUNT_INCOTERMS t131 ON t1.INCOTERM_ID = t131.ID LEFT JOIN RES_PARTNER t141 ON t1.PARTNER_ID = t141.ID LEFT JOIN UTM_MEDIUM t151 ON t1.MEDIUM_ID = t151.ID LEFT JOIN RES_USERS t161 ON t1.CREATE_UID = t161.ID LEFT JOIN RES_PARTNER t171 ON t161.PARTNER_ID = t171.ID LEFT JOIN RES_PARTNER t181 ON t111.PARTNER_ID = t181.ID LEFT JOIN RES_USERS t191 ON t1.USER_ID = t191.ID LEFT JOIN RES_PARTNER t201 ON t191.PARTNER_ID = t201.ID LEFT JOIN ACCOUNT_CASH_ROUNDING t211 ON t1.CASH_ROUNDING_ID = t211.ID LEFT JOIN ACCOUNT_INVOICE t221 ON t1.VENDOR_BILL_ID = t221.ID LEFT JOIN ACCOUNT_INVOICE t231 ON t1.REFUND_INVOICE_ID = t231.ID LEFT JOIN ACCOUNT_FISCAL_POSITION t241 ON t1.FISCAL_POSITION_ID = t241.ID LEFT JOIN ACCOUNT_MOVE t251 ON t1.MOVE_ID = t251.ID LEFT JOIN RES_PARTNER t261 ON t1.COMMERCIAL_PARTNER_ID = t261.ID LEFT JOIN CRM_TEAM t271 ON t1.TEAM_ID = t271.ID LEFT JOIN ACCOUNT_PAYMENT_TERM t281 ON t1.PAYMENT_TERM_ID = t281.ID
]]>
</sql>
<!--数据查询[View]-->
<sqlid="View"databaseId="postgresql">
<![CDATA[ SELECT t1.ACCESS_TOKEN, t1.ACCOUNT_ID, t121.NAME AS ACCOUNT_ID_TEXT, t1.AMOUNT_TAX, t1.AMOUNT_TOTAL, t1.AMOUNT_TOTAL_COMPANY_SIGNED, t1.AMOUNT_TOTAL_SIGNED, t1.AMOUNT_UNTAXED, t1.AMOUNT_UNTAXED_SIGNED, t1.CAMPAIGN_ID, t51.NAME AS CAMPAIGN_ID_TEXT, t1.CASH_ROUNDING_ID, t211.NAME AS CASH_ROUNDING_ID_TEXT, t1.COMMENT, t1.COMMERCIAL_PARTNER_ID, t261.NAME AS COMMERCIAL_PARTNER_ID_TEXT, t111.CURRENCY_ID AS COMPANY_CURRENCY_ID, t1.COMPANY_ID, t181.NAME AS COMPANY_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t171.NAME AS CREATE_UID_TEXT, t1.CURRENCY_ID, t71.NAME AS CURRENCY_ID_TEXT, t1.DATE, t1.DATE_DUE, t1.DATE_INVOICE, t1.FISCAL_POSITION_ID, t241.NAME AS FISCAL_POSITION_ID_TEXT, t1.ID, t1.INCOTERMS_ID, t101.NAME AS INCOTERMS_ID_TEXT, t1.INCOTERM_ID, t131.NAME AS INCOTERM_ID_TEXT, t1.JOURNAL_ID, t11.NAME AS JOURNAL_ID_TEXT, t1.MEDIUM_ID, t151.NAME AS MEDIUM_ID_TEXT, t1.MESSAGE_MAIN_ATTACHMENT_ID, t1.MOVE_ID, t1.MOVE_NAME, t1.NAME, t251.NAME AS NUMBER, t1.ORIGIN, t1.PARTNER_BANK_ID, t1.PARTNER_ID, t141.NAME AS PARTNER_ID_TEXT, t1.PARTNER_SHIPPING_ID, t61.NAME AS PARTNER_SHIPPING_ID_TEXT, t1.PAYMENT_TERM_ID, t281.NAME AS PAYMENT_TERM_ID_TEXT, t1.PURCHASE_ID, t21.NAME AS PURCHASE_ID_TEXT, t1.RECONCILED, t1.REFERENCE, t1.REFUND_INVOICE_ID, t231.NAME AS REFUND_INVOICE_ID_TEXT, t1.RESIDUAL, t1.RESIDUAL_COMPANY_SIGNED, t1.RESIDUAL_SIGNED, t1.SENT, t1.SOURCE_EMAIL, t1.SOURCE_ID, t41.NAME AS SOURCE_ID_TEXT, t1.STATE, t1.TEAM_ID, t271.NAME AS TEAM_ID_TEXT, t1.TYPE, t1.USER_ID, t201.NAME AS USER_ID_TEXT, t1.VENDOR_BILL_ID, t221.NAME AS VENDOR_BILL_ID_TEXT, t1.VENDOR_BILL_PURCHASE_ID, t31.NAME AS VENDOR_BILL_PURCHASE_ID_TEXT, t1.VENDOR_DISPLAY_NAME, t1.WEBSITE_ID, t1.WRITE_DATE, t1.WRITE_UID, t91.NAME AS WRITE_UID_TEXT FROM ACCOUNT_INVOICE t1 LEFT JOIN ACCOUNT_JOURNAL t11 ON t1.JOURNAL_ID = t11.ID LEFT JOIN PURCHASE_ORDER t21 ON t1.PURCHASE_ID = t21.ID LEFT JOIN PURCHASE_BILL_UNION t31 ON t1.VENDOR_BILL_PURCHASE_ID = t31.ID LEFT JOIN UTM_SOURCE t41 ON t1.SOURCE_ID = t41.ID LEFT JOIN UTM_CAMPAIGN t51 ON t1.CAMPAIGN_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t1.PARTNER_SHIPPING_ID = t61.ID LEFT JOIN RES_CURRENCY t71 ON t1.CURRENCY_ID = t71.ID LEFT JOIN RES_USERS t81 ON t1.WRITE_UID = t81.ID LEFT JOIN RES_PARTNER t91 ON t81.PARTNER_ID = t91.ID LEFT JOIN ACCOUNT_INCOTERMS t101 ON t1.INCOTERMS_ID = t101.ID LEFT JOIN RES_COMPANY t111 ON t1.COMPANY_ID = t111.ID LEFT JOIN ACCOUNT_ACCOUNT t121 ON t1.ACCOUNT_ID = t121.ID LEFT JOIN ACCOUNT_INCOTERMS t131 ON t1.INCOTERM_ID = t131.ID LEFT JOIN RES_PARTNER t141 ON t1.PARTNER_ID = t141.ID LEFT JOIN UTM_MEDIUM t151 ON t1.MEDIUM_ID = t151.ID LEFT JOIN RES_USERS t161 ON t1.CREATE_UID = t161.ID LEFT JOIN RES_PARTNER t171 ON t161.PARTNER_ID = t171.ID LEFT JOIN RES_PARTNER t181 ON t111.PARTNER_ID = t181.ID LEFT JOIN RES_USERS t191 ON t1.USER_ID = t191.ID LEFT JOIN RES_PARTNER t201 ON t191.PARTNER_ID = t201.ID LEFT JOIN ACCOUNT_CASH_ROUNDING t211 ON t1.CASH_ROUNDING_ID = t211.ID LEFT JOIN ACCOUNT_INVOICE t221 ON t1.VENDOR_BILL_ID = t221.ID LEFT JOIN ACCOUNT_INVOICE t231 ON t1.REFUND_INVOICE_ID = t231.ID LEFT JOIN ACCOUNT_FISCAL_POSITION t241 ON t1.FISCAL_POSITION_ID = t241.ID LEFT JOIN ACCOUNT_MOVE t251 ON t1.MOVE_ID = t251.ID LEFT JOIN RES_PARTNER t261 ON t1.COMMERCIAL_PARTNER_ID = t261.ID LEFT JOIN CRM_TEAM t271 ON t1.TEAM_ID = t271.ID LEFT JOIN ACCOUNT_PAYMENT_TERM t281 ON t1.PAYMENT_TERM_ID = t281.ID
<![CDATA[select t1.* from (SELECT t1.ADDITIONAL, t141.BACKORDER_ID, t1.BOM_LINE_ID, t1.COMPANY_ID, t61.NAME AS COMPANY_ID_TEXT, t1.CONSUME_UNBUILD_ID, t251.NAME AS CONSUME_UNBUILD_ID_TEXT, t1.CREATED_PRODUCTION_ID, t101.NAME AS CREATED_PRODUCTION_ID_TEXT, t1.CREATED_PURCHASE_LINE_ID, t111.NAME AS CREATED_PURCHASE_LINE_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t211.NAME AS CREATE_UID_TEXT, t1.DATE, t1.DATE_EXPECTED, t1.GROUP_ID, t21.TRACKING AS HAS_TRACKING, t1.ID, t1.INVENTORY_ID, t281.NAME AS INVENTORY_ID_TEXT, t1.IS_DONE, t1.LOCATION_DEST_ID, t41.NAME AS LOCATION_DEST_ID_TEXT, t1.LOCATION_ID, t191.NAME AS LOCATION_ID_TEXT, t1.NAME, t1.NOTE, t1.OPERATION_ID, t231.NAME AS OPERATION_ID_TEXT, t1.ORIGIN, t1.ORIGIN_RETURNED_MOVE_ID, t161.NAME AS ORIGIN_RETURNED_MOVE_ID_TEXT, t1.PACKAGE_LEVEL_ID, t1.PARTNER_ID, t131.NAME AS PARTNER_ID_TEXT, t91.CODE AS PICKING_CODE, t1.PICKING_ID, t141.NAME AS PICKING_ID_TEXT, t141.PARTNER_ID AS PICKING_PARTNER_ID, t91.SHOW_ENTIRE_PACKS AS PICKING_TYPE_ENTIRE_PACKS, t1.PICKING_TYPE_ID, t91.NAME AS PICKING_TYPE_ID_TEXT, t1.PRICE_UNIT, t1.PRIORITY, t1.PROCURE_METHOD, t1.PRODUCTION_ID, t71.NAME AS PRODUCTION_ID_TEXT, t1.PRODUCT_ID, t21.NAME AS PRODUCT_ID_TEXT, t1.PRODUCT_PACKAGING, t261.NAME AS PRODUCT_PACKAGING_TEXT, t1.PRODUCT_QTY, t11.PRODUCT_TMPL_ID, t21.TYPE AS PRODUCT_TYPE, t1.PRODUCT_UOM, t1.PRODUCT_UOM_QTY, t221.NAME AS PRODUCT_UOM_TEXT, t1.PROPAGATE, t1.PURCHASE_LINE_ID, t181.NAME AS PURCHASE_LINE_ID_TEXT, t1.RAW_MATERIAL_PRODUCTION_ID, t151.NAME AS RAW_MATERIAL_PRODUCTION_ID_TEXT, t1.REFERENCE, t1.REMAINING_QTY, t1.REMAINING_VALUE, t1.REPAIR_ID, t171.NAME AS REPAIR_ID_TEXT, t1.RESTRICT_PARTNER_ID, t271.NAME AS RESTRICT_PARTNER_ID_TEXT, t1.RULE_ID, t291.NAME AS RULE_ID_TEXT, t1.SALE_LINE_ID, t121.NAME AS SALE_LINE_ID_TEXT, t41.SCRAP_LOCATION AS SCRAPPED, t1.SEQUENCE, t91.SHOW_OPERATIONS, t1.STATE, t1.TO_REFUND, t1.UNBUILD_ID, t31.NAME AS UNBUILD_ID_TEXT, t1.UNIT_FACTOR, t1.VALUE, t1.WAREHOUSE_ID, t81.NAME AS WAREHOUSE_ID_TEXT, t1.WORKORDER_ID, t241.NAME AS WORKORDER_ID_TEXT, t1.WRITE_DATE, t1.WRITE_UID, t311.NAME AS WRITE_UID_TEXT FROM STOCK_MOVE t1 LEFT JOIN PRODUCT_PRODUCT t11 ON t1.PRODUCT_ID = t11.ID LEFT JOIN PRODUCT_TEMPLATE t21 ON t11.PRODUCT_TMPL_ID = t21.ID LEFT JOIN MRP_UNBUILD t31 ON t1.UNBUILD_ID = t31.ID LEFT JOIN STOCK_LOCATION t41 ON t1.LOCATION_DEST_ID = t41.ID LEFT JOIN RES_COMPANY t51 ON t1.COMPANY_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN MRP_PRODUCTION t71 ON t1.PRODUCTION_ID = t71.ID LEFT JOIN STOCK_WAREHOUSE t81 ON t1.WAREHOUSE_ID = t81.ID LEFT JOIN STOCK_PICKING_TYPE t91 ON t1.PICKING_TYPE_ID = t91.ID LEFT JOIN MRP_PRODUCTION t101 ON t1.CREATED_PRODUCTION_ID = t101.ID LEFT JOIN PURCHASE_ORDER_LINE t111 ON t1.CREATED_PURCHASE_LINE_ID = t111.ID LEFT JOIN SALE_ORDER_LINE t121 ON t1.SALE_LINE_ID = t121.ID LEFT JOIN RES_PARTNER t131 ON t1.PARTNER_ID = t131.ID LEFT JOIN STOCK_PICKING t141 ON t1.PICKING_ID = t141.ID LEFT JOIN MRP_PRODUCTION t151 ON t1.RAW_MATERIAL_PRODUCTION_ID = t151.ID LEFT JOIN STOCK_MOVE t161 ON t1.ORIGIN_RETURNED_MOVE_ID = t161.ID LEFT JOIN REPAIR_ORDER t171 ON t1.REPAIR_ID = t171.ID LEFT JOIN PURCHASE_ORDER_LINE t181 ON t1.PURCHASE_LINE_ID = t181.ID LEFT JOIN STOCK_LOCATION t191 ON t1.LOCATION_ID = t191.ID LEFT JOIN RES_USERS t201 ON t1.CREATE_UID = t201.ID LEFT JOIN RES_PARTNER t211 ON t201.PARTNER_ID = t211.ID LEFT JOIN UOM_UOM t221 ON t1.PRODUCT_UOM = t221.ID LEFT JOIN MRP_ROUTING_WORKCENTER t231 ON t1.OPERATION_ID = t231.ID LEFT JOIN MRP_WORKORDER t241 ON t1.WORKORDER_ID = t241.ID LEFT JOIN MRP_UNBUILD t251 ON t1.CONSUME_UNBUILD_ID = t251.ID LEFT JOIN PRODUCT_PACKAGING t261 ON t1.PRODUCT_PACKAGING = t261.ID LEFT JOIN RES_PARTNER t271 ON t1.RESTRICT_PARTNER_ID = t271.ID LEFT JOIN STOCK_INVENTORY t281 ON t1.INVENTORY_ID = t281.ID LEFT JOIN STOCK_RULE t291 ON t1.RULE_ID = t291.ID LEFT JOIN RES_USERS t301 ON t1.WRITE_UID = t301.ID LEFT JOIN RES_PARTNER t311 ON t301.PARTNER_ID = t311.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.ADDITIONAL, t121.BACKORDER_ID, t1.BOM_LINE_ID, t1.COMPANY_ID, t61.NAME AS COMPANY_ID_TEXT, t1.CONSUME_UNBUILD_ID, t221.NAME AS CONSUME_UNBUILD_ID_TEXT, t1.CREATED_PRODUCTION_ID, t101.NAME AS CREATED_PRODUCTION_ID_TEXT, t1.CREATED_PURCHASE_LINE_ID, t1.CREATE_DATE, t1.CREATE_UID, t181.NAME AS CREATE_UID_TEXT, t1.DATE, t1.DATE_EXPECTED, t1.GROUP_ID, t21.TRACKING AS HAS_TRACKING, t1.ID, t1.INVENTORY_ID, t251.NAME AS INVENTORY_ID_TEXT, t1.IS_DONE, t1.LOCATION_DEST_ID, t41.NAME AS LOCATION_DEST_ID_TEXT, t1.LOCATION_ID, t161.NAME AS LOCATION_ID_TEXT, t1.NAME, t1.OPERATION_ID, t201.NAME AS OPERATION_ID_TEXT, t1.ORIGIN, t1.ORIGIN_RETURNED_MOVE_ID, t141.NAME AS ORIGIN_RETURNED_MOVE_ID_TEXT, t1.PACKAGE_LEVEL_ID, t1.PARTNER_ID, t111.NAME AS PARTNER_ID_TEXT, t91.CODE AS PICKING_CODE, t1.PICKING_ID, t121.NAME AS PICKING_ID_TEXT, t121.PARTNER_ID AS PICKING_PARTNER_ID, t91.SHOW_ENTIRE_PACKS AS PICKING_TYPE_ENTIRE_PACKS, t1.PICKING_TYPE_ID, t91.NAME AS PICKING_TYPE_ID_TEXT, t1.PRICE_UNIT, t1.PRIORITY, t1.PROCURE_METHOD, t1.PRODUCTION_ID, t71.NAME AS PRODUCTION_ID_TEXT, t1.PRODUCT_ID, t21.NAME AS PRODUCT_ID_TEXT, t1.PRODUCT_PACKAGING, t231.NAME AS PRODUCT_PACKAGING_TEXT, t1.PRODUCT_QTY, t11.PRODUCT_TMPL_ID, t21.TYPE AS PRODUCT_TYPE, t1.PRODUCT_UOM, t1.PRODUCT_UOM_QTY, t191.NAME AS PRODUCT_UOM_TEXT, t1.PROPAGATE, t1.PURCHASE_LINE_ID, t1.RAW_MATERIAL_PRODUCTION_ID, t131.NAME AS RAW_MATERIAL_PRODUCTION_ID_TEXT, t1.REFERENCE, t1.REMAINING_QTY, t1.REMAINING_VALUE, t1.REPAIR_ID, t151.NAME AS REPAIR_ID_TEXT, t1.RESTRICT_PARTNER_ID, t241.NAME AS RESTRICT_PARTNER_ID_TEXT, t1.RULE_ID, t261.NAME AS RULE_ID_TEXT, t1.SALE_LINE_ID, t41.SCRAP_LOCATION AS SCRAPPED, t1.SEQUENCE, t91.SHOW_OPERATIONS, t1.STATE, t1.TO_REFUND, t1.UNBUILD_ID, t31.NAME AS UNBUILD_ID_TEXT, t1.UNIT_FACTOR, t1.VALUE, t1.WAREHOUSE_ID, t81.NAME AS WAREHOUSE_ID_TEXT, t1.WORKORDER_ID, t211.NAME AS WORKORDER_ID_TEXT, t1.WRITE_DATE, t1.WRITE_UID, t281.NAME AS WRITE_UID_TEXT FROM STOCK_MOVE t1 LEFT JOIN PRODUCT_PRODUCT t11 ON t1.PRODUCT_ID = t11.ID LEFT JOIN PRODUCT_TEMPLATE t21 ON t11.PRODUCT_TMPL_ID = t21.ID LEFT JOIN MRP_UNBUILD t31 ON t1.UNBUILD_ID = t31.ID LEFT JOIN STOCK_LOCATION t41 ON t1.LOCATION_DEST_ID = t41.ID LEFT JOIN RES_COMPANY t51 ON t1.COMPANY_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN MRP_PRODUCTION t71 ON t1.PRODUCTION_ID = t71.ID LEFT JOIN STOCK_WAREHOUSE t81 ON t1.WAREHOUSE_ID = t81.ID LEFT JOIN STOCK_PICKING_TYPE t91 ON t1.PICKING_TYPE_ID = t91.ID LEFT JOIN MRP_PRODUCTION t101 ON t1.CREATED_PRODUCTION_ID = t101.ID LEFT JOIN RES_PARTNER t111 ON t1.PARTNER_ID = t111.ID LEFT JOIN STOCK_PICKING t121 ON t1.PICKING_ID = t121.ID LEFT JOIN MRP_PRODUCTION t131 ON t1.RAW_MATERIAL_PRODUCTION_ID = t131.ID LEFT JOIN STOCK_MOVE t141 ON t1.ORIGIN_RETURNED_MOVE_ID = t141.ID LEFT JOIN REPAIR_ORDER t151 ON t1.REPAIR_ID = t151.ID LEFT JOIN STOCK_LOCATION t161 ON t1.LOCATION_ID = t161.ID LEFT JOIN RES_USERS t171 ON t1.CREATE_UID = t171.ID LEFT JOIN RES_PARTNER t181 ON t171.PARTNER_ID = t181.ID LEFT JOIN UOM_UOM t191 ON t1.PRODUCT_UOM = t191.ID LEFT JOIN MRP_ROUTING_WORKCENTER t201 ON t1.OPERATION_ID = t201.ID LEFT JOIN MRP_WORKORDER t211 ON t1.WORKORDER_ID = t211.ID LEFT JOIN MRP_UNBUILD t221 ON t1.CONSUME_UNBUILD_ID = t221.ID LEFT JOIN PRODUCT_PACKAGING t231 ON t1.PRODUCT_PACKAGING = t231.ID LEFT JOIN RES_PARTNER t241 ON t1.RESTRICT_PARTNER_ID = t241.ID LEFT JOIN STOCK_INVENTORY t251 ON t1.INVENTORY_ID = t251.ID LEFT JOIN STOCK_RULE t261 ON t1.RULE_ID = t261.ID LEFT JOIN RES_USERS t271 ON t1.WRITE_UID = t271.ID LEFT JOIN RES_PARTNER t281 ON t271.PARTNER_ID = t281.ID
]]>
</sql>
<!--数据查询[View]-->
<sqlid="View"databaseId="postgresql">
<![CDATA[ SELECT t1.ADDITIONAL, t141.BACKORDER_ID, t1.BOM_LINE_ID, t1.COMPANY_ID, t61.NAME AS COMPANY_ID_TEXT, t1.CONSUME_UNBUILD_ID, t251.NAME AS CONSUME_UNBUILD_ID_TEXT, t1.CREATED_PRODUCTION_ID, t101.NAME AS CREATED_PRODUCTION_ID_TEXT, t1.CREATED_PURCHASE_LINE_ID, t111.NAME AS CREATED_PURCHASE_LINE_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t211.NAME AS CREATE_UID_TEXT, t1.DATE, t1.DATE_EXPECTED, t1.GROUP_ID, t21.TRACKING AS HAS_TRACKING, t1.ID, t1.INVENTORY_ID, t281.NAME AS INVENTORY_ID_TEXT, t1.IS_DONE, t1.LOCATION_DEST_ID, t41.NAME AS LOCATION_DEST_ID_TEXT, t1.LOCATION_ID, t191.NAME AS LOCATION_ID_TEXT, t1.NAME, t1.NOTE, t1.OPERATION_ID, t231.NAME AS OPERATION_ID_TEXT, t1.ORIGIN, t1.ORIGIN_RETURNED_MOVE_ID, t161.NAME AS ORIGIN_RETURNED_MOVE_ID_TEXT, t1.PACKAGE_LEVEL_ID, t1.PARTNER_ID, t131.NAME AS PARTNER_ID_TEXT, t91.CODE AS PICKING_CODE, t1.PICKING_ID, t141.NAME AS PICKING_ID_TEXT, t141.PARTNER_ID AS PICKING_PARTNER_ID, t91.SHOW_ENTIRE_PACKS AS PICKING_TYPE_ENTIRE_PACKS, t1.PICKING_TYPE_ID, t91.NAME AS PICKING_TYPE_ID_TEXT, t1.PRICE_UNIT, t1.PRIORITY, t1.PROCURE_METHOD, t1.PRODUCTION_ID, t71.NAME AS PRODUCTION_ID_TEXT, t1.PRODUCT_ID, t21.NAME AS PRODUCT_ID_TEXT, t1.PRODUCT_PACKAGING, t261.NAME AS PRODUCT_PACKAGING_TEXT, t1.PRODUCT_QTY, t11.PRODUCT_TMPL_ID, t21.TYPE AS PRODUCT_TYPE, t1.PRODUCT_UOM, t1.PRODUCT_UOM_QTY, t221.NAME AS PRODUCT_UOM_TEXT, t1.PROPAGATE, t1.PURCHASE_LINE_ID, t181.NAME AS PURCHASE_LINE_ID_TEXT, t1.RAW_MATERIAL_PRODUCTION_ID, t151.NAME AS RAW_MATERIAL_PRODUCTION_ID_TEXT, t1.REFERENCE, t1.REMAINING_QTY, t1.REMAINING_VALUE, t1.REPAIR_ID, t171.NAME AS REPAIR_ID_TEXT, t1.RESTRICT_PARTNER_ID, t271.NAME AS RESTRICT_PARTNER_ID_TEXT, t1.RULE_ID, t291.NAME AS RULE_ID_TEXT, t1.SALE_LINE_ID, t121.NAME AS SALE_LINE_ID_TEXT, t41.SCRAP_LOCATION AS SCRAPPED, t1.SEQUENCE, t91.SHOW_OPERATIONS, t1.STATE, t1.TO_REFUND, t1.UNBUILD_ID, t31.NAME AS UNBUILD_ID_TEXT, t1.UNIT_FACTOR, t1.VALUE, t1.WAREHOUSE_ID, t81.NAME AS WAREHOUSE_ID_TEXT, t1.WORKORDER_ID, t241.NAME AS WORKORDER_ID_TEXT, t1.WRITE_DATE, t1.WRITE_UID, t311.NAME AS WRITE_UID_TEXT FROM STOCK_MOVE t1 LEFT JOIN PRODUCT_PRODUCT t11 ON t1.PRODUCT_ID = t11.ID LEFT JOIN PRODUCT_TEMPLATE t21 ON t11.PRODUCT_TMPL_ID = t21.ID LEFT JOIN MRP_UNBUILD t31 ON t1.UNBUILD_ID = t31.ID LEFT JOIN STOCK_LOCATION t41 ON t1.LOCATION_DEST_ID = t41.ID LEFT JOIN RES_COMPANY t51 ON t1.COMPANY_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN MRP_PRODUCTION t71 ON t1.PRODUCTION_ID = t71.ID LEFT JOIN STOCK_WAREHOUSE t81 ON t1.WAREHOUSE_ID = t81.ID LEFT JOIN STOCK_PICKING_TYPE t91 ON t1.PICKING_TYPE_ID = t91.ID LEFT JOIN MRP_PRODUCTION t101 ON t1.CREATED_PRODUCTION_ID = t101.ID LEFT JOIN PURCHASE_ORDER_LINE t111 ON t1.CREATED_PURCHASE_LINE_ID = t111.ID LEFT JOIN SALE_ORDER_LINE t121 ON t1.SALE_LINE_ID = t121.ID LEFT JOIN RES_PARTNER t131 ON t1.PARTNER_ID = t131.ID LEFT JOIN STOCK_PICKING t141 ON t1.PICKING_ID = t141.ID LEFT JOIN MRP_PRODUCTION t151 ON t1.RAW_MATERIAL_PRODUCTION_ID = t151.ID LEFT JOIN STOCK_MOVE t161 ON t1.ORIGIN_RETURNED_MOVE_ID = t161.ID LEFT JOIN REPAIR_ORDER t171 ON t1.REPAIR_ID = t171.ID LEFT JOIN PURCHASE_ORDER_LINE t181 ON t1.PURCHASE_LINE_ID = t181.ID LEFT JOIN STOCK_LOCATION t191 ON t1.LOCATION_ID = t191.ID LEFT JOIN RES_USERS t201 ON t1.CREATE_UID = t201.ID LEFT JOIN RES_PARTNER t211 ON t201.PARTNER_ID = t211.ID LEFT JOIN UOM_UOM t221 ON t1.PRODUCT_UOM = t221.ID LEFT JOIN MRP_ROUTING_WORKCENTER t231 ON t1.OPERATION_ID = t231.ID LEFT JOIN MRP_WORKORDER t241 ON t1.WORKORDER_ID = t241.ID LEFT JOIN MRP_UNBUILD t251 ON t1.CONSUME_UNBUILD_ID = t251.ID LEFT JOIN PRODUCT_PACKAGING t261 ON t1.PRODUCT_PACKAGING = t261.ID LEFT JOIN RES_PARTNER t271 ON t1.RESTRICT_PARTNER_ID = t271.ID LEFT JOIN STOCK_INVENTORY t281 ON t1.INVENTORY_ID = t281.ID LEFT JOIN STOCK_RULE t291 ON t1.RULE_ID = t291.ID LEFT JOIN RES_USERS t301 ON t1.WRITE_UID = t301.ID LEFT JOIN RES_PARTNER t311 ON t301.PARTNER_ID = t311.ID
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Account_invoice-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Account_invoice-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Account_invoice-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Account_invoice-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Stock_move-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Stock_move-Get')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Stock_move-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Stock_move-Get')")