增加join的orm兼容性

This commit is contained in:
hoteas 2022-05-05 18:33:27 +08:00
parent 3b2a317d2b
commit 22d00739ff
2 changed files with 5 additions and 5 deletions

View File

@ -460,15 +460,15 @@ func (that *HoTimeDB) Select(table string, qu ...interface{}) []Map {
v := testQuData[k]
switch Substr(k, 0, 3) {
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 "[<]":
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) {
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 "[><]":
query += " INNER JOIN " + Substr(k, 4, len(k)-4) + " ON " + v.(string)
query += " INNER JOIN `" + Substr(k, 4, len(k)-4) + "` ON " + v.(string)
}
}
}

View File

@ -139,7 +139,7 @@ var DeclareCtr = Ctr{
//标签分析
if tags != nil {
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 {
if declares[v1.GetCeilInt64("declare_id")] == nil {
declares[v1.GetCeilInt64("declare_id")] = v1