|
@@ -12,6 +12,7 @@ import (
|
|
|
"regexp"
|
|
|
. "seplatform/util"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -67,6 +68,8 @@ func (this *Client) PersonnelIndex() {
|
|
|
start, _ := this.GetInt("start")
|
|
|
limit, _ := this.GetInt("length")
|
|
|
draw, _ := this.GetInt("draw")
|
|
|
+ searchStr := this.GetString("search[value]")
|
|
|
+ search := strings.TrimSpace(searchStr)
|
|
|
entUserId := 0
|
|
|
user := this.GetSession("user").(map[string]interface{})
|
|
|
if id == "" {
|
|
@@ -77,7 +80,15 @@ func (this *Client) PersonnelIndex() {
|
|
|
entId := qu.IntAll(user["ent_id"])
|
|
|
count := Mgo.Count("entniche_rule", map[string]interface{}{"entId": entId, "entUserId": entUserId})
|
|
|
|
|
|
- entRuleArr, ok := Mgo.Find("entniche_rule", map[string]interface{}{"entId": entId, "entUserId": entUserId}, `{"_id":-1}`, nil, false, int(start), int(limit))
|
|
|
+ query := map[string]interface{}{
|
|
|
+ "entId": entId, "entUserId": entUserId,
|
|
|
+ }
|
|
|
+ if search != "" {
|
|
|
+ query["s_name"] = bson.M{
|
|
|
+ "$regex": search,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ entRuleArr, ok := Mgo.Find("entniche_rule", query, `{"_id":-1}`, nil, false, int(start), int(limit))
|
|
|
if ok && entRuleArr != nil && *entRuleArr != nil && len(*entRuleArr) > 0 {
|
|
|
for _, v := range *entRuleArr {
|
|
|
ruleid := mongodb.BsonIdToSId(v["_id"])
|