Skip to content

Commit 429c2ad

Browse files
committed
Java:Boot 系列新增 CASE WHEN 的 RAW_MAP 配置示例
1 parent df2123a commit 429c2ad

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoSQLConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public String getUserIdKey(String database, String schema,String datasource, Str
103103
RAW_MAP.put("substring_index(substring_index(content,'.',1),'.',-1) AS subContent", ""); // APIAuto 不支持 ',可以用 Postman 测
104104
RAW_MAP.put("commentWhereItem1","(`Comment`.`userId` = 38710 AND `Comment`.`momentId` = 470)");
105105
RAW_MAP.put("to_days(now())-to_days(`date`)<=7",""); // 给 @having 使用
106+
RAW_MAP.put("sexShowStr","CASE sex WHEN 0 THEN '男' WHEN 1 THEN '女' ELSE '其它' END"); // 给 @having 使用
106107

107108

108109
// 取消注释支持 !key 反选字段 和 字段名映射,需要先依赖插件 https://github.com/APIJSON/apijson-column

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/demo/DemoSQLConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public String getUserIdKey(String database, String schema,String datasource, Str
103103
RAW_MAP.put("substring_index(substring_index(content,'.',1),'.',-1) AS subContent", ""); // APIAuto 不支持 ',可以用 Postman 测
104104
RAW_MAP.put("commentWhereItem1","(`Comment`.`userId` = 38710 AND `Comment`.`momentId` = 470)");
105105
RAW_MAP.put("to_days(now())-to_days(`date`)<=7",""); // 给 @having 使用
106+
RAW_MAP.put("sexShowStr","CASE sex WHEN 0 THEN '男' WHEN 1 THEN '女' ELSE '其它' END"); // 给 @having 使用
106107

107108

108109
// 取消注释支持 !key 反选字段 和 字段名映射,需要先依赖插件 https://github.com/APIJSON/apijson-column
@@ -270,7 +271,7 @@ public String getDBPassword() {
270271
// public String getKey(String key) {
271272
// return super.getKey(ColumnUtil.compatInputKey(key, getTable(), getMethod()));
272273
// }
273-
274+
274275
// 取消注释来兼容 Oracle DATETIME, TIMESTAMP 等日期时间类型的值来写库
275276
// public Object getValue(@NotNull Object value) {
276277
// if (isOracle() && RequestMethod.isQueryMethod(getMethod()) == false && value instanceof String) {

0 commit comments

Comments
 (0)