dotnetcore / SmartSql

SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
https://smartsql.net/
Apache License 2.0
1.1k stars 222 forks source link

分表操作 #48

Closed pigbrother closed 5 years ago

pigbrother commented 5 years ago

对于分表的操作,(切换表名)貌似不是很友好?请赐教

Ahoo-Wang commented 5 years ago

@pigbrother 请把场景描述清楚。

pigbrother commented 5 years ago

比如按地域或者说区县来分表(已分) 假设都由表 table 分出 (与table字段 索引等都一致)扩展 table_1 table_2 table_3 。。。table_N 正常情况下 只需要判断 table是否做分表处理 如果做了 获取最新的table_m 然后生成sql即可。 现在配置到xml 对于此场景貌似不是很友好(要么说针对这种操作单独做处理)。

pigbrother commented 5 years ago

比如xml配置 insert into table(xxx,xx,xx,xxx) values(xx,xx,xx,xx) 实际比如是 北京地域提交上来的 获取到北京所在的表为 table_1 实际得更换sql 为 insert into table_1(xxx,xx,xx,xxx) values(xx,xx,xx,xx)

Ahoo-Wang commented 5 years ago

@pigbrother 这个需求可以使用占位符标签 https://doc.smartsql.net/config/sqlmap.html#statement-%E5%85%B6%E4%BB%96%E5%AD%90%E6%A0%87%E7%AD%BE

image

pigbrother commented 5 years ago

了解 thanks

windsOne commented 5 years ago

@pigbrother 方便加个qq 吗 询问些使用问题