Merge branch 'dm_20251204' into dev

This commit is contained in:
王奎兴
2025-12-09 19:14:42 +08:00
15 changed files with 674 additions and 9 deletions
@@ -0,0 +1,57 @@
package com.mhd.basic.infrastructure.config;
import com.mhd.basic.infrastructure.util.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -0,0 +1,54 @@
package com.mhd.basic.infrastructure.util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}
@@ -0,0 +1,57 @@
package com.mhd.user.infrastructure.config;
import com.mhd.user.infrastructure.util.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -0,0 +1,54 @@
package com.mhd.user.infrastructure.util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}
@@ -107,7 +107,7 @@
a.driver_license_back_url,
a.driver_license_number,
a.driver_license_long,
a.driver_work_license_authority_code,
cast(a.driver_work_license_authority_code as BIGINT) as driver_work_license_authority_code,
a.driver_work_license_authority_name,
a.driver_work_license_number,
a.driver_work_license_type_id,
@@ -189,7 +189,7 @@
WM_CONCAT(DISTINCT dvb.vehicle_license_plate_number ) AS vehicleLicensePlateNumber,
WM_CONCAT(DISTINCT m.motorcade_name ) AS driverTeamName
FROM
"user" b
"USER" b
LEFT JOIN (
SELECT
user_id,
@@ -325,7 +325,7 @@
FROM
user_driver a
LEFT JOIN
"user" u
"USER" u
ON u.user_id = a.user_id AND u.del_flag = 1
WHERE
a.del_flag = 1
@@ -769,7 +769,7 @@
FROM
user_driver d
LEFT JOIN
"user" u
"USER" u
ON d.user_id = u.user_id
LEFT JOIN
driver_vehicle_bind b
@@ -1105,7 +1105,7 @@
ude.driver_enterprise_fill,
ud.driver_captain_fill
FROM
"user" b
"USER" b
LEFT JOIN user_driver a ON a.user_id = b.user_id
LEFT JOIN user_driver_enterprise ude ON b.user_id = ude.user_id
AND ude.driver_type = 1
@@ -1137,7 +1137,7 @@
a.user_id,
a.create_by
FROM
"user" u
"USER" u
LEFT JOIN user_driver a ON u.user_id = a.user_id
LEFT JOIN motorcade_driver md ON a.user_id = md.user_id
LEFT JOIN motorcade m ON m.motorcade_id = md.motorcade_id
@@ -0,0 +1,57 @@
package com.linke.finance.infrastructure.config;
import com.linke.finance.infrastructure.util.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -0,0 +1,54 @@
package com.linke.finance.infrastructure.util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}
@@ -1110,7 +1110,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.verification_money,
a.first_subject_name,
a.second_subject_name,
a.verification_money,
a.create_by_name,
b.create_by_name record_create_by_name,
a.verification_status
@@ -0,0 +1,57 @@
package com.linke.product.domain.config;
import com.linke.product.domain.util.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -0,0 +1,54 @@
package com.linke.product.domain.util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}
@@ -273,8 +273,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMenuComponent" resultType="java.util.HashMap">
SELECT
menu_component AS menuComponent,
menu_redirect_path AS menuRedirectPath
menu_component,
menu_redirect_path
FROM
sys_menu
where
@@ -0,0 +1,57 @@
package com.linke.thirdParty.infrastructure.config;
import com.linke.thirdParty.infrastructure.utils.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -0,0 +1,54 @@
package com.linke.thirdParty.infrastructure.utils;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}
@@ -0,0 +1,57 @@
package com.linke.transport.infrastructure.config;
import com.linke.transport.infrastructure.util.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -0,0 +1,54 @@
package com.linke.transport.infrastructure.util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}