!79 fix(excel): 字典/表字典分隔符从 _ 改为 , 解决含下划线值被截断
Merge pull request !79 from wsm/fix/excel_export_split
This commit is contained in:
@@ -27,8 +27,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AutoPoiDictConfig implements AutoPoiDictServiceI {
|
||||
final static String EXCEL_SPLIT_TAG = "_";
|
||||
final static String TEMP_EXCEL_SPLIT_TAG = "---";
|
||||
final static String EXCEL_SPLIT_TAG = ",";
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
@@ -62,14 +61,7 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
|
||||
//update-begin---author:liusq Date:20230517 for:[issues/4917]excel 导出异常---
|
||||
if(t!=null && t.getText()!=null && t.getValue()!=null){
|
||||
//update-end---author:liusq Date:20230517 for:[issues/4917]excel 导出异常---
|
||||
//update-begin---author:scott Date:20211220 for:[issues/I4MBB3]@Excel dicText字段的值有下划线时,导入功能不能正确解析---
|
||||
if(t.getValue().contains(EXCEL_SPLIT_TAG)){
|
||||
String val = t.getValue().replace(EXCEL_SPLIT_TAG,TEMP_EXCEL_SPLIT_TAG);
|
||||
dictReplaces.add(t.getText() + EXCEL_SPLIT_TAG + val);
|
||||
}else{
|
||||
dictReplaces.add(t.getText() + EXCEL_SPLIT_TAG + t.getValue());
|
||||
}
|
||||
//update-end---author:20211220 Date:20211220 for:[issues/I4MBB3]@Excel dicText字段的值有下划线时,导入功能不能正确解析---
|
||||
dictReplaces.add(t.getText() + EXCEL_SPLIT_TAG + t.getValue());
|
||||
}
|
||||
}
|
||||
if (dictReplaces != null && dictReplaces.size() != 0) {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public interface DictQuery {
|
||||
* @param dictTable 字典表名(来自 @ExcelColumn.dictTable())
|
||||
* @param dicCode 字典编码字段(来自 @ExcelColumn.dicCode())
|
||||
* @param dicText 字典文本字段(来自 @ExcelColumn.dicText())
|
||||
* @return 格式为 {"text_code", ...} 的数组,如 {"男_0", "女_1"};无结果返回 null 或空数组
|
||||
* @return 格式为 {"text,code", ...} 的数组,如 {"男,0", "女,1"};无结果返回 null 或空数组
|
||||
*/
|
||||
String[] query(String dictTable, String dicCode, String dicText);
|
||||
}
|
||||
|
||||
+3
-3
@@ -215,7 +215,7 @@ public final class ExcelAnnotationUtils {
|
||||
|
||||
static boolean isValidDictDisplay(String[] replace, String value) {
|
||||
for (String s : replace) {
|
||||
String[] arr = s.split("_");
|
||||
String[] arr = s.split(",");
|
||||
if (arr.length >= 2 && arr[0].equals(value)) {
|
||||
return true;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ public final class ExcelAnnotationUtils {
|
||||
|
||||
private static String replaceValue(String[] replace, String value) {
|
||||
for (String s : replace) {
|
||||
String[] arr = s.split("_");
|
||||
String[] arr = s.split(",");
|
||||
if (arr.length == 2 && value.equals(arr[1])) {
|
||||
return arr[0];
|
||||
}
|
||||
@@ -398,7 +398,7 @@ public final class ExcelAnnotationUtils {
|
||||
return;
|
||||
}
|
||||
for (String s : replace) {
|
||||
String[] arr = s.split("_");
|
||||
String[] arr = s.split(",");
|
||||
if (arr.length >= 2) {
|
||||
displayToCode.put(arr[0], arr[1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user