feat:完善项目信息

This commit is contained in:
henry
2022-01-13 18:07:40 +08:00
parent 27cb063a6c
commit 7492c67378
25 changed files with 96 additions and 130 deletions

View File

@ -10,10 +10,9 @@ import (
type Agent struct {
*session.Enterprise
local string
}
type AgentHandle func(session *session.Enterprise, local string) *Agent
type AgentHandle func(session *session.Enterprise) *Agent
type (
// AgentCompany 经纪人公司信息
@ -120,10 +119,9 @@ func (c *Agent) Delete(id uint64) error {
}
func NewAgent() AgentHandle {
return func(session *session.Enterprise, local string) *Agent {
return func(session *session.Enterprise) *Agent {
return &Agent{
Enterprise: session,
local: local,
}
}
}

View File

@ -14,10 +14,9 @@ import (
// Company 公司信息
type Company struct {
*session.Enterprise
local string
}
type CompanyHandle func(session *session.Enterprise, local string) *Company
type CompanyHandle func(session *session.Enterprise) *Company
type (
// CompanyDetail 详细信息
@ -150,10 +149,9 @@ func (c *Company) Match(title string, industrys, keywords []string) ([]*CompanyM
}
func NewCompany() CompanyHandle {
return func(session *session.Enterprise, local string) *Company {
return func(session *session.Enterprise) *Company {
return &Company{
Enterprise: session,
local: local,
}
}
}

View File

@ -11,10 +11,10 @@ import (
// Equipment 设备信息
type Equipment struct {
*session.Enterprise
local string
tenantID uint64
}
type EquipmentHandle func(session *session.Enterprise, local string) *Equipment
type EquipmentHandle func(session *session.Enterprise, tenantID uint64) *Equipment
type (
EquipmentInstance struct {
@ -35,7 +35,7 @@ func (c *Equipment) List(kind int, code, title string, page, pageSize int) (*con
where := []*model2.ModelWhereOrder{
&model2.ModelWhereOrder{
Where: model2.NewWhere("local", c.local),
Where: model2.NewWhere("tenant_id", c.tenantID),
Order: model2.NewOrder("id", model2.OrderModeToDesc),
},
&model2.ModelWhereOrder{
@ -94,7 +94,7 @@ func (c *Equipment) Form(params *EquipmentParams) error {
if mManageEquipment.ID > 0 {
return model2.Updates(mManageEquipment.ManageEquipment, mManageEquipment.ManageEquipment)
}
mManageEquipment.Local.Local = c.local
mManageEquipment.TenantID = c.tenantID
mManageEquipment.UID = c.UID
return model2.Create(mManageEquipment.ManageEquipment)
}
@ -117,10 +117,10 @@ func (c *Equipment) Delete(id uint64) error {
}
func NewEquipment() EquipmentHandle {
return func(session *session.Enterprise, local string) *Equipment {
return func(session *session.Enterprise, tenantID uint64) *Equipment {
return &Equipment{
Enterprise: session,
local: local,
tenantID: tenantID,
}
}
}

View File

@ -14,10 +14,9 @@ import (
type Expert struct {
*session.Enterprise
local string
}
type ExpertHandle func(session *session.Enterprise, local string) *Expert
type ExpertHandle func(session *session.Enterprise) *Expert
type (
// ExpertInfo 专家信息
@ -294,10 +293,9 @@ func (c *Expert) CooperateDetail(id uint64) (*CooperateDetailInfo, error) {
}
func NewExpert() ExpertHandle {
return func(session *session.Enterprise, local string) *Expert {
return func(session *session.Enterprise) *Expert {
return &Expert{
Enterprise: session,
local: local,
}
}
}

View File

@ -12,10 +12,9 @@ import (
type Laboratory struct {
*session.Enterprise
local string
}
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
type LaboratoryHandle func(session *session.Enterprise) *Laboratory
type (
// LaboratoryMatchInfo 实验室匹配信息
@ -194,10 +193,9 @@ func (c *Laboratory) Equipment(id uint64, page, pageSize int) (*controller.Retur
}
func NewLaboratory() LaboratoryHandle {
return func(session *session.Enterprise, local string) *Laboratory {
return func(session *session.Enterprise) *Laboratory {
return &Laboratory{
Enterprise: session,
local: local,
}
}
}

View File

@ -12,10 +12,9 @@ import (
type Research struct {
*session.Enterprise
local string
}
type ResearchHandle func(session *session.Enterprise, local string) *Research
type ResearchHandle func(session *session.Enterprise) *Research
type (
// ResearchLaboratory 科研机构下实验室信息
@ -120,10 +119,9 @@ func (c *Research) Visit(page, pageSize int) (*controller.ReturnPages, error) {
}
func NewResearch() ResearchHandle {
return func(session *session.Enterprise, local string) *Research {
return func(session *session.Enterprise) *Research {
return &Research{
Enterprise: session,
local: local,
}
}
}

View File

@ -14,10 +14,10 @@ import (
// Agent 经纪人入驻信息
type Agent struct {
*session.Enterprise
local string
tenantID uint64
}
type AgentHandle func(session *session.Enterprise, local string) *Agent
type AgentHandle func(session *session.Enterprise, tenantID uint64) *Agent
// Launch 经纪人入驻
func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) error {
@ -27,7 +27,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
mManageAgent := model.NewManageAgent()
// 查询相应的经纪人入驻信息
isExist, err := model2.FirstField(mManageAgent.ManageAgent, []string{"id", "examine_status"},
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local))
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("tenant_id", c.tenantID))
// 用户经纪人入驻信息
mUserAgent := model.NewUserAgent()
@ -49,7 +49,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
}
mManageAgent.ID = 0
}
mManageAgent.Local.Local = c.local
mManageAgent.TenantID = c.tenantID
mManageAgent.Name = params.Name
mManageAgent.Mobile = params.Mobile
mManageAgent.IDCard = other.IDCard
@ -67,7 +67,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
// 删除区域相同身份证经纪人信息
if err = model2.DeleteWhere(mManageAgent.ManageAgent, []*model2.ModelWhere{
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local)}, tx); err != nil {
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
return err
}
if err = model2.Create(mManageAgent.ManageAgent, tx); err != nil {
@ -85,10 +85,10 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
}
func NewAgent() AgentHandle {
return func(session *session.Enterprise, local string) *Agent {
return func(session *session.Enterprise, tenantID uint64) *Agent {
return &Agent{
Enterprise: session,
local: local,
tenantID: tenantID,
}
}
}

View File

@ -15,10 +15,10 @@ import (
// Company 公司企业入驻信息
type Company struct {
*session.Enterprise
local string
tenantID uint64
}
type CompanyHandle func(session *session.Enterprise, local string) *Company
type CompanyHandle func(session *session.Enterprise, tenantID uint64) *Company
type CompanyInfo struct {
ID string `json:"id"`
@ -58,7 +58,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
mManageCompany := model.NewManageCompany()
// 查询相应的企业入驻信息
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "examine_status"},
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
// 过滤用户其他公司入驻信息
mUserCompany := model.NewUserCompany()
@ -80,7 +80,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
}
mManageCompany.ID = 0
}
mManageCompany.Local.Local = c.local
mManageCompany.TenantID = c.tenantID
mManageCompany.InviterID = inviterID
mManageCompany.Kind = model2.ManageCompanyKind(other.Kind)
mManageCompany.Name = params.Name
@ -100,7 +100,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
// 删除区域相同编码公司信息
if err = model2.DeleteWhere(mManageCompany.ManageCompany, []*model2.ModelWhere{
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
return err
}
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
@ -118,10 +118,10 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
}
func NewCompany() CompanyHandle {
return func(session *session.Enterprise, local string) *Company {
return func(session *session.Enterprise, tenantID uint64) *Company {
return &Company{
Enterprise: session,
local: local,
tenantID: tenantID,
}
}
}

View File

@ -15,10 +15,10 @@ import (
// Expert 专家入驻信息
type Expert struct {
*session.Enterprise
local string
tenantID uint64
}
type ExpertHandle func(session *session.Enterprise, local string) *Expert
type ExpertHandle func(session *session.Enterprise, tenantID uint64) *Expert
// Launch 发起入驻
func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) error {
@ -28,7 +28,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
mManageExpert := model.NewManageExpert()
// 查询相应专家入驻信息
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "examine_status"},
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local))
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("tenant_id", c.tenantID))
mUserExpert := model.NewUserExpert()
@ -49,7 +49,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
}
mUserExpert.ID = 0
}
mManageExpert.Local.Local = c.local
mManageExpert.TenantID = c.tenantID
mManageExpert.ResearchID = other.ResearchID
mManageExpert.LaboratoryID = other.LaboratoryID
mManageExpert.Image.Image = params.Image
@ -73,7 +73,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
// 删除区域相同编码公司信息
if err = model2.DeleteWhere(mManageExpert.ManageExpert, []*model2.ModelWhere{
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local)}, tx); err != nil {
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
return err
}
if err = model2.Create(mManageExpert.ManageExpert, tx); err != nil {
@ -91,10 +91,10 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
}
func NewExpert() ExpertHandle {
return func(session *session.Enterprise, local string) *Expert {
return func(session *session.Enterprise, tenantID uint64) *Expert {
return &Expert{
Enterprise: session,
local: local,
tenantID: tenantID,
}
}
}

View File

@ -14,10 +14,10 @@ import (
// Laboratory 实验室入驻信息
type Laboratory struct {
*session.Enterprise
local string
tenantID uint64
}
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
type LaboratoryHandle func(session *session.Enterprise, tenantID uint64) *Laboratory
// Launch 实验室入驻
func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLaboratory) error {
@ -27,7 +27,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
mManageLaboratory := model.NewManageLaboratory()
// 查询相应专家入驻信息
isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "examine_status"},
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
mUserLaboratory := model.NewUserLaboratory()
@ -48,7 +48,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
}
mManageLaboratory.ID = 0
}
mManageLaboratory.Local.Local = c.local
mManageLaboratory.TenantID = c.tenantID
mManageLaboratory.ResearchID = other.ResearchID
mManageLaboratory.Image.Image = params.Image
mManageLaboratory.Name = params.Name
@ -66,7 +66,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
// 删除区域相同编码公司信息
if err = model2.DeleteWhere(mManageLaboratory.ManageLaboratory, []*model2.ModelWhere{
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
return err
}
if err = model2.Create(mManageLaboratory.ManageLaboratory, tx); err != nil {
@ -84,10 +84,10 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
}
func NewLaboratory() LaboratoryHandle {
return func(session *session.Enterprise, local string) *Laboratory {
return func(session *session.Enterprise, tenantID uint64) *Laboratory {
return &Laboratory{
Enterprise: session,
local: local,
tenantID: tenantID,
}
}
}

View File

@ -14,10 +14,10 @@ import (
// Research 研究机构入驻信息
type Research struct {
*session.Enterprise
local string
tenantID uint64
}
type ResearchHandle func(session *session.Enterprise, local string) *Research
type ResearchHandle func(session *session.Enterprise, tenantID uint64) *Research
// Launch 研究机构入驻
func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch) error {
@ -27,7 +27,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
mManageResearch := model.NewManageResearch()
// 查询相应专家入驻信息
isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "examine_status"},
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
mUserResearch := model.NewUserResearch()
@ -48,7 +48,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
}
mManageResearch.ID = 0
}
mManageResearch.Local.Local = c.local
mManageResearch.TenantID = c.tenantID
mManageResearch.Image.Image = params.Image
mManageResearch.Name = params.Name
mManageResearch.Code = params.Code
@ -64,7 +64,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
// 删除区域相同编码公司信息
if err = model2.DeleteWhere(mManageResearch.ManageResearch, []*model2.ModelWhere{
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
return err
}
if err = model2.Create(mManageResearch.ManageResearch, tx); err != nil {
@ -82,10 +82,10 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
}
func NewResearch() ResearchHandle {
return func(session *session.Enterprise, local string) *Research {
return func(session *session.Enterprise, tenantID uint64) *Research {
return &Research{
Enterprise: session,
local: local,
tenantID: tenantID,
}
}
}