huangjiajun pirms 4 mēnešiem
vecāks
revīzija
a5856c1cfe
9 mainītis faili ar 159 papildinājumiem un 4 dzēšanām
  1. +2
    -2
      src/implement/medium_implement.go
  2. +5
    -0
      src/super/dao/country_dao.go
  3. +5
    -0
      src/super/dao/idcard_type_list_dao.go
  4. +72
    -0
      src/super/implement/country_db.go
  5. +49
    -0
      src/super/implement/idcard_type_list_db.go
  6. +3
    -1
      src/super/model/agent_list.go
  7. +10
    -0
      src/super/model/country.go
  8. +10
    -0
      src/super/model/idcard_type_list.go
  9. +3
    -1
      src/super/model/medium_list.go

+ 2
- 2
src/implement/medium_implement.go Parādīt failu

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/dao"
@@ -81,7 +81,7 @@ func (m MediumDb) FindAdmin(username string, state, page, limit int) (list []mod

func (m MediumDb) GetMedium(id int) (mm *model.Medium, err error) {
mm = new(model.Medium)
has, err := m.Db.Where("id =?", id).Get(m)
has, err := m.Db.Where("id =?", id).Get(mm)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}


+ 5
- 0
src/super/dao/country_dao.go Parādīt failu

@@ -0,0 +1,5 @@
package dao

type CountryDao interface {
FindAll() (list []map[string]interface{})
}

+ 5
- 0
src/super/dao/idcard_type_list_dao.go Parādīt failu

@@ -0,0 +1,5 @@
package dao

type IdcardTypeListDao interface {
FindAll() (list []map[string]interface{})
}

+ 72
- 0
src/super/implement/country_db.go Parādīt failu

@@ -0,0 +1,72 @@
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_utils "code.fnuoos.com/zhimeng/model.git/utils"
"xorm.io/xorm"
)

func NewCountryDb(engine *xorm.Engine) dao.CountryDao {
return &CountryDb{Db: engine}
}

type CountryDb struct {
Db *xorm.Engine
}

func (c CountryDb) FindAll() (list []map[string]interface{}) {
var data []model.Country
c.Db.Find(&data)
list = make([]map[string]interface{}, 0)
top := make([]map[string]interface{}, 0)
first := make(map[int][]map[string]interface{})
second := make(map[int][]map[string]interface{})
third := make(map[int][]map[string]interface{})
for _, v := range data {
tmp := map[string]interface{}{
"id": zhios_order_relate_utils.IntToStr(v.Id),
"name": v.Name,
"child": make([]map[string]interface{}, 0),
}
if v.Level == 0 {
top = append(top, tmp)
}
if v.Level == 1 {
_, ok := first[v.Pid]
if ok == false {
first[v.Pid] = make([]map[string]interface{}, 0)
}
first[v.Pid] = append(first[v.Pid], tmp)
}
if v.Level == 2 {
_, ok := second[v.Pid]
if ok == false {
second[v.Pid] = make([]map[string]interface{}, 0)
}
second[v.Pid] = append(second[v.Pid], tmp)
}
}
for k, v := range second {
for k1, v1 := range v {
id := zhios_order_relate_utils.StrToInt(zhios_order_relate_utils.AnyToString(v1["id"]))
v[k1]["child"] = third[id]
}
second[k] = v
}
for k, v := range first {
for k1, v1 := range v {
id := zhios_order_relate_utils.StrToInt(zhios_order_relate_utils.AnyToString(v1["id"]))
v[k1]["child"] = second[id]
}
first[k] = v
}
for k, v := range top {
id := zhios_order_relate_utils.StrToInt(zhios_order_relate_utils.AnyToString(v["id"]))
top[k]["child"] = first[id]
}
if len(top) > 0 {
list = top
}
return
}

+ 49
- 0
src/super/implement/idcard_type_list_db.go Parādīt failu

@@ -0,0 +1,49 @@
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_utils "code.fnuoos.com/zhimeng/model.git/utils"
"xorm.io/xorm"
)

func NewIdcardTypeListDb(engine *xorm.Engine) dao.IdcardTypeListDao {
return &IdcardTypeListDb{Db: engine}
}

type IdcardTypeListDb struct {
Db *xorm.Engine
}

func (i IdcardTypeListDb) FindAll() (list []map[string]interface{}) {
var data []model.IdcardTypeList
i.Db.Find(&data)
list = make([]map[string]interface{}, 0)
top := make([]map[string]interface{}, 0)
first := make(map[int][]map[string]interface{})
for _, v := range data {
tmp := map[string]interface{}{
"id": zhios_order_relate_utils.IntToStr(v.Id),
"name": v.Name,
"child": make([]map[string]interface{}, 0),
}
if v.Level == 0 {
top = append(top, tmp)
}
if v.Level == 1 {
_, ok := first[v.Pid]
if ok == false {
first[v.Pid] = make([]map[string]interface{}, 0)
}
first[v.Pid] = append(first[v.Pid], tmp)
}
}
for k, v := range top {
id := zhios_order_relate_utils.StrToInt(zhios_order_relate_utils.AnyToString(v["id"]))
top[k]["child"] = first[id]
}
if len(top) > 0 {
list = top
}
return
}

