APIJSON icon indicating copy to clipboard operation
APIJSON copied to clipboard

APIJSON LocalDateTime统一日期格式

Open cloudAndMonkey opened this issue 2 years ago • 5 comments

Description

@TommyLemon 数据库字段类型: image

查询结果: image

期望日期格式: image

https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLExecutor.java#L1005 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); value = dtf.format((LocalDateTime) value); 统一处理一下, 不然业务侧需实现 onPutColumn 方法, 去判断字段名分别处理(LocalDateTime 已经toString()).

cloudAndMonkey avatar Mar 19 '23 08:03 cloudAndMonkey

可以直接把 toString 改为 toLocalString。 不改源码除了 重写 onPutColumn 也可以重写 getValue (更简单)

TommyLemon avatar Mar 19 '23 15:03 TommyLemon

可以直接把 toString 改为 toLocalString。 不改源码除了 重写 onPutColumn 也可以重写 getValue (更简单)

@TommyLemon 重写 getValue , 需要将 APIJSONSQLExecutor、AbstractSQLExecutor两部分代码合并 😂 也可以让前端通过公共函数处理 APIJSONSQLExecutor image

cloudAndMonkey avatar Mar 20 '23 01:03 cloudAndMonkey

可以直接把 toString 改为 toLocalString。 不改源码除了 重写 onPutColumn 也可以重写 getValue (更简单)

@TommyLemon 重写 getValue , 需要将 APIJSONSQLExecutor、AbstractSQLExecutor两部分代码合并 😂 也可以让前端通过公共函数处理 APIJSONSQLExecutor image

不用合并,直接重写,逻辑和这段一样

TommyLemon avatar Mar 20 '23 05:03 TommyLemon