| | |
| | | Name string `json:"name" gorm:"column:name;uniqueIndex:name_isDeleted_idx;type:varchar(255);comment:客户名称"` |
| | | IsDeleted bool `json:"-" gorm:"column:is_deleted;uniqueIndex:name_isDeleted_idx;type:tinyint(1);comment:是否删除"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:客户编号"` |
| | | ClientStatusId int `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:客户状态ID"` |
| | | ClientStatusId int `json:"client_status_id" gorm:"column:client_status_id;type:int(11);default:1;comment:客户状态ID"` |
| | | ClientStatus ClientStatus `json:"client_status" gorm:"foreignKey:ClientStatusId"` |
| | | ClientTypeId int `json:"client_type_id" gorm:"column:client_type_id;type:int(11);default:1;comment:客户类型ID"` |
| | | ClientType ClientType `json:"client_type" gorm:"foreignKey:ClientTypeId"` |
| | |
| | | NextVisitTime *CustomTime `json:"next_visit_time" gorm:"column:next_visit_time;type:datetime;comment:下次回访时间"` |
| | | LatestServiceTime *CustomTime `json:"latest_service_time" gorm:"column:latest_service_time;type:datetime;comment:最晚服务时间"` |
| | | FollowRecord []FollowRecord `json:"follow_record" gorm:"foreignKey:ClientId"` |
| | | CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"` |
| | | Address |
| | | Business |
| | | gormModel |
| | | CrmModel |
| | | } |
| | | |
| | | ClientSearch struct { |
| | |
| | | |
| | | // 查询公海客户 |
| | | if key == "public_sea" { |
| | | db = db.Where("member_id = ?", constvar.UserTypeSuper) |
| | | db = db.Where("clients.member_id = ?", constvar.UserTypeSuper) |
| | | } |
| | | |
| | | if key == "client_status" { |
| | |
| | | db = db.Joins("Member").Where("Member.username LIKE ?", "%"+v+"%") |
| | | } |
| | | |
| | | case int: |
| | | case int64: |
| | | case float64: |
| | | case int, uint, int64, float64: |
| | | if key == "id" || key == "client_type_id" || key == "client_status_id" || key == "member_id" { |
| | | db = db.Where(key+" = ?", v) |
| | | } |
| | | |
| | | if key == "not_admin" { |
| | | if v == float64(constvar.NotAdminYes) { |
| | | db = db.Where("member_id != ?", constvar.UserTypeSuper) |
| | | db = db.Where("clients.member_id != ?", constvar.UserTypeSuper) |
| | | } else { |
| | | db = db.Where("member_id = ?", constvar.UserTypeSuper) |
| | | db = db.Where("clients.member_id = ?", constvar.UserTypeSuper) |
| | | } |
| | | } |
| | | |