liuxiaolong
2019-07-23 00c6fb6a7196832f46bbce513b58bc6d9a3c9fa5
controllers/dbtableperson.go
@@ -49,7 +49,7 @@
func addDbPerson(dbperson *models.Dbtablepersons) (result map[string]interface{}) {
   personId := uuid.NewV4().String() //  以后替代 依据生成规则
   dbperson.Uuid = personId
   dbperson.Id = personId
   dbperson.PriInsert()
   url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
      "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexType + "/" + personId + "?refresh=wait_for"
@@ -77,7 +77,7 @@
func (dbc DbPersonController) UpdateDbPerson(c *gin.Context) {
   var dbperson models.Dbtablepersons
   c.BindJSON(&dbperson)
   personid := dbperson.Uuid
   personid := dbperson.Id
   if personid == "" {
      util.ResponseFormat(c, code.RequestParamError, nil)
      return
@@ -209,7 +209,7 @@
   if tableId == "all" || tableId == "" {
      // / 所有人员
   } else {
      syncTerm = ",{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员
      syncTerm = "{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员
   }
   if contentValue != "" {
      contentParam = ",\"must\":[{\"multi_match\":{\"query\":\"" + contentValue + "\",\"type\":\"best_fields\"," +
@@ -222,8 +222,8 @@
      orderType = "asc"
   }
   params := "{\"query\":{\"bool\":{\"filter\":[" +
      "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}"
   params := "{\"query\":{\"bool\":{\"must_not\":[" +
      "{\"term\":{\"isDelete\":\"1\"}}],\"filter\":[" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}"
   fmt.Print("请求url:%s;\n 请求参数params:%s", url, params)
   data := esutil.GetEsDataReq(url, params, true)
   //c.JSON(200, data)
@@ -280,7 +280,7 @@
   if tableId == "all" || tableId == "" {
      // / 所有人员
   } else {
      syncTerm = ",{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员
      syncTerm = "{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员
   }
   if orderType == "desc" {
      orderType = "desc"
@@ -288,8 +288,10 @@
      orderType = "asc"
   }
   params := "{\"query\":{\"bool\":{\"filter\":[" +
      "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}"
   //params := "{\"query\":{\"bool\":{\"filter\":[" +
   //   "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}"
   params := "{\"query\":{\"bool\":{\"must_not\":[" +
      "{\"term\":{\"isDelete\":\"1\"}}],\"filter\":[" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}"
   fmt.Print("请求url:%s;\n 请求参数params:%s", url, params)
   data := esutil.GetEsDataReq(url, params, true)
   featByte := make([]byte, 0, 1024)