Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

行政区划展示问题怎么解决?

image.png
数据库是这样存的,全国有70w多的数据,比如我业务要查“广东省深圳市福田区”的时候,业务表怎么设计才比较合理?如果修改区划名称又怎么办?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你要查询这个地区的数据 肯定不会是传递名字(对于名字,前端拿数据自己去拼接,名字的问题解决了)
一般这种树结构的,都会加一个字段存储路径,例如:省code,市code,区县code
你要查询某个省或者市的所有节点,直接like就行了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...