sql
select * from odn_project_instance.t_instance_group_cfg json操作 JSONObject body = response.getBody(); JSONArray array = body.getJSONArray("result"); result = JSON.parseObject(array.toString(), new TypeReference<List<Map<String,String>>>(){}); java8对集合进行分组操作 List<Map<String, String>> entirModuleData = parameterMapper.getEntirModuleData(instanceId, language);//获取基础数据 Map<String, List<Map<String,String>>> modulesMap = entirModuleData.stream().collect(Collectors.groupingBy(p->p.get("moduleName")));//对模块进行分组 String.Contains()判断字符串中是否包含子字符串 case when then再update语句中的用法: update t_instance_group_cfg set item_value = CASE group_item_code updateMap.forEach(p->{sb.append(" when '"+p.get("group_item_code")+"' then '"+p.get("item_value")+"' ");}); json_set()的使用: set ot.language_column=Json_SET(ot.language_column,'$.name_en_us',cf.item_value->>'$.name_en_us','$.name_zh_cn',cf.item_value->>'$.name_zh_cn') json_set(data,"$.address","Guangzhou") MySQL中concat函数: 返回结果为连接参数产生的字符串。如有任何一个参数为NULL ,则返回值为 NULL。 select CONCAT(group_item_code,'_code') from t_instance_group_cfg; //会查询t_instance_group_cfg表中group_item_code字段值并将每个值后面拼接上_code SQL语句中update后面还可以进行多表关联! 常见的update语句:update t1 set f=...,f2=... where ... update t1 inner join t2 on ... set t1.f=... where ... sql语句中批量插入: INSERT INTO triangle (sidea, sideb) VALUES(1,1),(3,4),(6,8);