java two map left join
2020-12-24 21:27
标签:source flat oracle jeecg link 对象 esper ons dma java two map left join - 国际版 Bing 两个不同的Java对象的“左连接”-代码日志 10 ways to Join two Lists in Java - Techie Delight Map-side Join Vs. Join | Edureka Blog Using JoinRowSet Objects (The Java? Tutorials > JDBC(TM) Database Access > JDBC Basics) JPA Join Types | Baeldung package org.jeecgframework.test.crm; import java.util.ArrayList; import org.jeecgframework.minidao.spring.map.MiniDaoLinkedMap; public class Java8StreamTest { // {departname=专部, rolename=总监, realname=张, mobilephone=10041268773, resourcecount=0, resourcecountinvalid=0, resourcecountclosedeals=0} // {username=王, phone=10069715637, effective_case_number=0, old_customer_performance=0.0, new_customer_performance=0.0, total_customer_performance=0.0} // List // List } java two map left join 标签:source flat oracle jeecg link 对象 esper ons dma 原文地址:https://www.cnblogs.com/rgqancy/p/13209823.html
https://cn.bing.com/search?FORM=U227DF&PC=U227&q=java+two+map+left+join
https://stackoverflow.com/questions/25593733/left-join-of-two-different-java-objects
https://www.techiedelight.com/join-two-lists-java/
https://www.edureka.co/blog/map-side-join-vs-join/
https://docs.oracle.com/javase/tutorial/jdbc/basics/joinrowset.html
https://www.baeldung.com/jpa-join-types
import java.util.List;
import java.util.stream.Collectors;private static String[] REPORT_SALES_WORKLOAD_KEYS = new String[] { "departname", "rolename", "realname",
"resourcecount", "resourcecountinvalid", "resourcecountclosedeals", "mobilephone" };
private static String[] REPORT_SALES_PERFORMANCE_KEYS = new String[] { "username", "phone", "effective_case_number",
"old_customer_performance", "new_customer_performance", "total_customer_performance" };
public String ObjectToString(Object obj) {
String str = "";
if (obj != null) {
str = obj.toString();
}
return str;
}
public void test() {
// {departname=专部, rolename=总监, realname=潘, mobilephone=10011806256, resourcecount=0, resourcecountinvalid=0, resourcecountclosedeals=0}
// {departname=专部, rolename=顾问, realname=专3, mobilephone=, resourcecount=0, resourcecountinvalid=0, resourcecountclosedeals=0}
// {departname=专部, rolename=顾问, realname=专4, mobilephone=, resourcecount=0, resourcecountinvalid=0, resourcecountclosedeals=0}
// {departname=专部, rolename=顾问, realname=张, mobilephone=, resourcecount=0, resourcecountinvalid=0, resourcecountclosedeals=0}
List
MiniDaoLinkedMap miniDaoLinkedMap11 = new MiniDaoLinkedMap();
miniDaoLinkedMap11.put("departname", "专部");
miniDaoLinkedMap11.put("rolename", "总监");
miniDaoLinkedMap11.put("realname", "张");
miniDaoLinkedMap11.put("mobilephone", "10041268773");
miniDaoLinkedMap11.put("resourcecount", "0");
miniDaoLinkedMap11.put("resourcecountinvalid", "0");
miniDaoLinkedMap11.put("resourcecountclosedeals", "0");
MiniDaoLinkedMap miniDaoLinkedMap12 = new MiniDaoLinkedMap();
miniDaoLinkedMap12.put("departname", "专部");
miniDaoLinkedMap12.put("rolename", "总监");
miniDaoLinkedMap12.put("realname", "潘");
miniDaoLinkedMap12.put("mobilephone", "10011806256");
miniDaoLinkedMap12.put("resourcecount", "0");
miniDaoLinkedMap12.put("resourcecountinvalid", "0");
miniDaoLinkedMap12.put("resourcecountclosedeals", "0");
MiniDaoLinkedMap miniDaoLinkedMap13 = new MiniDaoLinkedMap();
miniDaoLinkedMap13.put("departname", "专部");
miniDaoLinkedMap13.put("rolename", "顾问");
miniDaoLinkedMap13.put("realname", "专3");
miniDaoLinkedMap13.put("mobilephone", null);
miniDaoLinkedMap13.put("resourcecount", "0");
miniDaoLinkedMap13.put("resourcecountinvalid", "0");
miniDaoLinkedMap13.put("resourcecountclosedeals", "0");
MiniDaoLinkedMap miniDaoLinkedMap14 = new MiniDaoLinkedMap();
miniDaoLinkedMap14.put("departname", "专部");
miniDaoLinkedMap14.put("rolename", "顾问");
miniDaoLinkedMap14.put("realname", "专4");
miniDaoLinkedMap14.put("mobilephone", "");
miniDaoLinkedMap14.put("resourcecount", "0");
miniDaoLinkedMap14.put("resourcecountinvalid", "0");
miniDaoLinkedMap14.put("resourcecountclosedeals", "0");
MiniDaoLinkedMap miniDaoLinkedMap15 = new MiniDaoLinkedMap();
miniDaoLinkedMap15.put("departname", "专部");
miniDaoLinkedMap15.put("rolename", "顾问");
miniDaoLinkedMap15.put("realname", "张");
miniDaoLinkedMap15.put("mobilephone", " ");
miniDaoLinkedMap15.put("resourcecount", "0");
miniDaoLinkedMap15.put("resourcecountinvalid", "0");
miniDaoLinkedMap15.put("resourcecountclosedeals", "0");
salesWorkLoadList.add(miniDaoLinkedMap11);
salesWorkLoadList.add(miniDaoLinkedMap12);
salesWorkLoadList.add(miniDaoLinkedMap13);
salesWorkLoadList.add(miniDaoLinkedMap14);
salesWorkLoadList.add(miniDaoLinkedMap15);
// {username=贾, phone=10001047098, effective_case_number=0, old_customer_performance=0.0, new_customer_performance=0.0, total_customer_performance=0.0}
// {username=张, phone=10041268773, effective_case_number=0, old_customer_performance=0.0, new_customer_performance=0.0, total_customer_performance=0.0}
// {username=田, phone=10022826166, effective_case_number=0, old_customer_performance=0.0, new_customer_performance=0.0, total_customer_performance=0.0}
// {username=蒙, phone=10010387081, effective_case_number=0, old_customer_performance=0.0, new_customer_performance=0.0, total_customer_performance=0.0}
List
MiniDaoLinkedMap miniDaoLinkedMap21 = new MiniDaoLinkedMap();
miniDaoLinkedMap21.put("username", "王");
miniDaoLinkedMap21.put("phone", "10069715637");
miniDaoLinkedMap21.put("effective_case_number", "0");
miniDaoLinkedMap21.put("old_customer_performance", "0.0");
miniDaoLinkedMap21.put("new_customer_performance", "0.0");
miniDaoLinkedMap21.put("total_customer_performance", "0.0");
MiniDaoLinkedMap miniDaoLinkedMap22 = new MiniDaoLinkedMap();
miniDaoLinkedMap22.put("username", "贾");
miniDaoLinkedMap22.put("phone", "10001047098");
miniDaoLinkedMap22.put("effective_case_number", "0");
miniDaoLinkedMap22.put("old_customer_performance", "0.0");
miniDaoLinkedMap22.put("new_customer_performance", "0.0");
miniDaoLinkedMap22.put("total_customer_performance", "0.0");
MiniDaoLinkedMap miniDaoLinkedMap23 = new MiniDaoLinkedMap();
miniDaoLinkedMap23.put("username", "张");
miniDaoLinkedMap23.put("phone", "10041268773");
miniDaoLinkedMap23.put("effective_case_number", "0");
miniDaoLinkedMap23.put("old_customer_performance", "0.0");
miniDaoLinkedMap23.put("new_customer_performance", "0.0");
miniDaoLinkedMap23.put("total_customer_performance", "0.0");
MiniDaoLinkedMap miniDaoLinkedMap24 = new MiniDaoLinkedMap();
miniDaoLinkedMap24.put("username", "田");
miniDaoLinkedMap24.put("phone", "10022826166");
miniDaoLinkedMap24.put("effective_case_number", "0");
miniDaoLinkedMap24.put("old_customer_performance", "0.0");
miniDaoLinkedMap24.put("new_customer_performance", "0.0");
miniDaoLinkedMap24.put("total_customer_performance", "0.0");
MiniDaoLinkedMap miniDaoLinkedMap25 = new MiniDaoLinkedMap();
miniDaoLinkedMap25.put("username", "蒙");
miniDaoLinkedMap25.put("phone", "10010387081");
miniDaoLinkedMap25.put("effective_case_number", "0");
miniDaoLinkedMap25.put("old_customer_performance", "0.0");
miniDaoLinkedMap25.put("new_customer_performance", "0.0");
miniDaoLinkedMap25.put("total_customer_performance", "0.0");
salesPerformanceList.add(miniDaoLinkedMap21);
salesPerformanceList.add(miniDaoLinkedMap22);
salesPerformanceList.add(miniDaoLinkedMap23);
salesPerformanceList.add(miniDaoLinkedMap24);
//salesPerformanceList.add(miniDaoLinkedMap25); List
// .flatMap(x -> salesWorkLoadList.stream()
// .filter(y -> y.get(REPORT_SALES_PERFORMANCE_KEYS[1]).equals(x.get(REPORT_SALES_WORKLOAD_KEYS[6])))
// .map(y -> new OutputData(
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[0], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[1], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[2], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[3], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[4], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[5], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[6], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[2], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[3], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[4], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[5], "")))))
// .collect(Collectors.toList());
// .flatMap(x -> salesPerformanceList.stream()
// .filter(y -> x.get(REPORT_SALES_PERFORMANCE_KEYS[1]).equals(y.get(REPORT_SALES_WORKLOAD_KEYS[6])))
// .map(y -> new OutputData(
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[0], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[1], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[2], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[3], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[4], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[5], "")),
// ObjectToString(x.getOrDefault(REPORT_SALES_WORKLOAD_KEYS[6], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[2], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[3], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[4], "")),
// ObjectToString(y.getOrDefault(REPORT_SALES_PERFORMANCE_KEYS[5], "")))))
// .collect(Collectors.toList());
}public static void main(String[] args) {
Java8StreamTest java8StreamTest = new Java8StreamTest();
java8StreamTest.test();
}
public class OutputData {
private String departname;
private String rolename;
private String realname;
private String resourcecount;
private String resourcecountinvalid;
private String resourcecountclosedeals;
private String mobilephone;
private String effective_case_number;
private String old_customer_performance;
private String new_customer_performance;
private String total_customer_performance;
public OutputData(){
}
public OutputData(String departname, String rolename, String realname, String resourcecount,
String resourcecountinvalid, String resourcecountclosedeals, String mobilephone,
String effective_case_number, String old_customer_performance, String new_customer_performance,
String total_customer_performance) {
this.departname = departname;
this.rolename = rolename;
this.realname = realname;
this.resourcecount = resourcecount;
this.resourcecountinvalid = resourcecountinvalid;
this.resourcecountclosedeals = resourcecountclosedeals;
this.mobilephone = mobilephone;
this.effective_case_number = effective_case_number;
this.old_customer_performance = old_customer_performance;
this.new_customer_performance = new_customer_performance;
this.total_customer_performance = total_customer_performance;
}
public String getDepartname() {
return departname;
}
public void setDepartname(String departname) {
this.departname = departname;
}
public String getRolename() {
return rolename;
}
public void setRolename(String rolename) {
this.rolename = rolename;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public String getResourcecount() {
return resourcecount;
}
public void setResourcecount(String resourcecount) {
this.resourcecount = resourcecount;
}
public String getResourcecountinvalid() {
return resourcecountinvalid;
}
public void setResourcecountinvalid(String resourcecountinvalid) {
this.resourcecountinvalid = resourcecountinvalid;
}
public String getResourcecountclosedeals() {
return resourcecountclosedeals;
}
public void setResourcecountclosedeals(String resourcecountclosedeals) {
this.resourcecountclosedeals = resourcecountclosedeals;
}
public String getMobilephone() {
return mobilephone;
}
public void setMobilephone(String mobilephone) {
this.mobilephone = mobilephone;
}
public String getEffective_case_number() {
return effective_case_number;
}
public void setEffective_case_number(String effective_case_number) {
this.effective_case_number = effective_case_number;
}
public String getOld_customer_performance() {
return old_customer_performance;
}
public void setOld_customer_performance(String old_customer_performance) {
this.old_customer_performance = old_customer_performance;
}
public String getNew_customer_performance() {
return new_customer_performance;
}
public void setNew_customer_performance(String new_customer_performance) {
this.new_customer_performance = new_customer_performance;
}
public String getTotal_customer_performance() {
return total_customer_performance;
}
public void setTotal_customer_performance(String total_customer_performance) {
this.total_customer_performance = total_customer_performance;
}
}
文章标题:java two map left join
文章链接:http://soscw.com/index.php/essay/38006.html