首先准备两个CVS表单
我第一个表单为customer
第二个表单为order
接着实现2表连接查询
首先写一个实体类CustomerOrder。定义变量
package cn.kgc.kb15.demo05;
import org.apache.hadoop.io.WritableComparable;
import javax.xml.crypto.Data;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
//这里实现WritableComparable接口,并且重载方法
public class CustomerOrder implements WritableComparable<CustomerOrder> {
private Integer customerId;
private String customerName;
private Integer orderId;
private String orderStatus;
private String flag;//订单日期作为区别是订单表还是顾客表
//下面实现get,set方法。tostring方法,构造方法
@Override
public String toString() {
return "CustomerOrder{" +
"customerId=" + customerId +
", customerName='" + customerName + '\'' +
", orderId=" + orderId +
", orderStatus='" + orderStatus + '\'' +
", flag='" + flag + '\'' +
'}';
}
public Integer getCustomerId() {
return customerId;
}
public void setCustomerId(Integer customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public Integer getOrderId() {
return orderI