| | |
| | | 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" |
| | |
| | | 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 |
| | |
| | | if tableId == "all" || tableId == "" { |
| | | // / 所有人员 |
| | | } else { |
| | | syncTerm = ",{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员 |
| | | syncTerm = "{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员 |
| | | } |
| | | if contentValue != "" { |
| | | contentParam = ",\"must\":[{\"multi_match\":{\"query\":\"" + contentValue + "\",\"type\":\"best_fields\"," + |
| | |
| | | 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) |
| | |
| | | if tableId == "all" || tableId == "" { |
| | | // / 所有人员 |
| | | } else { |
| | | syncTerm = ",{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员 |
| | | syncTerm = "{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 底库人员 |
| | | } |
| | | if orderType == "desc" { |
| | | orderType = "desc" |
| | |
| | | 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) |