fix
wangpengfei
2023-08-09 1041c15ba9f55e1be4078fc24cef9acfbc0a4326
fix

add preload in searching client
6个文件已修改
298 ■■■■ 已修改文件
constvar/const.go 256 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/client.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/assign.go 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/const.go
@@ -1,128 +1,128 @@
package constvar
type UserStatus int
const (
    UserBan UserStatus = iota
    UserAlive
    UserExamineIng
)
type DeviceStatus int
const (
    DeviceAll DeviceStatus = iota + 1
    DeviceAlive
    DeviceOffline
)
type ClusterStatus int
const (
    ClusterAll ClusterStatus = iota + 1
    ClusterAlive
    ClusterOffline
)
type UserType int
const (
    UserTypeSuper   UserType = iota + 1 // 超级管理员
    UserTypePrimary                     // 主账户
    UserTypeSub                         // 子账户
)
type SalesStatus int
const (
    SalesStatusFail                          SalesStatus = -1   // 失败
    SalesStatusNew                           SalesStatus = iota // 新建
    SalesStatusIng                                              // 进行中
    SalesStatusSuccess                                          // 成功
    SalesStatusLevelUptoClient                                  // 升级为客户
    SalesStatusLevelUptoClientAndSalesChance                    // 升级为客户并且有销售机会
)
type CurrencyType int
const (
    CurrencyTypeCNY CurrencyType = iota + 1 // 人民币
    CurrencyTypeUSD                         // 美元
    CurrencyTypeEUR                         // 欧元
    CurrencyTypeGBP                         // 英镑
)
type MenuType string
const (
    MenuTypeClient MenuType = "client"
)
type VettingType int
const (
    VettingTypeClient VettingType = iota + 1
    VettingTypeSales
    VettingTypeSalesChance
    VettingTypeSalesChanceFollow
)
type ServiceContractQueryClass string
const (
    ServiceContractQueryClassExpireAfter30Day   ServiceContractQueryClass = "30天后过期"
    ServiceContractQueryClassExpireAfter60Day   ServiceContractQueryClass = "60天后过期"
    ServiceContractQueryClassExpiredBefore15Day ServiceContractQueryClass = "已过期15天"
    ServiceContractQueryClassExpiredBefore60Day ServiceContractQueryClass = "已过期60天"
)
type ServiceContractKeywordType string
const (
    ServiceContractKeywordContractNo        ServiceContractKeywordType = "服务合同编号"
    ServiceContractKeywordCustomerName      ServiceContractKeywordType = "客户名称"
    ServiceContractKeywordContractDate      ServiceContractKeywordType = "签约日期"
    ServiceContractKeywordContractType      ServiceContractKeywordType = "合同类型"
    ServiceContractKeywordContractStatus    ServiceContractKeywordType = "合同状态"
    ServiceContractKeywordPrincipal         ServiceContractKeywordType = "负责人"
    ServiceContractKeywordProductName       ServiceContractKeywordType = "产品名称"
    ServiceContractKeywordServiceBeginDate  ServiceContractKeywordType = "服务开始日"
    ServiceContractKeywordServiceEndDate    ServiceContractKeywordType = "服务到期日"
    ServiceContractKeywordServiceTotalPrice ServiceContractKeywordType = "价税合计"
)
type ServiceFollowupKeywordType string
const (
    ServiceFollowupKeywordFollowupNo         ServiceFollowupKeywordType = "回访单编号"
    ServiceFollowupKeywordCustomerName       ServiceFollowupKeywordType = "客户名称"
    ServiceFollowupKeywordContactName        ServiceFollowupKeywordType = "联系人姓名"
    ServiceFollowupKeywordCustomerServiceNo  ServiceFollowupKeywordType = "客户服务单"
    ServiceFollowupKeywordVisitor            ServiceFollowupKeywordType = "回访人"
    ServiceFollowupKeywordSatisfactionDegree ServiceFollowupKeywordType = "满意度"
)
type ServiceFeeQueryClass string
const (
    ServiceFeeQueryClassExpireLessThen60Days ServiceFeeQueryClass = "过期未满60天"
    ServiceFeeQueryClassExpireLessThen30Days ServiceFeeQueryClass = "过期未满30天"
    ServiceFeeQueryClassExpireAboutTo60Day   ServiceFeeQueryClass = "即将过期60天"
    ServiceFeeQueryClassExpireAboutTo30Day   ServiceFeeQueryClass = "即将过期30天"
    ServiceFeeQueryClassExpired              ServiceFeeQueryClass = "已过期"
    ServiceFeeQueryClassNoService            ServiceFeeQueryClass = "无服务"
)
type ServiceFeeKeywordType string
const (
    ServiceFeeKeywordCustomerName   ServiceFeeKeywordType = "客户名称"
    ServiceFeeKeywordCustomerType   ServiceFeeKeywordType = "客户类型"
    ServiceFeeKeywordSalesPrincipal ServiceFeeKeywordType = "销售负责人"
    ServiceFeeKeywordCustomerScale  ServiceFeeKeywordType = "客户规模"
    ServiceFeeKeywordClientLevel    ServiceFeeKeywordType = "重要级别"
    ServiceFeeKeywordCustomerNo     ServiceFeeKeywordType = "客户编号"
    ServiceFeeKeywordCustomerStatus ServiceFeeKeywordType = "客户状态"
    ServiceFeeKeywordProductName    ServiceFeeKeywordType = "产品名称"
    ServiceFeeKeywordServiceEndDate ServiceFeeKeywordType = "服务到期日"
)
package constvar
type UserStatus int
const (
    UserBan UserStatus = iota
    UserAlive
    UserExamineIng
)
type DeviceStatus int
const (
    DeviceAll DeviceStatus = iota + 1
    DeviceAlive
    DeviceOffline
)
type ClusterStatus int
const (
    ClusterAll ClusterStatus = iota + 1
    ClusterAlive
    ClusterOffline
)
type UserType int
const (
    UserTypeSuper   UserType = iota + 1 // 超级管理员
    UserTypePrimary                     // 主账户
    UserTypeSub                         // 子账户
)
type SalesStatus int
const (
    SalesStatusNew                           SalesStatus = iota // 新建
    SalesStatusIng                                              // 进行中
    SalesStatusSuccess                                          // 成功
    SalesStatusLevelUptoClient                                  // 升级为客户
    SalesStatusLevelUptoClientAndSalesChance                    // 升级为客户并且有销售机会
    SalesStatusFail                          SalesStatus = -1   // 失败
)
type CurrencyType int
const (
    CurrencyTypeCNY CurrencyType = iota + 1 // 人民币
    CurrencyTypeUSD                         // 美元
    CurrencyTypeEUR                         // 欧元
    CurrencyTypeGBP                         // 英镑
)
type MenuType string
const (
    MenuTypeClient MenuType = "client"
)
type VettingType int
const (
    VettingTypeClient VettingType = iota + 1
    VettingTypeSales
    VettingTypeSalesChance
    VettingTypeSalesChanceFollow
)
type ServiceContractQueryClass string
const (
    ServiceContractQueryClassExpireAfter30Day   ServiceContractQueryClass = "30天后过期"
    ServiceContractQueryClassExpireAfter60Day   ServiceContractQueryClass = "60天后过期"
    ServiceContractQueryClassExpiredBefore15Day ServiceContractQueryClass = "已过期15天"
    ServiceContractQueryClassExpiredBefore60Day ServiceContractQueryClass = "已过期60天"
)
type ServiceContractKeywordType string
const (
    ServiceContractKeywordContractNo        ServiceContractKeywordType = "服务合同编号"
    ServiceContractKeywordCustomerName      ServiceContractKeywordType = "客户名称"
    ServiceContractKeywordContractDate      ServiceContractKeywordType = "签约日期"
    ServiceContractKeywordContractType      ServiceContractKeywordType = "合同类型"
    ServiceContractKeywordContractStatus    ServiceContractKeywordType = "合同状态"
    ServiceContractKeywordPrincipal         ServiceContractKeywordType = "负责人"
    ServiceContractKeywordProductName       ServiceContractKeywordType = "产品名称"
    ServiceContractKeywordServiceBeginDate  ServiceContractKeywordType = "服务开始日"
    ServiceContractKeywordServiceEndDate    ServiceContractKeywordType = "服务到期日"
    ServiceContractKeywordServiceTotalPrice ServiceContractKeywordType = "价税合计"
)
type ServiceFollowupKeywordType string
const (
    ServiceFollowupKeywordFollowupNo         ServiceFollowupKeywordType = "回访单编号"
    ServiceFollowupKeywordCustomerName       ServiceFollowupKeywordType = "客户名称"
    ServiceFollowupKeywordContactName        ServiceFollowupKeywordType = "联系人姓名"
    ServiceFollowupKeywordCustomerServiceNo  ServiceFollowupKeywordType = "客户服务单"
    ServiceFollowupKeywordVisitor            ServiceFollowupKeywordType = "回访人"
    ServiceFollowupKeywordSatisfactionDegree ServiceFollowupKeywordType = "满意度"
)
type ServiceFeeQueryClass string
const (
    ServiceFeeQueryClassExpireLessThen60Days ServiceFeeQueryClass = "过期未满60天"
    ServiceFeeQueryClassExpireLessThen30Days ServiceFeeQueryClass = "过期未满30天"
    ServiceFeeQueryClassExpireAboutTo60Day   ServiceFeeQueryClass = "即将过期60天"
    ServiceFeeQueryClassExpireAboutTo30Day   ServiceFeeQueryClass = "即将过期30天"
    ServiceFeeQueryClassExpired              ServiceFeeQueryClass = "已过期"
    ServiceFeeQueryClassNoService            ServiceFeeQueryClass = "无服务"
)
type ServiceFeeKeywordType string
const (
    ServiceFeeKeywordCustomerName   ServiceFeeKeywordType = "客户名称"
    ServiceFeeKeywordCustomerType   ServiceFeeKeywordType = "客户类型"
    ServiceFeeKeywordSalesPrincipal ServiceFeeKeywordType = "销售负责人"
    ServiceFeeKeywordCustomerScale  ServiceFeeKeywordType = "客户规模"
    ServiceFeeKeywordClientLevel    ServiceFeeKeywordType = "重要级别"
    ServiceFeeKeywordCustomerNo     ServiceFeeKeywordType = "客户编号"
    ServiceFeeKeywordCustomerStatus ServiceFeeKeywordType = "客户状态"
    ServiceFeeKeywordProductName    ServiceFeeKeywordType = "产品名称"
    ServiceFeeKeywordServiceEndDate ServiceFeeKeywordType = "服务到期日"
)
docs/docs.go
@@ -9659,12 +9659,12 @@
        "constvar.SalesStatus": {
            "type": "integer",
            "enum": [
                -1,
                0,
                1,
                2,
                3,
                4,
                5
                -1
            ],
            "x-enum-comments": {
                "SalesStatusFail": "失败",
@@ -9675,12 +9675,12 @@
                "SalesStatusSuccess": "成功"
            },
            "x-enum-varnames": [
                "SalesStatusFail",
                "SalesStatusNew",
                "SalesStatusIng",
                "SalesStatusSuccess",
                "SalesStatusLevelUptoClient",
                "SalesStatusLevelUptoClientAndSalesChance"
                "SalesStatusLevelUptoClientAndSalesChance",
                "SalesStatusFail"
            ]
        },
        "constvar.ServiceContractKeywordType": {
@@ -13346,6 +13346,7 @@
                    "type": "integer"
                },
                "type": {
                    "description": "类型: client: 客户; salesLead: 销售线索; contact: 联系人; followRecord: 跟进记录",
                    "type": "string"
                }
            }
