请使用mybatis表示以下sql语句:select s.id, s.name, s.state, date_order, r.name,validity_date, s.create_date, confirmation_date, user_id, partner_id, partner_invoice_id, partner_shipping_id, pricelist_id, invoice_status, note, amount_untaxed, amount_tax, amount_total, payment_term_id, team_id, s.create_uid, s.write_uid, s.write_date, warehouse_id, procurement_group_id, delivery_conditions, instruction_order, contract_no, transport_type, is_provide_invoice, is_provide_freight, contract_date, delivery_conditions_id, is_tax, worldchamp_bank_id, amount_total_daxie, is_inventory from sale_order as s left join res_partner as r on s.partner_id = r.id order by s.id desc
时间: 2024-03-23 10:37:39 浏览: 123
Mybatis基于注解形式的sql语句生成实例代码
同样地,使用MyBatis的注解方式表示以上SQL语句可以如下:
```java
@Select("SELECT s.id, s.name, s.state, date_order, r.name, validity_date, s.create_date, confirmation_date, user_id, partner_id, partner_invoice_id, partner_shipping_id, pricelist_id, invoice_status, note, amount_untaxed, amount_tax, amount_total, payment_term_id, team_id, s.create_uid, s.write_uid, s.write_date, warehouse_id, procurement_group_id, delivery_conditions, instruction_order, contract_no, transport_type, is_provide_invoice, is_provide_freight, contract_date, delivery_conditions_id, is_tax, worldchamp_bank_id, amount_total_daxie, is_inventory FROM sale_order s LEFT JOIN res_partner r ON s.partner_id = r.id ORDER BY s.id DESC")
List<SaleOrderDTO> selectSaleOrderAndPartner();
```
其中,`SaleOrderDTO`为返回结果对象。如果使用XML方式配置SQL语句,则可以如下编写:
```xml
<select id="selectSaleOrderAndPartner" resultType="SaleOrderDTO">
SELECT s.id, s.name, s.state, date_order, r.name, validity_date, s.create_date, confirmation_date, user_id, partner_id, partner_invoice_id, partner_shipping_id, pricelist_id, invoice_status, note, amount_untaxed, amount_tax, amount_total, payment_term_id, team_id, s.create_uid, s.write_uid, s.write_date, warehouse_id, procurement_group_id, delivery_conditions, instruction_order, contract_no, transport_type, is_provide_invoice, is_provide_freight, contract_date, delivery_conditions_id, is_tax, worldchamp_bank_id, amount_total_daxie, is_inventory FROM sale_order s LEFT JOIN res_partner r ON s.partner_id = r.id ORDER BY s.id DESC
</select>
```
阅读全文