dromara / dromara/easy-query

需求:columnConfigure中的sqlSegment支持条件判断

Open
#304 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
777
Forks
78
PR merge metrics
No merged PRs in 30d

Description

在columnConfigure给指定的属性设置指定值时支持条件判断,如下面代码

MapClientInsertable> mapMapClientInsertable = client.mapInsertable(values)
.asTable(tableName)
.columnConfigure(c -> c.column(shapeName, "ST_GeomFromText({0}, " + wkid + ")", (context, parameter) -> {
//"GEOMETRYCOLLECTION EMPTY"
context.value(parameter);
}));

但shapeName的值为空时 ,其sqlSegment要使用 "GEOMETRYCOLLECTION EMPTY" (表示空图形)
不为空时,使用 "ST_GeomFromText({0}, 4490)" ,{0} 指实际的值,
如值为 POLYGON ((118.39720 22.90420, 118.40720 22.90420, 118.40720 22.91420, 118.39720 22.91420, 118.39720 22.90420))
则解析后的sqlSegment 为 "ST_GeomFromText( ' POLYGON ((118.39720 22.90420, 118.40720 22.90420, 118.40720 22.91420, 118.39720 22.91420, 118.39720 22.90420)) ' , 4490)"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.