mirror of https://github.com/mindoc-org/mindoc.git
fix:修复mysql兼容问题
parent
76f1d74632
commit
a64a6c80e6
|
@ -482,7 +482,7 @@ FROM md_books AS book
|
||||||
left join (select *
|
left join (select *
|
||||||
from (select book_id,team_member_id,role_id
|
from (select book_id,team_member_id,role_id
|
||||||
from md_team_relationship as mtr
|
from md_team_relationship as mtr
|
||||||
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id) as team on team.book_id=book.book_id
|
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id,t.team_member_id,t.book_id) as team on team.book_id=book.book_id
|
||||||
WHERE relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0`
|
WHERE relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0`
|
||||||
err = o.Raw(sql1, memberId, memberId).QueryRow(&totalCount)
|
err = o.Raw(sql1, memberId, memberId).QueryRow(&totalCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -493,7 +493,7 @@ WHERE relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0
|
||||||
left join (select *
|
left join (select *
|
||||||
from (select book_id,team_member_id,role_id
|
from (select book_id,team_member_id,role_id
|
||||||
from md_team_relationship as mtr
|
from md_team_relationship as mtr
|
||||||
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id) as team on team.book_id=book.book_id
|
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id,t.team_member_id,t.book_id) as team on team.book_id=book.book_id
|
||||||
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
|
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
|
||||||
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
|
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
|
||||||
WHERE rel.relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0 ORDER BY order_index ,book.book_id DESC LIMIT ?,?`
|
WHERE rel.relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0 ORDER BY order_index ,book.book_id DESC LIMIT ?,?`
|
||||||
|
@ -534,7 +534,7 @@ FROM md_books AS book
|
||||||
left join (select *
|
left join (select *
|
||||||
from (select book_id,team_member_id,role_id
|
from (select book_id,team_member_id,role_id
|
||||||
from md_team_relationship as mtr
|
from md_team_relationship as mtr
|
||||||
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id) as team on team.book_id = book.book_id
|
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id,t.team_member_id,t.book_id) as team on team.book_id = book.book_id
|
||||||
WHERE (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0) AND book.label LIKE ?`
|
WHERE (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0) AND book.label LIKE ?`
|
||||||
|
|
||||||
err = o.Raw(sql1, memberId, memberId, keyword).QueryRow(&totalCount)
|
err = o.Raw(sql1, memberId, memberId, keyword).QueryRow(&totalCount)
|
||||||
|
@ -545,7 +545,7 @@ WHERE (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id >
|
||||||
LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.member_id = ?
|
LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.member_id = ?
|
||||||
left join (select * from (select book_id,team_member_id,role_id
|
left join (select * from (select book_id,team_member_id,role_id
|
||||||
from md_team_relationship as mtr
|
from md_team_relationship as mtr
|
||||||
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id) as team
|
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id,t.team_member_id,t.book_id) as team
|
||||||
on team.book_id = book.book_id
|
on team.book_id = book.book_id
|
||||||
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
|
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
|
||||||
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
|
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (item *Itemsets) Include() (*Itemsets, error) {
|
||||||
item.CreateTimeString = item.CreateTime.Format("2006-01-02 15:04:05")
|
item.CreateTimeString = item.CreateTime.Format("2006-01-02 15:04:05")
|
||||||
|
|
||||||
if item.MemberId > 0 {
|
if item.MemberId > 0 {
|
||||||
if m,err := NewMember().Find(item.MemberId,"account","real_name");err == nil {
|
if m, err := NewMember().Find(item.MemberId, "account", "real_name"); err == nil {
|
||||||
if m.RealName != "" {
|
if m.RealName != "" {
|
||||||
item.CreateName = m.RealName
|
item.CreateName = m.RealName
|
||||||
} else {
|
} else {
|
||||||
|
@ -213,6 +213,7 @@ func (item *Itemsets) FindItemsetsByItemKey(key string, pageIndex, pageSize, mem
|
||||||
err = item.QueryTable().Filter("item_key", key).One(item)
|
err = item.QueryTable().Filter("item_key", key).One(item)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
beego.Error("查询项目空间时出错 ->", key, err)
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
offset := (pageIndex - 1) * pageSize
|
offset := (pageIndex - 1) * pageSize
|
||||||
|
@ -224,18 +225,19 @@ FROM md_books AS book
|
||||||
left join (select *
|
left join (select *
|
||||||
from (select book_id,team_member_id,role_id
|
from (select book_id,team_member_id,role_id
|
||||||
from md_team_relationship as mtr
|
from md_team_relationship as mtr
|
||||||
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id) as team on team.book_id = book.book_id
|
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id,t.team_member_id,t.book_id) as team on team.book_id = book.book_id
|
||||||
WHERE book.item_id = ? AND (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0)`
|
WHERE book.item_id = ? AND (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0)`
|
||||||
|
|
||||||
err = o.Raw(sql1, memberId, memberId, item.ItemId).QueryRow(&totalCount)
|
err = o.Raw(sql1, memberId, memberId, item.ItemId).QueryRow(&totalCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
beego.Error("查询项目空间时出错 ->", key, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sql2 := `SELECT book.*,rel1.*,member.account AS create_name FROM md_books AS book
|
sql2 := `SELECT book.*,rel1.*,member.account AS create_name FROM md_books AS book
|
||||||
LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.member_id = ?
|
LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.member_id = ?
|
||||||
left join (select * from (select book_id,team_member_id,role_id
|
left join (select * from (select book_id,team_member_id,role_id
|
||||||
from md_team_relationship as mtr
|
from md_team_relationship as mtr
|
||||||
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id) as team
|
left join md_team_member as mtm on mtm.team_id=mtr.team_id and mtm.member_id=? order by role_id desc )as t group by t.book_id,t.team_member_id,t.book_id) as team
|
||||||
on team.book_id = book.book_id
|
on team.book_id = book.book_id
|
||||||
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
|
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
|
||||||
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
|
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
|
||||||
|
|
|
@ -207,7 +207,7 @@ func (m *TeamMember) FindNotJoinMemberByAccount(teamId int, account string, limi
|
||||||
sql := `select member.member_id,member.account
|
sql := `select member.member_id,member.account
|
||||||
from md_members as member
|
from md_members as member
|
||||||
left join md_team_member as team on team.team_id = ? and member.member_id != team.member_id
|
left join md_team_member as team on team.team_id = ? and member.member_id != team.member_id
|
||||||
where member.account like ? and team.member_id isnull
|
where member.account like ? and team.member_id is null
|
||||||
order by member.member_id desc
|
order by member.member_id desc
|
||||||
limit ?;`
|
limit ?;`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue