增加join的orm兼容性
This commit is contained in:
parent
3b2a317d2b
commit
22d00739ff
@ -460,15 +460,15 @@ func (that *HoTimeDB) Select(table string, qu ...interface{}) []Map {
|
|||||||
v := testQuData[k]
|
v := testQuData[k]
|
||||||
switch Substr(k, 0, 3) {
|
switch Substr(k, 0, 3) {
|
||||||
case "[>]":
|
case "[>]":
|
||||||
query += " LEFT JOIN " + Substr(k, 3, len(k)-3) + " ON " + v.(string)
|
query += " LEFT JOIN `" + Substr(k, 3, len(k)-3) + "` ON " + v.(string)
|
||||||
case "[<]":
|
case "[<]":
|
||||||
query += " RIGHT JOIN " + Substr(k, 3, len(k)-3) + " ON " + v.(string)
|
query += " RIGHT JOIN `" + Substr(k, 3, len(k)-3) + "` ON " + v.(string)
|
||||||
}
|
}
|
||||||
switch Substr(k, 0, 4) {
|
switch Substr(k, 0, 4) {
|
||||||
case "[<>]":
|
case "[<>]":
|
||||||
query += " FULL JOIN " + Substr(k, 4, len(k)-4) + " ON " + v.(string)
|
query += " FULL JOIN `" + Substr(k, 4, len(k)-4) + "` ON " + v.(string)
|
||||||
case "[><]":
|
case "[><]":
|
||||||
query += " INNER JOIN " + Substr(k, 4, len(k)-4) + " ON " + v.(string)
|
query += " INNER JOIN `" + Substr(k, 4, len(k)-4) + "` ON " + v.(string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ var DeclareCtr = Ctr{
|
|||||||
//标签分析
|
//标签分析
|
||||||
if tags != nil {
|
if tags != nil {
|
||||||
for _, v := range tags {
|
for _, v := range tags {
|
||||||
dtag := that.Db.Select("declare_tag", Map{"[><]`declare`": "declare_tag.declare_id=declare.id"}, "declare_tag.declare_id", Map{"AND": Map{"OR": Map{"declare.policy_level": Slice{"省", "市"}, "declare.dispatch_department[~]": qu}, "declare_tag.tag_id": v}})
|
dtag := that.Db.Select("declare_tag", Map{"[><]declare": "declare_tag.declare_id=declare.id"}, "declare_tag.declare_id", Map{"AND": Map{"OR": Map{"declare.policy_level": Slice{"省", "市"}, "declare.dispatch_department[~]": qu}, "declare_tag.tag_id": v}})
|
||||||
for _, v1 := range dtag {
|
for _, v1 := range dtag {
|
||||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||||
declares[v1.GetCeilInt64("declare_id")] = v1
|
declares[v1.GetCeilInt64("declare_id")] = v1
|
||||||
|
Loading…
Reference in New Issue
Block a user