|
@@ -179,22 +179,25 @@ public class I18nSqlProcessInterceptor implements Interceptor {
|
|
|
});
|
|
|
}
|
|
|
} else if (parameterMap.containsKey("et") && parameterMap.get("et") != null
|
|
|
- && BaseI18nEntity.class.isAssignableFrom(parameterMap.get("et").getClass())) {
|
|
|
- // updateById,updateAllColumnsById method
|
|
|
- Object baseEntity = parameterMap.get("et");
|
|
|
- String baseTableName = tableInfo.getTableName();
|
|
|
- Long baseTableId = (Long) ReflectionUtil.getMethodValue(baseEntity, ID_CONSTANT);
|
|
|
- // updateById,updateAllColumnsById传入的entity必须有id,不然无法确定改哪个
|
|
|
- if (baseTableId != null) {
|
|
|
- List<String> i18nFieldNameList = I18nUtil
|
|
|
- .getSpecificAnnotationI18nFieldNameList(baseEntity.getClass());
|
|
|
- Map<String, Map<String, String>> metaDataMap = constructMetaDataMap(baseEntity,
|
|
|
- i18nFieldNameList);
|
|
|
- execInsertOrUpdateList(metaDataMap, baseTableName, connection, baseTableId);
|
|
|
- } else {
|
|
|
- log.info("Can not find the value of id of parameter 'entity'!");
|
|
|
- }
|
|
|
- }
|
|
|
+ && (BaseI18nEntity.class.isAssignableFrom(parameterMap.get("et").getClass())
|
|
|
+ || BizBaseI18nEntity.class.isAssignableFrom(parameterClass))) {
|
|
|
+ // updateById,updateAllColumnsById method
|
|
|
+ Object baseEntity = parameterMap.get("et");
|
|
|
+ String baseTableName = tableInfo.getTableName();
|
|
|
+ Long baseTableId = (Long) ReflectionUtil.getMethodValue(baseEntity,
|
|
|
+ ID_CONSTANT);
|
|
|
+ // updateById,updateAllColumnsById传入的entity必须有id,不然无法确定改哪个
|
|
|
+ if (baseTableId != null) {
|
|
|
+ List<String> i18nFieldNameList = I18nUtil
|
|
|
+ .getSpecificAnnotationI18nFieldNameList(baseEntity.getClass());
|
|
|
+ Map<String, Map<String, String>> metaDataMap = constructMetaDataMap(
|
|
|
+ baseEntity, i18nFieldNameList);
|
|
|
+ execInsertOrUpdateList(metaDataMap, baseTableName, connection,
|
|
|
+ baseTableId);
|
|
|
+ } else {
|
|
|
+ log.info("Can not find the value of id of parameter 'entity'!");
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
log.info("Parameter'class: " + parameterClass.getName()
|
|
|
+ ",i18n interceptor is not supported for this api now!");
|
|
@@ -444,7 +447,12 @@ public class I18nSqlProcessInterceptor implements Interceptor {
|
|
|
* @return k:language, v: k1:filed,v1:value
|
|
|
*/
|
|
|
private Map<String, Map<String, String>> constructMetaDataMap(Object parameter, List<String> i18nFieldNameList) {
|
|
|
- Map<String, List<Map<String, String>>> metaData = ((BaseI18nEntity) parameter).getI18n();
|
|
|
+ Map<String, List<Map<String, String>>> metaData;
|
|
|
+ if (BizBaseI18nEntity.class.isAssignableFrom(parameter.getClass())) {
|
|
|
+ metaData = ((BizBaseI18nEntity) parameter).getI18n();
|
|
|
+ } else {
|
|
|
+ metaData = ((BaseI18nEntity) parameter).getI18n();
|
|
|
+ }
|
|
|
List<BaseI18nMetaData> baseI18nMetaDataList = new ArrayList<>();
|
|
|
Map<String, Map<String, String>> metaDataMap = new HashMap<>();
|
|
|
if (CollUtil.isEmpty(metaData)) {
|