suggest
This commit is contained in:
parent
1ac2d023bb
commit
c96d275a95
|
@ -2,6 +2,7 @@ package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"enterprise/common/model"
|
"enterprise/common/model"
|
||||||
|
"fmt"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -93,13 +94,13 @@ func (d *StaffUserDao) Query(page, size int, corpId int64, status int, username,
|
||||||
tx.Where("username = ?", username)
|
tx.Where("username = ?", username)
|
||||||
}
|
}
|
||||||
if realname != "" {
|
if realname != "" {
|
||||||
tx.Where("realname = ?", realname)
|
tx.Where("realname LIKE ?", fmt.Sprintf("%%%s%%", realname))
|
||||||
}
|
}
|
||||||
if phone != "" {
|
if phone != "" {
|
||||||
tx.Where("phone = ?", phone)
|
tx.Where("phone LIKE ?", fmt.Sprintf("%%%s%%", phone))
|
||||||
}
|
}
|
||||||
if idno != "" {
|
if idno != "" {
|
||||||
tx.Where("idno = ?", idno)
|
tx.Where("idno LIKE ?", fmt.Sprintf("%%%s%%", idno))
|
||||||
}
|
}
|
||||||
var count int64
|
var count int64
|
||||||
tx.Count(&count)
|
tx.Count(&count)
|
||||||
|
|
|
@ -31,7 +31,19 @@ func (s *Staff) Login(ctx *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Staff) Suggest(ctx *gin.Context) {
|
func (s *Staff) Suggest(ctx *gin.Context) {
|
||||||
|
sess := ctx.Keys[session.ContextSession].(*session.AdminSession)
|
||||||
|
staffs, _, err := dao.NewStaffUserDao().Query(1, -1, sess.GetCorpId(), 0, "", "", "", "")
|
||||||
|
session.CheckDBError(err)
|
||||||
|
items := make([]map[string]interface{}, 0)
|
||||||
|
for _, st := range staffs {
|
||||||
|
mp := make(map[string]interface{})
|
||||||
|
mp["userid"] = cast.ToString(st.Id)
|
||||||
|
mp["username"] = cast.ToString(st.Username)
|
||||||
|
mp["realnae"] = cast.ToString(st.Realname)
|
||||||
|
items = append(items, mp)
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.JSON(http.StatusOK, session.NewRsp(items))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Staff) List(ctx *gin.Context) {
|
func (s *Staff) List(ctx *gin.Context) {
|
||||||
|
|
Loading…
Reference in New Issue