| 
														
															@@ -1,5 +1,6 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 package com.sysu.admin.controller.crop.range; 
														 | 
														
														 | 
														
															 package com.sysu.admin.controller.crop.range; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.utils.TextUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import lombok.extern.slf4j.Slf4j; 
														 | 
														
														 | 
														
															 import lombok.extern.slf4j.Slf4j; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.hibernate.EmptyInterceptor; 
														 | 
														
														 | 
														
															 import org.hibernate.EmptyInterceptor; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -24,8 +25,17 @@ public class AutoTableNameInterceptor extends EmptyInterceptor { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 sql = sql.replaceAll("p_crop", tableName); 
														 | 
														
														 | 
														
															                 sql = sql.replaceAll("p_crop", tableName); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (sql.indexOf("select") > -1) { 
														 | 
														
														 | 
														
															             if (sql.indexOf("select") > -1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                /处理多表查询 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                sql = sql.replaceAll("p_crop", tableName); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String newSql = ""; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String[] tableArray =  TextUtil.split(tableName,","); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                int i=0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                for(String table : tableArray) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    if (i > 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        newSql += "\n union all \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    newSql += sql.replaceAll("p_crop", table); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    i++; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return newSql; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return sql; 
														 | 
														
														 | 
														
															         return sql; 
														 |