diff --git a/src/implement/medium_implement.go b/src/implement/medium_implement.go index 980ae1f..70ea474 100644 --- a/src/implement/medium_implement.go +++ b/src/implement/medium_implement.go @@ -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) } diff --git a/src/super/dao/country_dao.go b/src/super/dao/country_dao.go new file mode 100644 index 0000000..85615f9 --- /dev/null +++ b/src/super/dao/country_dao.go @@ -0,0 +1,5 @@ +package dao + +type CountryDao interface { + FindAll() (list []map[string]interface{}) +} diff --git a/src/super/dao/idcard_type_list_dao.go b/src/super/dao/idcard_type_list_dao.go new file mode 100644 index 0000000..4a24da4 --- /dev/null +++ b/src/super/dao/idcard_type_list_dao.go @@ -0,0 +1,5 @@ +package dao + +type IdcardTypeListDao interface { + FindAll() (list []map[string]interface{}) +} diff --git a/src/super/implement/country_db.go b/src/super/implement/country_db.go new file mode 100644 index 0000000..a469c2d --- /dev/null +++ b/src/super/implement/country_db.go @@ -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 +} diff --git a/src/super/implement/idcard_type_list_db.go b/src/super/implement/idcard_type_list_db.go new file mode 100644 index 0000000..37f92ef --- /dev/null +++ b/src/super/implement/idcard_type_list_db.go @@ -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 +} diff --git a/src/super/model/agent_list.go b/src/super/model/agent_list.go index 6a7b303..8c86ddb 100644 --- a/src/super/model/agent_list.go +++ b/src/super/model/agent_list.go @@ -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)"` diff --git a/src/super/model/country.go b/src/super/model/country.go new file mode 100644 index 0000000..338881e --- /dev/null +++ b/src/super/model/country.go @@ -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)"` +} diff --git a/src/super/model/idcard_type_list.go b/src/super/model/idcard_type_list.go new file mode 100644 index 0000000..6ded2f5 --- /dev/null +++ b/src/super/model/idcard_type_list.go @@ -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)"` +} diff --git a/src/super/model/medium_list.go b/src/super/model/medium_list.go index 8b59767..d1bf32a 100644 --- a/src/super/model/medium_list.go +++ b/src/super/model/medium_list.go @@ -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)"`