Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
exy3351 opened this issue Jan 22, 2025 · 0 comments
Open

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

exy3351 opened this issue Jan 22, 2025 · 0 comments

Comments

@exy3351
Copy link

exy3351 commented Jan 22, 2025

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

MapClientInsertable<Map<String, Object>> 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)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant