用 goframe 吧
```
func (m *roleMenu) List(page int, size int, id string, rid string, mid string) (int, gdb.List) {
db := g.DB().Model(dao.RoleMenu.Table + " t1").
LeftJoin(dao.Role.Table + " t2 on t1.rid =
t2.id").
LeftJoin(dao.Menu.Table + " t3 on t1.mid =
t3.id")
if id != "" {
db = db.Where("
t1.id", id)
}
if rid != "" {
db = db.Where("t1.rid", rid)
}
if mid != "" {
db = db.Where("t1.mid", mid)
}
count, _ := db.Count()
db.Fields("
t2.name r_name,
t3.name m_name,
t1.id id")
all, _ := db.Limit(size).Offset((page - 1) * size).Order("
t1.id desc").All()
if all.IsEmpty() {
return count, gdb.List{}
}
return count, all.List()
}
```