Java实现,当然也可以数据库实现;
/** * Created by shaozhiqi on 2019/7/31. */ public class TestUnion { @Test public void test1() { List<Map<String, Object>> dbList = new ArrayList<>(); Map map1 = new HashMap<>(); map1.put("id", "1"); map1.put("assort_no", "11111"); map1.put("name", "test"); map1.put("leve1", "high"); map1.put("leve1Desc", "高风险"); dbList.add(map1); Map map2 = new HashMap<>(); map2.put("id", "2"); map2.put("assort_no", "11111"); map2.put("name", "test"); map2.put("leve1", "low"); map2.put("leve1Desc", "低风险1"); dbList.add(map2); Map map3 = new HashMap<>(); map3.put("id", "3"); map3.put("assort_no", "11222"); map3.put("name", "test2"); map3.put("leve1", "low"); map3.put("