From 851a2c1784da8959bb743ba2683353de05489c51 Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 3 Dec 2021 14:18:06 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=AE=8C=E5=96=84=E5=85=A5?= =?UTF-8?q?=E9=A9=BB=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enterprise/controller/settled/agent.go | 2 +- .../enterprise/controller/settled/company.go | 2 +- .../enterprise/controller/settled/expert.go | 2 +- .../controller/settled/laboratory.go | 2 +- .../enterprise/controller/settled/research.go | 2 +- app/api/enterprise/model/manage_company.go | 2 +- app/common/model/activity_apply.go | 2 +- app/common/model/activity_instance.go | 4 ++-- app/common/model/common.go | 16 ++++++------- app/common/model/manage_agent.go | 16 ++++++------- app/common/model/manage_company.go | 10 ++++---- app/common/model/manage_equipment.go | 10 ++++---- app/common/model/manage_expert.go | 20 ++++++++-------- app/common/model/manage_laboratory.go | 14 +++++------ app/common/model/manage_research.go | 12 +++++----- app/common/model/model.go | 10 +++----- app/common/model/service_demand.go | 10 ++++---- app/common/model/sys_auth.go | 6 ++--- app/common/model/sys_auth_rule.go | 14 +++++------ app/common/model/sys_config.go | 6 ++--- app/common/model/sys_department.go | 8 +++---- app/common/model/sys_identity.go | 2 +- app/common/model/sys_industry.go | 4 ++-- app/common/model/sys_log.go | 8 +++---- app/common/model/sys_menu.go | 10 ++++---- app/common/model/sys_patent.go | 24 +++++++++---------- app/common/model/sys_research.go | 4 ++-- app/common/model/sys_role.go | 4 ++-- app/common/model/sys_tenant.go | 14 +++++------ app/common/model/sys_user.go | 16 ++++++------- app/common/model/sys_user_login_log.go | 4 ++-- app/common/model/sys_user_tenant.go | 4 ++-- app/common/model/technology_demand.go | 10 ++++---- app/common/model/technology_instance.go | 12 +++++----- app/common/model/technology_paper.go | 12 +++++----- app/common/model/technology_prodcut.go | 12 +++++----- app/common/model/technology_project.go | 8 +++---- app/common/model/technology_topic.go | 10 ++++---- app/common/model/user_bank.go | 8 +++---- app/common/model/user_consume.go | 8 +++---- app/common/model/user_cooperate_enterprise.go | 12 +++++----- app/common/model/user_identity.go | 10 ++++---- app/common/model/user_instance.go | 10 ++++---- router/auth.go | 6 +++++ 44 files changed, 192 insertions(+), 190 deletions(-) diff --git a/app/api/enterprise/controller/settled/agent.go b/app/api/enterprise/controller/settled/agent.go index 73817bb..c2a51f9 100644 --- a/app/api/enterprise/controller/settled/agent.go +++ b/app/api/enterprise/controller/settled/agent.go @@ -26,7 +26,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro } mManageAgent := model.NewManageAgent() // 查询相应的经纪人入驻信息 - isExist, err := model2.FirstField(mManageAgent.ManageAgent, []string{"id", "status"}, + isExist, err := model2.FirstField(mManageAgent.ManageAgent, []string{"id", "examine_status"}, model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local)) // 用户经纪人入驻信息 diff --git a/app/api/enterprise/controller/settled/company.go b/app/api/enterprise/controller/settled/company.go index eb60a73..d40d36b 100644 --- a/app/api/enterprise/controller/settled/company.go +++ b/app/api/enterprise/controller/settled/company.go @@ -26,7 +26,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id } mManageCompany := model.NewManageCompany() // 查询相应的企业入驻信息 - isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "status"}, + isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "examine_status"}, model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)) // 过滤用户其他公司入驻信息 diff --git a/app/api/enterprise/controller/settled/expert.go b/app/api/enterprise/controller/settled/expert.go index 3813c5a..aa66825 100644 --- a/app/api/enterprise/controller/settled/expert.go +++ b/app/api/enterprise/controller/settled/expert.go @@ -27,7 +27,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er } mManageExpert := model.NewManageExpert() // 查询相应专家入驻信息 - isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "status"}, + isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "examine_status"}, model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local)) mUserExpert := model.NewUserExpert() diff --git a/app/api/enterprise/controller/settled/laboratory.go b/app/api/enterprise/controller/settled/laboratory.go index 8e5baa0..ae88e72 100644 --- a/app/api/enterprise/controller/settled/laboratory.go +++ b/app/api/enterprise/controller/settled/laboratory.go @@ -26,7 +26,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora } mManageLaboratory := model.NewManageLaboratory() // 查询相应专家入驻信息 - isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "status"}, + isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "examine_status"}, model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)) mUserLaboratory := model.NewUserLaboratory() diff --git a/app/api/enterprise/controller/settled/research.go b/app/api/enterprise/controller/settled/research.go index d89fa0c..00f6627 100644 --- a/app/api/enterprise/controller/settled/research.go +++ b/app/api/enterprise/controller/settled/research.go @@ -26,7 +26,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch } mManageResearch := model.NewManageResearch() // 查询相应专家入驻信息 - isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "status"}, + isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "examine_status"}, model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)) mUserResearch := model.NewUserResearch() diff --git a/app/api/enterprise/model/manage_company.go b/app/api/enterprise/model/manage_company.go index d3f8df1..34ce79e 100644 --- a/app/api/enterprise/model/manage_company.go +++ b/app/api/enterprise/model/manage_company.go @@ -7,5 +7,5 @@ type ManageCompany struct { } func NewManageCompany() *ManageCompany { - return &ManageCompany{} + return &ManageCompany{model.NewManageCompany()} } diff --git a/app/common/model/activity_apply.go b/app/common/model/activity_apply.go index 604896e..d7aed39 100644 --- a/app/common/model/activity_apply.go +++ b/app/common/model/activity_apply.go @@ -7,7 +7,7 @@ type ActivityApply struct { MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"` Mode ActivityInstanceMode `gorm:"column:mode;type:tinyint(1);default:1;comment:活动模式" json:"mode"` ActivityInstanceBasic - Content string `gorm:"column:title;type:text;default:null;comment:活动详情" json:"content"` + Content string `gorm:"column:title;type:text;default:'';comment:活动详情" json:"content"` MaxNumber int `gorm:"column:max_number;type:int(6);default:0;comment:报名限制人数,0不做限制" json:"max_number"` Status ActivityApplyStatus `gorm:"column:status;type:tinyint(1);default:0;comment:审核状态" json:"status"` ModelDeleted diff --git a/app/common/model/activity_instance.go b/app/common/model/activity_instance.go index 4d59523..ba0e6f0 100644 --- a/app/common/model/activity_instance.go +++ b/app/common/model/activity_instance.go @@ -9,7 +9,7 @@ type ActivityInstance struct { Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份来源" json:"-"` Mode ActivityInstanceMode `gorm:"column:mode;type:tinyint(1);default:1;comment:活动模式" json:"mode"` ActivityInstanceBasic - Content string `gorm:"column:title;type:text;default:null;comment:活动详情" json:"content"` + Content string `gorm:"column:title;type:text;default:'';comment:活动详情" json:"content"` MaxNumber int `gorm:"column:max_number;type:int(6);default:0;comment:报名限制人数,0不做限制" json:"max_number"` Status ActivityInstanceStatus `gorm:"column:status;type:tinyint(1);default:1;comment:活动状态(1:显示,2:隐藏)" json:"status"` ModelDeleted @@ -18,7 +18,7 @@ type ActivityInstance struct { // ActivityInstanceBasic 活动基本信息 type ActivityInstanceBasic struct { - Title string `gorm:"column:title;type:varchar(50);default:null;comment:活动名称" json:"title"` + Title string `gorm:"column:title;type:varchar(50);default:'';comment:活动名称" json:"title"` BeginAt time.Time `gorm:"column:begin_at;type:datetime;not null;comment:活动开始" json:"begin_at"` FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:活动结束时间" json:"finish_at"` JoinDeadline time.Time `gorm:"column:join_deadline;type:datetime;not null;comment:报名截止时间" json:"join_deadline"` diff --git a/app/common/model/common.go b/app/common/model/common.go index 22abcf1..e0336c7 100644 --- a/app/common/model/common.go +++ b/app/common/model/common.go @@ -30,7 +30,7 @@ func (m *Gender) GenderTitle() string { // Image 单一图片信息 type Image struct { - Image string `gorm:"column:image;type:varchar(255);default:null;comment:图片" json:"image"` + Image string `gorm:"column:image;type:varchar(255);default:'';comment:图片" json:"image"` } func (m *Image) Analysis(domain string) string { @@ -39,7 +39,7 @@ func (m *Image) Analysis(domain string) string { // Images 多个图片信息 type Images struct { - Images string `gorm:"column:images;type:text;default:null;comment:图片" json:"images"` + Images string `gorm:"column:images;type:text;default:'';comment:图片" json:"images"` } // AnalysisSlice Slice解析 @@ -54,7 +54,7 @@ func (m *Images) AnalysisSlice(domain string) []string { } type Local struct { - Local string `gorm:"column:local;type:varchar(8);default:null;comment:数据位置来源" json:"-"` + Local string `gorm:"column:local;type:varchar(8);default:'';comment:数据位置来源" json:"-"` } // AccountStatus 账号状态 @@ -89,7 +89,7 @@ const ( // Examine 审核状态 type Examine struct { ExamineStatus ExamineStatusKind `gorm:"column:examine_status;type:tinyint(1);default:0;comment:审核状态(0:审核中,1:审核通过,2:审核拒绝)" json:"examine_status"` - ExamineRemark string `gorm:"column:examine_remark;type:varchar(255);default:null;comment:审核备注" json:"examine_remark"` + ExamineRemark string `gorm:"column:examine_remark;type:varchar(255);default:'';comment:审核备注" json:"examine_remark"` } // ExamineStatusKind 审核状态 @@ -120,10 +120,10 @@ const ( ) type Area struct { - Province string `gorm:"column:province;type:varchar(8);default:null;comment:所在省" json:"province"` - City string `gorm:"column:city;type:varchar(8);default:null;comment:所在市" json:"city"` - District string `gorm:"column:district;type:varchar(8);default:null;comment:所在区/县" json:"district"` - Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"` + Province string `gorm:"column:province;type:varchar(8);default:'';comment:所在省" json:"province"` + City string `gorm:"column:city;type:varchar(8);default:'';comment:所在市" json:"city"` + District string `gorm:"column:district;type:varchar(8);default:'';comment:所在区/县" json:"district"` + Address string `gorm:"column:address;type:varchar(255);default:'';comment:详细地址" json:"address"` } func (m *Area) FormatBasic() string { diff --git a/app/common/model/manage_agent.go b/app/common/model/manage_agent.go index 0666a15..e936d4f 100644 --- a/app/common/model/manage_agent.go +++ b/app/common/model/manage_agent.go @@ -6,15 +6,15 @@ import "SciencesServer/utils" type ManageAgent struct { Model Local - Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"` - Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"` - IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"` - WorkExperience string `gorm:"column:work_experience;type:varchar(255);default:null;comment:工作经历" json:"work_experience"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:姓名" json:"name"` + Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"` + IDCard string `gorm:"column:id_card;type:varchar(18);default:'';comment:身份证号" json:"id_card"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"industry"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"` + WorkExperience string `gorm:"column:work_experience;type:varchar(255);default:'';comment:工作经历" json:"work_experience"` WorkPlace string `gorm:"column:work_place;type:varchar(255);default:0;comment:工作地点" json:"work_place"` - IDImage string `gorm:"column:id_image;type:text;default:null;comment:身份证图片" json:"-"` - CredentialImage string `gorm:"column:credential_image;type:varchar(255);default:null;comment:资格证书" json:"credential_image"` + IDImage string `gorm:"column:id_image;type:text;default:'';comment:身份证图片" json:"-"` + CredentialImage string `gorm:"column:credential_image;type:varchar(255);default:'';comment:资格证书" json:"credential_image"` Examine ModelDeleted ModelAt diff --git a/app/common/model/manage_company.go b/app/common/model/manage_company.go index 266767f..9183d35 100644 --- a/app/common/model/manage_company.go +++ b/app/common/model/manage_company.go @@ -7,13 +7,13 @@ type ManageCompany struct { Model Local InviterID uint64 `gorm:"column:inviter_id;type:int;default:0;comment:邀请人ID" json:"inviter_id"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"` Image Area - Url string `gorm:"column:url;type:varchar(255);default:null;comment:企业网站" json:"url"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` + Url string `gorm:"column:url;type:varchar(255);default:'';comment:企业网站" json:"url"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"industry"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Examine ModelDeleted diff --git a/app/common/model/manage_equipment.go b/app/common/model/manage_equipment.go index afae882..930a6b5 100644 --- a/app/common/model/manage_equipment.go +++ b/app/common/model/manage_equipment.go @@ -8,11 +8,11 @@ type ManageEquipment struct { Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` Kind ManageEquipmentKind `gorm:"column:kind;type:tinyint(1);default:0;comment:器材类型" json:"kind"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:器材编号" json:"code"` - Title string `gorm:"column:title;type:varchar(100);default:null;comment:器材名称" json:"title"` - Params string `gorm:"column:params;type:varchar(255);default:null;comment:器材参数" json:"params"` - PurchaseAt time.Time `gorm:"column:purchase_at;type:datetime;default:null;comment:购买时间" json:"purchase_at"` - Description string `gorm:"column:description;type:text;default:null;comment:器材描述" json:"description"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:器材编号" json:"code"` + Title string `gorm:"column:title;type:varchar(100);default:'';comment:器材名称" json:"title"` + Params string `gorm:"column:params;type:varchar(255);default:'';comment:器材参数" json:"params"` + PurchaseAt time.Time `gorm:"column:purchase_at;type:datetime;default:'';comment:购买时间" json:"purchase_at"` + Description string `gorm:"column:description;type:text;default:'';comment:器材描述" json:"description"` ModelDeleted ModelAt } diff --git a/app/common/model/manage_expert.go b/app/common/model/manage_expert.go index 79eda19..f6cbe8e 100644 --- a/app/common/model/manage_expert.go +++ b/app/common/model/manage_expert.go @@ -12,19 +12,19 @@ type ManageExpert struct { Image ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"` LaboratoryID uint64 `gorm:"column:laboratory_id;type:int(11);default:0;comment:实验室ID" json:"-"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:专家名称" json:"name"` - Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:专家联系方式" json:"mobile"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:专家名称" json:"name"` + Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:专家联系方式" json:"mobile"` Area - Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"` - School string `gorm:"column:school;type:varchar(50);default:null;comment:院校" json:"school"` - Major string `gorm:"column:major;type:varchar(50);default:null;comment:专业" json:"major"` - Job string `gorm:"column:job;type:varchar(50);default:null;comment:职务" json:"job"` - Title string `gorm:"column:title;type:varchar(50);default:null;comment:职称" json:"title"` + Position string `gorm:"column:position;type:varchar(50);default:'';comment:坐标" json:"-"` + School string `gorm:"column:school;type:varchar(50);default:'';comment:院校" json:"school"` + Major string `gorm:"column:major;type:varchar(50);default:'';comment:专业" json:"major"` + Job string `gorm:"column:job;type:varchar(50);default:'';comment:职务" json:"job"` + Title string `gorm:"column:title;type:varchar(50);default:'';comment:职称" json:"title"` Gender WorkAt time.Time `gorm:"column:work_at;type:date;not null;comment:从业时间" json:"work_at"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` - Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"industry"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"` + Research string `gorm:"column:research;type:varchar(255);default:'';comment:研究信息" json:"research"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Examine ModelDeleted diff --git a/app/common/model/manage_laboratory.go b/app/common/model/manage_laboratory.go index 642fc3b..8c3e1a0 100644 --- a/app/common/model/manage_laboratory.go +++ b/app/common/model/manage_laboratory.go @@ -9,15 +9,15 @@ type ManageLaboratory struct { Model Local ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"` Image Area - Url string `gorm:"column:url;type:varchar(255);default:null;comment:实验室网站" json:"url"` - Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` - Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"` + Url string `gorm:"column:url;type:varchar(255);default:'';comment:实验室网站" json:"url"` + Position string `gorm:"column:position;type:varchar(50);default:'';comment:坐标" json:"-"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"industry"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"` + Research string `gorm:"column:research;type:varchar(255);default:'';comment:研究信息" json:"research"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Examine ModelDeleted diff --git a/app/common/model/manage_research.go b/app/common/model/manage_research.go index 25cf3bb..c0387ff 100644 --- a/app/common/model/manage_research.go +++ b/app/common/model/manage_research.go @@ -8,14 +8,14 @@ import ( type ManageResearch struct { Model Local - Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"` Image Area - Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:所属领域;行业信息" json:"industry"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` - Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"` + Position string `gorm:"column:position;type:varchar(50);default:'';comment:坐标" json:"-"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"industry"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"` + Research string `gorm:"column:research;type:varchar(255);default:'';comment:研究信息" json:"research"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Examine ModelDeleted diff --git a/app/common/model/model.go b/app/common/model/model.go index bea0aea..4374501 100644 --- a/app/common/model/model.go +++ b/app/common/model/model.go @@ -215,8 +215,6 @@ func FirstWhere(model IModel, where ...*ModelWhere) (bool, error) { for _, wo := range where { db = db.Where(wo.Condition, wo.Value) } - } else { - db = db.Where(fmt.Sprintf("%s = %d", FieldsForID, model.GetID())) } if db.Migrator().HasColumn(model, FieldsForDeleted) { db = db.Where(FieldsForDeleted, DeleteStatusForNot) @@ -230,20 +228,18 @@ func FirstWhere(model IModel, where ...*ModelWhere) (bool, error) { return true, nil } -func FirstField(model IModel, field []string, where ...*ModelWhere) (bool, error) { - db := orm.GetDB().Table(model.TableName()) +func FirstField(model IModel, fields []string, where ...*ModelWhere) (bool, error) { + db := orm.GetDB().Table(model.TableName()).Select(fields) if len(where) > 0 { for _, wo := range where { db = db.Where(wo.Condition, wo.Value) } - } else { - db = db.Where(fmt.Sprintf("%s = %d", FieldsForID, model.GetID())) } if db.Migrator().HasColumn(model, FieldsForDeleted) { db = db.Where(FieldsForDeleted, DeleteStatusForNot) } - if err := db.Select(field).First(model).Error; err != nil { + if err := db.First(model).Error; err != nil { if err == gorm.ErrRecordNotFound { return false, nil } diff --git a/app/common/model/service_demand.go b/app/common/model/service_demand.go index 84d0325..2ad9917 100644 --- a/app/common/model/service_demand.go +++ b/app/common/model/service_demand.go @@ -7,11 +7,11 @@ type ServiceDemand struct { Model Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Kind string `gorm:"column:kind;type:varchar(50);default:null;comment:需求类型" json:"kind"` - Title string `gorm:"column:title;type:varchar(50);default:null;comment:需求名称" json:"title"` - Name string `gorm:"column:name;type:varchar(50);default:null;comment:联系人" json:"name"` - Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:联系人手机号" json:"mobile"` - Description string `gorm:"column:description;type:text;default:null;comment:需求描述" json:"description"` + Kind string `gorm:"column:kind;type:varchar(50);default:'';comment:需求类型" json:"kind"` + Title string `gorm:"column:title;type:varchar(50);default:'';comment:需求名称" json:"title"` + Name string `gorm:"column:name;type:varchar(50);default:'';comment:联系人" json:"name"` + Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系人手机号" json:"mobile"` + Description string `gorm:"column:description;type:text;default:'';comment:需求描述" json:"description"` Status ServiceDemandStatus `gorm:"column:status;type:tinyint(1);default:1;comment:状态" json:"status"` ModelDeleted ModelAt diff --git a/app/common/model/sys_auth.go b/app/common/model/sys_auth.go index 7e79800..b6a69aa 100644 --- a/app/common/model/sys_auth.go +++ b/app/common/model/sys_auth.go @@ -4,10 +4,10 @@ type SysAuth struct { Model ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"` Kind SysAuthKind `gorm:"column:kind;type:tinyint(1);default:1;comment:类型(1:模块,2:权限)" json:"kind"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"` - Auth string `gorm:"column:auth;type:varchar(100);default:null;comment:权限/路由" json:"auth"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"` + Auth string `gorm:"column:auth;type:varchar(100);default:'';comment:权限/路由" json:"auth"` Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_auth_rule.go b/app/common/model/sys_auth_rule.go index b81828c..8cba88f 100644 --- a/app/common/model/sys_auth_rule.go +++ b/app/common/model/sys_auth_rule.go @@ -3,13 +3,13 @@ package model // SysAuthRule 用户角色权限规则,公用组件库-实例: `p, admin, tenant, data, read` type SysAuthRule struct { Model - Ptype string `gorm:"column:ptype;type:varchar(100);default:null;comment:策略(组g/人员p)" json:"ptype"` // 相当于policy.csv文件中 一行中的 p - V0 string `gorm:"column:v0;type:varchar(100);default:null;comment:角色/用户" json:"v0"` // 相当于policy.csv文件中 一行中的 role (角色)(例如:admin) - V1 string `gorm:"column:v1;type:varchar(100);default:null;comment:平台/角色" json:"v1"` // 相当于policy.csv文件中 一行中的 sub (用户)(例如:tenant) - V2 string `gorm:"column:v2;type:varchar(100);default:null;comment:路由/平台" json:"v2"` // 相当于policy.csv文件中 一行中的 obj (被操作的服务器资源)(例如:data) - V3 string `gorm:"column:v3;type:varchar(100);default:null;comment:请求方式" json:"v3"` // 相当于policy.csv文件中 一行中的 act (操作者的行为)(例如:read) - V4 string `gorm:"column:v4;type:varchar(100);default:null;comment:-" json:"v4"` - V5 string `gorm:"column:v5;type:varchar(100);default:null;comment:-" json:"v5"` + Ptype string `gorm:"column:ptype;type:varchar(100);default:'';comment:策略(组g/人员p)" json:"ptype"` // 相当于policy.csv文件中 一行中的 p + V0 string `gorm:"column:v0;type:varchar(100);default:'';comment:角色/用户" json:"v0"` // 相当于policy.csv文件中 一行中的 role (角色)(例如:admin) + V1 string `gorm:"column:v1;type:varchar(100);default:'';comment:平台/角色" json:"v1"` // 相当于policy.csv文件中 一行中的 sub (用户)(例如:tenant) + V2 string `gorm:"column:v2;type:varchar(100);default:'';comment:路由/平台" json:"v2"` // 相当于policy.csv文件中 一行中的 obj (被操作的服务器资源)(例如:data) + V3 string `gorm:"column:v3;type:varchar(100);default:'';comment:请求方式" json:"v3"` // 相当于policy.csv文件中 一行中的 act (操作者的行为)(例如:read) + V4 string `gorm:"column:v4;type:varchar(100);default:'';comment:-" json:"v4"` + V5 string `gorm:"column:v5;type:varchar(100);default:'';comment:-" json:"v5"` } func (m *SysAuthRule) TableName() string { diff --git a/app/common/model/sys_config.go b/app/common/model/sys_config.go index 7e2a44d..308c19a 100644 --- a/app/common/model/sys_config.go +++ b/app/common/model/sys_config.go @@ -4,9 +4,9 @@ package model type SysConfig struct { Model Kind SysConfigKind `gorm:"column:kind;type:tinyint(3);default:0;comment:类型" json:"kind"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"` - Key string `gorm:"column:key;type:varchar(30);default:null;comment:标识" json:"key"` - Value string `gorm:"column:value;type:varchar(255);default:null;comment:内容" json:"value"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"` + Key string `gorm:"column:key;type:varchar(30);default:'';comment:标识" json:"key"` + Value string `gorm:"column:value;type:varchar(255);default:'';comment:内容" json:"value"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_department.go b/app/common/model/sys_department.go index 8128537..933ef2f 100644 --- a/app/common/model/sys_department.go +++ b/app/common/model/sys_department.go @@ -4,10 +4,10 @@ type SysDepartment struct { Model ModelTenant ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"parent_id"` - Title string `gorm:"column:title;type:varchar(20);default:null;comment:部门名称" json:"title"` - Name string `gorm:"column:name;type:varchar(20);default:null;comment:联系人" json:"name"` - Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"` + Title string `gorm:"column:title;type:varchar(20);default:'';comment:部门名称" json:"title"` + Name string `gorm:"column:name;type:varchar(20);default:'';comment:联系人" json:"name"` + Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_identity.go b/app/common/model/sys_identity.go index d48a76e..d2b7241 100644 --- a/app/common/model/sys_identity.go +++ b/app/common/model/sys_identity.go @@ -4,7 +4,7 @@ package model type SysIdentity struct { Model Identity int `gorm:"column:identity;uniqueIndex:idx_sys_identity;type:tinyint(3);default:0;comment:身份信息" json:"identity"` - Name string `gorm:"column:name;type:varchar(20);default:null;comment:身份名称" json:"name"` + Name string `gorm:"column:name;type:varchar(20);default:'';comment:身份名称" json:"name"` RegisterCount int `gorm:"column:register_count;type:tinyint(3);default:0;comment:每个平台下可以最大注册人数,-1不作限制" json:"register_count"` IsExamine SysIdentityExamine `gorm:"column:is_examine;type:tinyint(1);default:1;comment:是否需要后台审核" json:"is_examine"` ModelDeleted diff --git a/app/common/model/sys_industry.go b/app/common/model/sys_industry.go index 31e4dfc..d956c4b 100644 --- a/app/common/model/sys_industry.go +++ b/app/common/model/sys_industry.go @@ -4,8 +4,8 @@ package model type SysIndustry struct { Model ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:编号" json:"code"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:行业名称" json:"name"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:编号" json:"code"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:行业名称" json:"name"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_log.go b/app/common/model/sys_log.go index 77d6df2..d768b43 100644 --- a/app/common/model/sys_log.go +++ b/app/common/model/sys_log.go @@ -5,11 +5,11 @@ type SysLog struct { Model ModelTenant UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"` - Method string `gorm:"column:method;type:varchar(8);default:null;comment:请求方式" json:"method"` + Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"` + Method string `gorm:"column:method;type:varchar(8);default:'';comment:请求方式" json:"method"` Path string `gorm:"column:path;type:varchar(8);default:0;comment:请求地址" json:"event"` - Params string `gorm:"column:params;type:text;default:null;comment:参数信息" json:"params"` - IP string `gorm:"column:ip;type:char(16);default:null;comment:IP地址" json:"ip"` + Params string `gorm:"column:params;type:text;default:'';comment:参数信息" json:"params"` + IP string `gorm:"column:ip;type:char(16);default:'';comment:IP地址" json:"ip"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_menu.go b/app/common/model/sys_menu.go index 04cd95b..9c16b1b 100644 --- a/app/common/model/sys_menu.go +++ b/app/common/model/sys_menu.go @@ -5,7 +5,7 @@ type SysMenu struct { SysMenuBasic Auth SysMenuAuth `gorm:"column:auth;type:tinyint(1);default:0;comment:查看权限(0:通用,1:超管)" json:"auth"` Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序,数值越大,优先排序" json:"sort"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:菜单备注" json:"remark"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:菜单备注" json:"remark"` Status SysMenuStatus `gorm:"column:status;type:tinyint(1);default:1;comment:状态" json:"status"` ModelDeleted ModelAt @@ -13,11 +13,11 @@ type SysMenu struct { type SysMenuBasic struct { ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"parent_id"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:菜单名" json:"name"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:菜单名" json:"name"` Kind SysMenuKind `gorm:"column:kind;type:tinyint(1);default:1;comment:类型(1:目录,2:菜单)" json:"kind"` - Link string `gorm:"column:link;type:varchar(80);default:null;comment:菜单链接" json:"link"` - Component string `gorm:"column:component;type:varchar(80);default:null;comment:组件标识" json:"component"` - Icon string `gorm:"column:icon;type:varchar(50);default:null;comment:菜单图标" json:"icon"` + Link string `gorm:"column:link;type:varchar(80);default:'';comment:菜单链接" json:"link"` + Component string `gorm:"column:component;type:varchar(80);default:'';comment:组件标识" json:"component"` + Icon string `gorm:"column:icon;type:varchar(50);default:'';comment:菜单图标" json:"icon"` } // SysMenuKind 菜单类型 diff --git a/app/common/model/sys_patent.go b/app/common/model/sys_patent.go index ef10303..71b54a9 100644 --- a/app/common/model/sys_patent.go +++ b/app/common/model/sys_patent.go @@ -4,18 +4,18 @@ package model type SysPatent struct { Model Kind SysParentKind `gorm:"column:kind;type:tinyint(1);default:0;comment:专利类型" json:"kind"` - Title string `gorm:"column:title;type:varchar(255);default:null;comment:名称标题" json:"title"` - FileUrl string `gorm:"column:file_url;type:varchar(255);default:null;comment:文件地址" json:"file_url"` - ApplyCode string `gorm:"column:apply_code;type:varchar(50);default:null;comment:申请号" json:"apply_code"` - ApplyAt string `gorm:"column:apply_at;type:varchar(30);default:null;comment:申请日" json:"apply_at"` - OpenCode string `gorm:"column:open_code;type:varchar(50);default:null;comment:公开(公告)号" json:"open_code"` - OpenAt string `gorm:"column:open_at;type:varchar(30);default:null;comment:公开(公告)日" json:"open_at"` - ApplyName string `gorm:"column:apply_name;type:varchar(100);default:null;comment:申请(专利权)人" json:"apply_name"` - ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:null;comment:申请人地址" json:"apply_address"` - Inventor string `gorm:"column:inventor;type:varchar(100);default:null;comment:发明人" json:"inventor"` - Description string `gorm:"column:description;type:text;default:null;comment:摘要" json:"description"` - PrincipalClaim string `gorm:"column:principal_claim;type:text;default:null;comment:主权项" json:"principal_claim"` - IPCCode string `gorm:"column:ipc_code;type:varchar(50);default:null;comment:IPC主分类号" json:"ipc_code"` + Title string `gorm:"column:title;type:varchar(255);default:'';comment:名称标题" json:"title"` + FileUrl string `gorm:"column:file_url;type:varchar(255);default:'';comment:文件地址" json:"file_url"` + ApplyCode string `gorm:"column:apply_code;type:varchar(50);default:'';comment:申请号" json:"apply_code"` + ApplyAt string `gorm:"column:apply_at;type:varchar(30);default:'';comment:申请日" json:"apply_at"` + OpenCode string `gorm:"column:open_code;type:varchar(50);default:'';comment:公开(公告)号" json:"open_code"` + OpenAt string `gorm:"column:open_at;type:varchar(30);default:'';comment:公开(公告)日" json:"open_at"` + ApplyName string `gorm:"column:apply_name;type:varchar(100);default:'';comment:申请(专利权)人" json:"apply_name"` + ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:'';comment:申请人地址" json:"apply_address"` + Inventor string `gorm:"column:inventor;type:varchar(100);default:'';comment:发明人" json:"inventor"` + Description string `gorm:"column:description;type:text;default:'';comment:摘要" json:"description"` + PrincipalClaim string `gorm:"column:principal_claim;type:text;default:'';comment:主权项" json:"principal_claim"` + IPCCode string `gorm:"column:ipc_code;type:varchar(50);default:'';comment:IPC主分类号" json:"ipc_code"` Shelf Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1:授权,2:实审,3:公开)" json:"-"` ModelDeleted diff --git a/app/common/model/sys_research.go b/app/common/model/sys_research.go index 8281949..edc2d98 100644 --- a/app/common/model/sys_research.go +++ b/app/common/model/sys_research.go @@ -4,8 +4,8 @@ package model type SysResearch struct { Model ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:编号" json:"code"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:角色名" json:"name"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:编号" json:"code"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:角色名" json:"name"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_role.go b/app/common/model/sys_role.go index 0cb3a7e..f4c83e7 100644 --- a/app/common/model/sys_role.go +++ b/app/common/model/sys_role.go @@ -3,8 +3,8 @@ package model type SysRole struct { Model ModelTenant - Name string `gorm:"column:name;type:varchar(30);default:null;comment:角色名" json:"name"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:角色备注" json:"remark"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:角色名" json:"name"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:角色备注" json:"remark"` Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"` Status SysRoleStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"-"` ModelDeleted diff --git a/app/common/model/sys_tenant.go b/app/common/model/sys_tenant.go index 40bf8e9..675a390 100644 --- a/app/common/model/sys_tenant.go +++ b/app/common/model/sys_tenant.go @@ -4,18 +4,18 @@ import "encoding/json" type SysTenant struct { Model - Key string `gorm:"column:key;type:varchar(30);default:null;comment:key" json:"key"` + Key string `gorm:"column:key;type:varchar(30);default:'';comment:key" json:"key"` ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"` Image - Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"` Images Area - Position string `gorm:"column:position;type:varchar(255);default:null;comment:坐标" json:"-"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:所属领域;行业信息" json:"-"` + Position string `gorm:"column:position;type:varchar(255);default:'';comment:坐标" json:"-"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"-"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` - Config string `gorm:"column:config;type:varchar(255);default:null;comment:配置信息" json:"-"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"` + Config string `gorm:"column:config;type:varchar(255);default:'';comment:配置信息" json:"-"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_user.go b/app/common/model/sys_user.go index e0d902e..dd3597d 100644 --- a/app/common/model/sys_user.go +++ b/app/common/model/sys_user.go @@ -11,16 +11,16 @@ import ( type SysUser struct { Model UUID uint64 `gorm:"column:uuid;uniqueIndex:idx_sys_user_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"` - Account string `gorm:"column:account;type:varchar(50);default:null;comment:账户名" json:"account"` - Avatar string `gorm:"column:avatar;type:varchar(255);default:null;comment:头像" json:"avatar"` - Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"` - Mobile string `gorm:"column:mobile;index:idx_sys_user_mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"` - Email string `gorm:"column:email;type:varchar(50);default:null;comment:邮箱" json:"email"` + Account string `gorm:"column:account;type:varchar(50);default:'';comment:账户名" json:"account"` + Avatar string `gorm:"column:avatar;type:varchar(255);default:'';comment:头像" json:"avatar"` + Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"` + Mobile string `gorm:"column:mobile;index:idx_sys_user_mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"` + Email string `gorm:"column:email;type:varchar(50);default:'';comment:邮箱" json:"email"` Gender - Password string `gorm:"column:password;type:varchar(100);default:null;comment:密码" json:"-"` - Salt string `gorm:"column:salt;type:varchar(10);default:null;comment:盐值" json:"-"` + Password string `gorm:"column:password;type:varchar(100);default:'';comment:密码" json:"-"` + Salt string `gorm:"column:salt;type:varchar(10);default:'';comment:盐值" json:"-"` IsAdmin SysUserAdministrator `gorm:"column:is_admin;type:tinyint(1);default:0;comment:管理员(0:普通用户,1:管理员)" json:"-"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注" json:"-"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注" json:"-"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_user_login_log.go b/app/common/model/sys_user_login_log.go index 90de81c..03a3d9b 100644 --- a/app/common/model/sys_user_login_log.go +++ b/app/common/model/sys_user_login_log.go @@ -4,8 +4,8 @@ type SysUserLoginLog struct { Model ModelTenant UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Equipment string `gorm:"column:equipment;type:char(10);default:null;comment:登录设备" json:"equipment"` - IP string `gorm:"column:ip;type:char(16);default:null;comment:IP地址" json:"ip"` + Equipment string `gorm:"column:equipment;type:char(10);default:'';comment:登录设备" json:"equipment"` + IP string `gorm:"column:ip;type:char(16);default:'';comment:IP地址" json:"ip"` ModelDeleted ModelAt } diff --git a/app/common/model/sys_user_tenant.go b/app/common/model/sys_user_tenant.go index 698e874..4157ff4 100644 --- a/app/common/model/sys_user_tenant.go +++ b/app/common/model/sys_user_tenant.go @@ -4,8 +4,8 @@ type SysUserTenant struct { Model ModelTenant UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Department string `gorm:"column:department;type:varchar(100);default:null;comment:部门信息" json:"department"` - Role string `gorm:"column:role;type:varchar(100);default:null;comment:角色信息" json:"role"` + Department string `gorm:"column:department;type:varchar(100);default:'';comment:部门信息" json:"department"` + Role string `gorm:"column:role;type:varchar(100);default:'';comment:角色信息" json:"role"` Identity SysUserTenantIdentity `gorm:"column:identity;type:tinyint(1);default:0;comment:用户身份(1:管理员,2:用户)" json:"-"` ModelDeleted ModelAt diff --git a/app/common/model/technology_demand.go b/app/common/model/technology_demand.go index 1eeface..9405890 100644 --- a/app/common/model/technology_demand.go +++ b/app/common/model/technology_demand.go @@ -11,16 +11,16 @@ type TechnologyDemand struct { Model Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Title string `gorm:"column:title;type:varchar(50);default:null;comment:需求名称" json:"title"` - Kind string `gorm:"column:kind;type:varchar(50);default:null;comment:需求类别" json:"-"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:联系人" json:"name"` - Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"` + Title string `gorm:"column:title;type:varchar(50);default:'';comment:需求名称" json:"title"` + Kind string `gorm:"column:kind;type:varchar(50);default:'';comment:需求类别" json:"-"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:联系人" json:"name"` + Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"` Industry string `gorm:"column:industry;type:varchar(255);comment:所属领域;行业信息" json:"industry"` Introduce string `gorm:"column:introduce;type:text;comment:需求描述" json:"introduce"` Budget float64 `gorm:"column:budget;type:decimal(10,2);default:0;comment:投产预算" json:"budget"` BudgetMode TechnologyDemandBudgetMode `gorm:"column:budget_mode;type:tinyint(1);default:1;comment:预算模式(1:具体金额,2:面议)" json:"budget_mode"` Deadline time.Time `gorm:"column:deadline;type:date;not null;comment:截止时间" json:"deadline"` - Other string `gorm:"column:other;type:varchar(255);default:null;comment:其他信息" json:"-"` + Other string `gorm:"column:other;type:varchar(255);default:'';comment:其他信息" json:"-"` Status TechnologyDemandStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` ModelDeleted ModelAt diff --git a/app/common/model/technology_instance.go b/app/common/model/technology_instance.go index 5af035d..19bb77d 100644 --- a/app/common/model/technology_instance.go +++ b/app/common/model/technology_instance.go @@ -11,20 +11,20 @@ type TechnologyInstance struct { Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` PatentID uint64 `gorm:"column:patent_id;type:int;default:0;comment:代表专利" json:"patent_id"` - Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"` - Company string `gorm:"column:company;type:varchar(30);default:null;comment:单位" json:"company"` + Title string `gorm:"column:title;type:varchar(30);default:'';comment:名称" json:"title"` + Company string `gorm:"column:company;type:varchar(30);default:'';comment:单位" json:"company"` Maturity config.TechnologyMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:成熟度" json:"maturity"` Prototype int `gorm:"column:prototype;type:tinyint(1);default:0;comment:样机(0:无,1:有)" json:"prototype"` - Product string `gorm:"column:product;type:varchar(255);default:null;comment:应用产品" json:"product"` + Product string `gorm:"column:product;type:varchar(255);default:'';comment:应用产品" json:"product"` Source TechnologyInstanceSource `gorm:"column:source;type:tinyint(1);default:0;comment:来源" json:"source"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"` Territory uint64 `gorm:"column:territory;type:int(11);default:0;comment:技术领域" json:"territory"` Transaction int `gorm:"column:transaction;type:tinyint(3);default:0;comment:交易方式" json:"transaction"` Images - ProveImages string `gorm:"column:prove_images;type:text;default:null;comment:证明材料图片" json:"prove_images"` + ProveImages string `gorm:"column:prove_images;type:text;default:'';comment:证明材料图片" json:"prove_images"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Purpose string `gorm:"column:purpose;type:text;comment:意图-承担科研项目" json:"purpose"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"` Shelf Status TechnologyInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` ModelDeleted diff --git a/app/common/model/technology_paper.go b/app/common/model/technology_paper.go index f2e26d0..5080447 100644 --- a/app/common/model/technology_paper.go +++ b/app/common/model/technology_paper.go @@ -10,13 +10,13 @@ type TechnologyPaper struct { Model Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Title string `gorm:"column:title;type:varchar(100);default:null;comment:题目" json:"title"` - Ext string `gorm:"column:ext;type:varchar(30);default:null;comment:引用格式" json:"ext"` - Author string `gorm:"column:author;type:varchar(100);default:null;comment:作者" json:"author"` + Title string `gorm:"column:title;type:varchar(100);default:'';comment:题目" json:"title"` + Ext string `gorm:"column:ext;type:varchar(30);default:'';comment:引用格式" json:"ext"` + Author string `gorm:"column:author;type:varchar(100);default:'';comment:作者" json:"author"` PublishAt time.Time `gorm:"column:publish_at;type:datetime;not null;comment:出版日期" json:"publish_at"` - Keyword string `gorm:"column:keyword;type:varchar(100);default:null;comment:关键词" json:"keyword"` - Tag string `gorm:"column:tags;type:varchar(255);default:null;comment:标签" json:"-"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注" json:"remark"` + Keyword string `gorm:"column:keyword;type:varchar(100);default:'';comment:关键词" json:"keyword"` + Tag string `gorm:"column:tags;type:varchar(255);default:'';comment:标签" json:"-"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注" json:"remark"` ModelDeleted ModelAt } diff --git a/app/common/model/technology_prodcut.go b/app/common/model/technology_prodcut.go index 9dc627e..e9744e8 100644 --- a/app/common/model/technology_prodcut.go +++ b/app/common/model/technology_prodcut.go @@ -10,16 +10,16 @@ type TechnologyProduct struct { Model Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Title string `gorm:"column:title;type:varchar(100);default:null;comment:产品名称" json:"title"` + Title string `gorm:"column:title;type:varchar(100);default:'';comment:产品名称" json:"title"` Image - Video string `gorm:"column:video;type:varchar(255);default:null;comment:视频地址" json:"video"` - Material string `gorm:"column:material;type:varchar(255);default:null;comment:证明材料" json:"material"` - Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:所属领域;行业信息" json:"industry"` - Customer string `gorm:"column:customer;type:varchar(255);default:null;comment:应用客户" json:"-"` + Video string `gorm:"column:video;type:varchar(255);default:'';comment:视频地址" json:"video"` + Material string `gorm:"column:material;type:varchar(255);default:'';comment:证明材料" json:"material"` + Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"industry"` + Customer string `gorm:"column:customer;type:varchar(255);default:'';comment:应用客户" json:"-"` Maturity config.TechnologyMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:技术成熟度" json:"maturity"` LeadStandard TechnologyProductLeadStandard `gorm:"column:lead_standard;type:tinyint(1);default:0;comment:领先标准" json:"lead_standard"` CooperationMode config.TechnologyCooperationMode `gorm:"column:cooperation_mode;type:tinyint(1);default:0;comment:合作模式" json:"cooperation_mode"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Shelf Status TechnologyProductStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` diff --git a/app/common/model/technology_project.go b/app/common/model/technology_project.go index 4b66ee6..76a7d63 100644 --- a/app/common/model/technology_project.go +++ b/app/common/model/technology_project.go @@ -7,12 +7,12 @@ type TechnologyProject struct { Model Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Kind string `gorm:"column:kind;type:varchar(100);default:null;comment:类型" json:"kind"` + Kind string `gorm:"column:kind;type:varchar(100);default:'';comment:类型" json:"kind"` Role TechnologyProjectRole `gorm:"column:role;type:tinyint(1);default:1;comment:课题角色(1:承担单位,2:参与单位)" json:"role"` - Title string `gorm:"column:title;type:varchar(100);default:null;comment:名称" json:"title"` + Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称" json:"title"` Amount float64 `gorm:"column:amount;decimal(10,2);default:0;comment:经费" json:"amount"` - Source string `gorm:"column:source;type:varchar(100);default:null;comment:来源" json:"source"` - Director string `gorm:"column:director;type:varchar(100);default:null;comment:负责人" json:"director"` + Source string `gorm:"column:source;type:varchar(100);default:'';comment:来源" json:"source"` + Director string `gorm:"column:director;type:varchar(100);default:'';comment:负责人" json:"director"` BeginAt time.Time `gorm:"column:begin_at;type:datetime;not null;comment:开始时间" json:"begin_at"` FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:结束时间" json:"finish_at"` Shelf diff --git a/app/common/model/technology_topic.go b/app/common/model/technology_topic.go index 86f79e8..09cd6d8 100644 --- a/app/common/model/technology_topic.go +++ b/app/common/model/technology_topic.go @@ -10,11 +10,11 @@ type TechnologyTopic struct { Model Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Title string `gorm:"column:title;type:varchar(100);default:null;comment:名称" json:"title"` - Code string `gorm:"column:code;type:varchar(30);default:null;comment:编号" json:"code"` - Emcee string `gorm:"column:emcee;type:varchar(30);default:null;comment:主持人" json:"emcee"` - Mechanism string `gorm:"column:mechanism;type:varchar(30);default:null;comment:机构" json:"mechanism"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"` + Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称" json:"title"` + Code string `gorm:"column:code;type:varchar(30);default:'';comment:编号" json:"code"` + Emcee string `gorm:"column:emcee;type:varchar(30);default:'';comment:主持人" json:"emcee"` + Mechanism string `gorm:"column:mechanism;type:varchar(30);default:'';comment:机构" json:"mechanism"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"` Amount float64 `gorm:"column:amount;decimal(10,2);default:0;comment:经费" json:"amount"` Source TechnologyTopicSource `gorm:"column:source;type:tinyint(1);default:0;comment:来源" json:"source"` Kind TechnologyTopicKind `gorm:"column:kind;type:tinyint(1);default:0;comment:类型" json:"kind"` diff --git a/app/common/model/user_bank.go b/app/common/model/user_bank.go index c4b9429..56a9bca 100644 --- a/app/common/model/user_bank.go +++ b/app/common/model/user_bank.go @@ -4,10 +4,10 @@ package model type UserBank struct { Model UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"` - IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"` - BankCard string `gorm:"column:bank_card;type:varchar(18);default:null;comment:银行卡号" json:"bank_card"` - BankName string `gorm:"column:bank_name;type:varchar(15);default:null;comment:银行名称" json:"bank_name"` + Name string `gorm:"column:name;type:varchar(30);default:'';comment:姓名" json:"name"` + IDCard string `gorm:"column:id_card;type:varchar(18);default:'';comment:身份证号" json:"id_card"` + BankCard string `gorm:"column:bank_card;type:varchar(18);default:'';comment:银行卡号" json:"bank_card"` + BankName string `gorm:"column:bank_name;type:varchar(15);default:'';comment:银行名称" json:"bank_name"` IsDefault UserBankDefault `gorm:"column:is_default;type:tinyint(1);default:0;comment:默认使用(0:不默认,1:默认)" json:"-"` ModelDeleted ModelAt diff --git a/app/common/model/user_consume.go b/app/common/model/user_consume.go index e12ff95..5edae3d 100644 --- a/app/common/model/user_consume.go +++ b/app/common/model/user_consume.go @@ -4,10 +4,10 @@ package model type UserConsume struct { Model UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Source UserConsumeSource `gorm:"column:source;type:tinyiny(1);default:null;comment:消耗来源" json:"source"` - Consume float64 `gorm:"column:consume;type:decimal(10,2);default:null;comment:消耗数量" json:"consume"` - Surplus float64 `gorm:"column:surplus;type:decimal(10,2);default:null;comment:剩余数量" json:"surplus"` - Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"` + Source UserConsumeSource `gorm:"column:source;type:tinyiny(1);default:'';comment:消耗来源" json:"source"` + Consume float64 `gorm:"column:consume;type:decimal(10,2);default:'';comment:消耗数量" json:"consume"` + Surplus float64 `gorm:"column:surplus;type:decimal(10,2);default:'';comment:剩余数量" json:"surplus"` + Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"` ModelDeleted ModelAt } diff --git a/app/common/model/user_cooperate_enterprise.go b/app/common/model/user_cooperate_enterprise.go index 6463f5f..c3c8af5 100644 --- a/app/common/model/user_cooperate_enterprise.go +++ b/app/common/model/user_cooperate_enterprise.go @@ -12,12 +12,12 @@ type UserCooperateEnterprise struct { Local UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` Mode UserCooperateEnterpriseMode `gorm:"column:mode;type:int;default:0;comment:合作模式(1:已合作,2:想合作)" json:"mode"` - Title string `gorm:"column:title;type:varchar(30);default:null;comment:企业名称" json:"title"` - Name string `gorm:"column:name;type:varchar(50);default:null;comment:企业联系人" json:"name"` - Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:企业联系方式" json:"mobile"` - Paper string `gorm:"column:paper;type:varchar(255);default:null;comment:论文信息" json:"-"` - Patent string `gorm:"column:patent;type:varchar(255);default:null;comment:专利信息" json:"-"` - Content string `gorm:"column:content;type:varchar(255);default:null;comment:合作内容" json:"content"` + Title string `gorm:"column:title;type:varchar(30);default:'';comment:企业名称" json:"title"` + Name string `gorm:"column:name;type:varchar(50);default:'';comment:企业联系人" json:"name"` + Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:企业联系方式" json:"mobile"` + Paper string `gorm:"column:paper;type:varchar(255);default:'';comment:论文信息" json:"-"` + Patent string `gorm:"column:patent;type:varchar(255);default:'';comment:专利信息" json:"-"` + Content string `gorm:"column:content;type:varchar(255);default:'';comment:合作内容" json:"content"` ModelDeleted ModelAt } diff --git a/app/common/model/user_identity.go b/app/common/model/user_identity.go index 591d73a..ddbddc8 100644 --- a/app/common/model/user_identity.go +++ b/app/common/model/user_identity.go @@ -11,11 +11,11 @@ type UserIdentity struct { Model UUID uint64 `gorm:"column:uuid;uniqueIndex:idx_user_manage_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"` UID uint64 `gorm:"column:uid;index:idx_user_manage_uid;type:int;default:0;comment:用户表UUID" json:"-"` - Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"` - Email string `gorm:"column:email;type:varchar(50);default:null;comment:邮箱" json:"email"` - Job string `gorm:"column:job;type:varchar(50);default:null;comment:职务" json:"job"` - FixedPhone string `gorm:"column:fixed_phone;type:varchar(20);default:null;comment:固定电话" json:"fixed_phone"` - Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"` + Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"` + Email string `gorm:"column:email;type:varchar(50);default:'';comment:邮箱" json:"email"` + Job string `gorm:"column:job;type:varchar(50);default:'';comment:职务" json:"job"` + FixedPhone string `gorm:"column:fixed_phone;type:varchar(20);default:'';comment:固定电话" json:"fixed_phone"` + Address string `gorm:"column:address;type:varchar(255);default:'';comment:详细地址" json:"address"` Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份信息" json:"-"` IsSelected UserIdentitySelected `gorm:"column:is_selected;type:tinyint(1);default:0;comment:最后一次选中的身份信息" json:"-"` ModelDeleted diff --git a/app/common/model/user_instance.go b/app/common/model/user_instance.go index 2fa347c..ef25e2f 100644 --- a/app/common/model/user_instance.go +++ b/app/common/model/user_instance.go @@ -11,13 +11,13 @@ type UserInstance struct { Model UUID uint64 `gorm:"column:uuid;uniqueIndex:idx_tenant_user_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"` Source UserInstanceSource `gorm:"column:source;type:tinyint(1);default:1;comment:账号来源" json:"source"` - Avatar string `gorm:"column:avatar;type:varchar(255);default:null;comment:头像" json:"avatar"` - Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"` - Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"` + Avatar string `gorm:"column:avatar;type:varchar(255);default:'';comment:头像" json:"avatar"` + Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"` + Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"` Gender Identity int `gorm:"column:identity;type:int(8);default:0;comment:身份信息" json:"-"` - Password string `gorm:"column:password;type:varchar(100);default:null;comment:密码" json:"-"` - Salt string `gorm:"column:salt;type:varchar(10);default:null;comment:盐值" json:"-"` + Password string `gorm:"column:password;type:varchar(100);default:'';comment:密码" json:"-"` + Salt string `gorm:"column:salt;type:varchar(10);default:'';comment:盐值" json:"-"` AccountStatus ModelDeleted ModelAt diff --git a/router/auth.go b/router/auth.go index ab26e63..418b956 100644 --- a/router/auth.go +++ b/router/auth.go @@ -49,6 +49,12 @@ func NeedLogin(session logic.ISession, skipperURL ...SkipperURL) gin.HandlerFunc } } +func NeedHaveIdentity() gin.HandlerFunc { + return func(c *gin.Context) { + + } +} + // NeedPermission 需要权限验证 func NeedPermission(skipperURL ...SkipperURL) PermissionHandle { return func(key string) gin.HandlerFunc {