+ 3
- 1
src/super/model/agent_list.go Parādīt failu

@@ -8,11 +8,13 @@ type AgentList struct {
CompanyName string `json:"company_name" xorm:"not null default '' comment('公司名称') VARCHAR(255)"`
CompanyAbbreviation string `json:"company_abbreviation" xorm:"not null default '' comment('公司简称') VARCHAR(255)"`
UnifiedSocialCreditCode string `json:"unified_social_credit_code" xorm:"not null default '' comment('统一社会信用代码') VARCHAR(255)"`
CertificateType int `json:"certificate_type" xorm:"not null default 1 comment('证件类型') TINYINT(1)"`
CertificateType int `json:"certificate_type" xorm:"not null default 1 comment('证件类型 2级类目id') TINYINT(1)"`
CertificateFirstType int `json:"certificate_first_type" xorm:"not null default 1 comment('证件类型 1级类目id') TINYINT(1)"`
BusinessLicenseImgUrl string `json:"business_license_img_url" xorm:"not null default '' comment('营业执照照片') VARCHAR(255)"`
LegalRepresentative string `json:"legal_representative" xorm:"not null default '' comment('法定代表人') CHAR(50)"`
CountryRegionId int `json:"country_region_id" xorm:"not null default 1 comment('国家地区id') TINYINT(3)"`
CountryRegion string `json:"country_region" xorm:"not null default '' comment('国家地区') CHAR(50)"`
RegisteredAddressCountryId int `json:"registered_address_country_id" xorm:"not null default 0 comment('注册地址-国家id') INT(11)"`
RegisteredAddressProvinceId int `json:"registered_address_province_id" xorm:"not null default 0 comment('注册地址-省份id') INT(11)"`
RegisteredAddressCityId int `json:"registered_address_city_id" xorm:"not null default 0 comment('注册地址-市id') INT(11)"`
RegisteredAddressCountyId int `json:"registered_address_county_id" xorm:"not null default 0 comment('注册地址-县/区id') INT(11)"`


+ 10
- 0
src/super/model/country.go Parādīt failu

@@ -0,0 +1,10 @@
package model

type Country struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"VARCHAR(255)"`
Sort int `json:"sort" xorm:"default 0 INT(11)"`
IsShow int `json:"is_show" xorm:"default 0 INT(11)"`
Pid int `json:"pid" xorm:"default 0 INT(11)"`
Level int `json:"level" xorm:"default 0 INT(11)"`
}

+ 10
- 0
src/super/model/idcard_type_list.go Parādīt failu

@@ -0,0 +1,10 @@
package model

type IdcardTypeList struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"VARCHAR(255)"`
Sort int `json:"sort" xorm:"default 0 INT(11)"`
IsShow int `json:"is_show" xorm:"default 0 INT(11)"`
Pid int `json:"pid" xorm:"default 0 INT(11)"`
Level int `json:"level" xorm:"default 0 INT(11)"`
}

+ 3
- 1
src/super/model/medium_list.go Parādīt failu

@@ -8,11 +8,13 @@ type MediumList struct {
CompanyName string `json:"company_name" xorm:"not null default '' comment('公司名称') VARCHAR(255)"`
CompanyAbbreviation string `json:"company_abbreviation" xorm:"not null default '' comment('公司简称') VARCHAR(255)"`
UnifiedSocialCreditCode string `json:"unified_social_credit_code" xorm:"not null default '' comment('统一社会信用代码') VARCHAR(255)"`
CertificateType int `json:"certificate_type" xorm:"not null default 1 comment('证件类型') TINYINT(1)"`
CertificateType int `json:"certificate_type" xorm:"not null default 1 comment('证件类型 2级类目id') TINYINT(1)"`
CertificateFirstType int `json:"certificate_first_type" xorm:"not null default 1 comment('证件类型 1级类目id') TINYINT(1)"`
BusinessLicenseImgUrl string `json:"business_license_img_url" xorm:"not null default '' comment('营业执照照片') VARCHAR(255)"`
LegalRepresentative string `json:"legal_representative" xorm:"not null default '' comment('法定代表人') CHAR(50)"`
CountryRegionId int `json:"country_region_id" xorm:"not null default 1 comment('国家地区id') TINYINT(3)"`
CountryRegion string `json:"country_region" xorm:"not null default '' comment('国家地区') CHAR(50)"`
RegisteredAddressCountryId int `json:"registered_address_country_id" xorm:"not null default 0 comment('注册地址-国家id') INT(11)"`
RegisteredAddressProvinceId int `json:"registered_address_province_id" xorm:"not null default 0 comment('注册地址-省份id') INT(11)"`
RegisteredAddressCityId int `json:"registered_address_city_id" xorm:"not null default 0 comment('注册地址-市id') INT(11)"`
RegisteredAddressCountyId int `json:"registered_address_county_id" xorm:"not null default 0 comment('注册地址-县/区id') INT(11)"`


Notiek ielāde…
Atcelt
Saglabāt