sunty
2019-07-02 c4ab4a96dfdd097d0faedd14f10b93b18786101d
update dbtable and dbtablepersons
update taglist
add ageDecription taskName alarmLevel conditions into inputvalue
6个文件已修改
48 ■■■■ 已修改文件
controllers/dbtableperson.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dbtablesCon.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/esSearch.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/taglist.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/dbtables.go 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/model.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dbtableperson.go
@@ -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\"}}],\"must_not\":[" + 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)
controllers/dbtablesCon.go
@@ -66,7 +66,7 @@
func (dbt DbTableController) UpdateDbTables(c *gin.Context) {
    dbtable := new(models.Dbtables)
    c.BindJSON(&dbtable)
    uuid := c.Params.ByName("uuid")
    uuid := c.Params.ByName("id")
    if uuid == "" {
        uuid = dbtable.Id
        fmt.Println("body中获取底库id")
@@ -139,7 +139,7 @@
// @Failure 500 {string} json "{"code":500,  msg:"返回错误信息", success:false}"
// @Router /data/api-v/dbtable/deleteDBtablesById/{uuid} [POST]
func (dbt DbTableController) DeleteDbTables(c *gin.Context) {
    uuid := c.Params.ByName("uuid")
    uuid := c.Params.ByName("id")
    url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
        "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + uuid + "/_update"
    params := "{\"doc\":{\"isDelete\":\"1\"}}"
controllers/esSearch.go
@@ -46,7 +46,7 @@
    queryBody := searchBody["inputValue"].(string)
    //检索框
    if queryBody != "" {
        queryStr = "\"must\":[{\"multi_match\":{\"query\":\"" + queryBody + "\",\"fields\":[\"tableName^1.5\",\"sex^2.0\",\"race^2.0\",\"content^1.0\",\"idCard^1.8\",\"cameraAddr^1.0\"]," +
        queryStr = "\"must\":[{\"multi_match\":{\"query\":\"" + queryBody + "\",\"fields\":[\"alarmRules.alarmLevel^1.5\",\"ageDescription^1.5\",\"taskName^1.5\",\"tableName^1.5\",\"sex^2.0\",\"race^2.0\",\"content^1.0\",\"idCard^1.8\",\"cameraAddr^1.0\"]," +
            "\"type\":\"cross_fields\",\"operator\":\"OR\",\"slop\":0,\"prefix_length\":0,\"max_expansions\":50,\"zero_terms_query\":\"NONE\",\"auto_generate_synonyms_phrase_query\":true,\"fuzzy_transpositions\":true,\"boost\":1}}],"
    }
    gteDate := searchBody["searchTime"].([]interface{})[0].(string)
controllers/taglist.go
@@ -32,9 +32,9 @@
    fmt.Println(tokenRes["datalist"].([]interface{}))
    for _, value := range tokenRes["datalist"].([]interface{}) {
        tokenRes := make(map[string]interface{})
        tokenRes["key"] = value.(map[string]interface{})["uuid"].(string)
        tokenRes["key"] = value.(map[string]interface{})["id"].(string)
        tokenRes["title"] = value.(map[string]interface{})["tableName"].(string)
        tokenRes["value"] = value.(map[string]interface{})["uuid"].(string)
        tokenRes["value"] = value.(map[string]interface{})["id"].(string)
        sources = append(sources, tokenRes)
    }
    util.ResponseFormat(c, code.Success, sources)
models/dbtables.go
@@ -2,14 +2,14 @@
type Dbtables struct {
    BaseEntity
    TableName string `json:"tableName,omitempty" example:"底库123"`               //表名
    TableDesc string `json:"tableDesc,omitempty" example:"底库描述"`                //描述
    TableType string `json:"tableType,omitempty" example:"person,car"`          //人员表"person
    BwType    string `json:"bwType,omitempty" example:"黑名单:1,白名单:0"`            //黑名单:1,白名单:0
    StartTime string `json:"startTime,omitempty" example:"2019-01-12 12:14:56"` //有效期开始时间
    EndTime   string `json:"endTime,omitempty" example:"2019-10-12 12:14:56"`   //有效期结束时间
    IsSync        string `json:"isSync,omitempty" example:"1:同步库,2:本地库"`                      //是否是同步库(1:同步库,2:本地库)
    AnalyServerId string `json:"analyServerId,omitempty" example:"本地库所属的分析设备id,如果是同步库就不需要记录"` // 分析设备id(本地库所属的分析设备id,如果是同步库就不需要记录)
    TableName     string `json:"tableName" example:"底库123"`                         //表名
    TableDesc     string `json:"tableDesc" example:"底库描述"`                          //描述
    TableType     string `json:"tableType" example:"person,car"`                    //人员表"person
    BwType        string `json:"bwType" example:"黑名单:1,白名单:0"`                      //黑名单:1,白名单:0
    StartTime     string `json:"startTime,omitempty" example:"2019-01-12 12:14:56"` //有效期开始时间
    EndTime       string `json:"endTime,omitempty" example:"2019-10-12 12:14:56"`   //有效期结束时间
    IsSync        string `json:"isSync" example:"1:同步库,2:本地库"`                      //是否是同步库(1:同步库,2:本地库)
    AnalyServerId string `json:"analyServerId" example:"本地库所属的分析设备id,如果是同步库就不需要记录"` // 分析设备id(本地库所属的分析设备id,如果是同步库就不需要记录)
}
//UploadFlag string `json:"uploadFlag,omitempty" example:"上传标志"` //
models/model.go
@@ -2,21 +2,20 @@
import "time"
type BaseEntity struct {
    Id        string `gorm:"primary_key" json:"id" example:"XeW0HmoBevddG23Ild5o"`
    Id         string `gorm:"primary_key" json:"id" example:"XeW0HmoBevddG23Ild5o"`
    CreateTime string `json:"createTime,omitempty" example:""`
    UpdateTime string `json:"updateTime,omitempty" example:""`
    CreateBy   string `json:"createBy,omitempty" example:""`
    IsDelete   bool `json:"isDelete,omitempty" example:"0 未删除 1已删除"`
    Enable     bool `json:"enable,omitempty" example:"0 生效 1未生效"`
    CreateBy   string `json:"createBy" example:""`
    IsDelete   int    `json:"isDelete" example:"0 未删除 1已删除"`
    Enable     int    `json:"enable" example:" 1生效 0未生效"`
}
func (dp *BaseEntity) PriInsert() {
    dp.CreateTime = time.Now().Format("2006-01-02 15:04:05")
    dp.CreateBy = "admin"
    dp.IsDelete = false
    dp.Enable = false
    dp.IsDelete = 0
    dp.Enable = 1
}
func (dp *BaseEntity) PriUpdate() {
@@ -59,7 +58,7 @@
type CameraArea struct {
    Cameraid string `json:"cameraId"`
    Areaid int `json:"areaId"`
    Areaid   int    `json:"areaId"`
}
type Sdk struct {
@@ -72,7 +71,7 @@
//算法参数定义
type SdkArg struct {
    Alias   string `json:"alias"`   //参数的别名
    Alias string `json:"alias"` //参数的别名
    Name  string `json:"name"`  //参数名称
    Type  string `json:"type"`  //参数类型(整数,字符串或数组)
    Must  bool   `json:"must"`  //是否必填
@@ -137,4 +136,3 @@
    X string `json:"x"`
    Y string `json:"y"`
}