docs/swagger.json
@@ -9647,12 +9647,12 @@
        "constvar.SalesStatus": {
            "type": "integer",
            "enum": [
                -1,
                0,
                1,
                2,
                3,
                4,
                5
                -1
            ],
            "x-enum-comments": {
                "SalesStatusFail": "失败",
@@ -9663,12 +9663,12 @@
                "SalesStatusSuccess": "成功"
            },
            "x-enum-varnames": [
                "SalesStatusFail",
                "SalesStatusNew",
                "SalesStatusIng",
                "SalesStatusSuccess",
                "SalesStatusLevelUptoClient",
                "SalesStatusLevelUptoClientAndSalesChance"
                "SalesStatusLevelUptoClientAndSalesChance",
                "SalesStatusFail"
            ]
        },
        "constvar.ServiceContractKeywordType": {
@@ -13334,6 +13334,7 @@
                    "type": "integer"
                },
                "type": {
                    "description": "类型: client: 客户; salesLead: 销售线索; contact: 联系人; followRecord: 跟进记录",
                    "type": "string"
                }
            }
docs/swagger.yaml
@@ -116,12 +116,12 @@
    - ReceiptQueryClassExpireLessThen60Days
  constvar.SalesStatus:
    enum:
    - -1
    - 0
    - 1
    - 2
    - 3
    - 4
    - 5
    - -1
    type: integer
    x-enum-comments:
      SalesStatusFail: 失败
