只供LeftJoinSqlBuild创建SQL语句使用 @param table 需要左联查询的表 @param usedTables 已使用的表 @param on 联合查询条件 @return newon 新的联合查询条件(返回未被使用的联合查询条件) @return ret 返回组装联合查询条件
(table string, usedTables []string, on []map[string]string)
| 447 | //@return newon 新的联合查询条件(返回未被使用的联合查询条件) |
| 448 | //@return ret 返回组装联合查询条件 |
| 449 | func joinOn(table string, usedTables []string, on []map[string]string) (newon []map[string]string, ret string) { |
| 450 | table = table + "." |
| 451 | lenon := len(on) |
| 452 | for index, v := range on { |
| 453 | for key, val := range v { |
| 454 | if strings.HasPrefix(key, table) || strings.HasPrefix(val, table) { |
| 455 | for _, used := range usedTables { |
| 456 | if strings.HasPrefix(key, used) || strings.HasPrefix(val, used) { |
| 457 | ret = key + "=" + val |
| 458 | if index > 0 { |
| 459 | newon = append(newon, on[0:index]...) |
| 460 | } |
| 461 | if index+1 <= lenon { |
| 462 | newon = append(newon, on[(index+1):]...) |
| 463 | } |
| 464 | return |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | } |
| 469 | } |
| 470 | return |
| 471 | } |
| 472 | |
| 473 | //替换写入【注意:表中必须要有一个除了主键外的唯一键】 |
| 474 | //@param table 需要写入的table |