@@ -131,12 +131,12 @@
      SalesStatusNew: 新建
      SalesStatusSuccess: 成功
    x-enum-varnames:
    - SalesStatusFail
    - SalesStatusNew
    - SalesStatusIng
    - SalesStatusSuccess
    - SalesStatusLevelUptoClient
    - SalesStatusLevelUptoClientAndSalesChance
    - SalesStatusFail
  constvar.ServiceContractKeywordType:
    enum:
    - 服务合同编号
@@ -2614,6 +2614,8 @@
      member_id:
        type: integer
      type:
        description: '类型: client: 客户; salesLead: 销售线索; contact: 联系人; followRecord:
          跟进记录'
        type: string
    type: object
  request.CasbinInfo:
model/client.go
@@ -174,7 +174,7 @@
        db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
    }
    err := db.Preload("ClientStatus").Preload("ClientType").Preload("ClientOrigin").Preload("ClientLevel").Preload("FollowRecord").Preload("EnterpriseNature").Preload("RegisteredCapital").Preload("Industry").Preload("EnterpriseScale").Preload("Contacts").Preload("Country").Preload("Province").Preload("City").Preload("Region").Find(&records).Error
    err := db.Preload("Member").Preload("ClientStatus").Preload("ClientType").Preload("ClientOrigin").Preload("ClientLevel").Preload("FollowRecord").Preload("EnterpriseNature").Preload("RegisteredCapital").Preload("Industry").Preload("EnterpriseScale").Preload("Contacts").Preload("Country").Preload("Province").Preload("City").Preload("Region").Find(&records).Error
    return records, total, err
}
model/request/assign.go
@@ -1,7 +1,7 @@
package request
type Assign struct {
    MemberId int    `json:"member_id"`
    Type     string `json:"type"`
    Ids      []int  `json:"ids"`
}
package request
type Assign struct {
    MemberId int    `json:"member_id"`
    Type     string `json:"type"` // 类型: client: 客户; salesLead: 销售线索; contact: 联系人; followRecord: 跟进记录
    Ids      []int  `json:"ids"`
}