feat:完善项目
This commit is contained in:
@ -15,10 +15,10 @@ import (
|
||||
// Achievement 成果信息
|
||||
type Achievement struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type AchievementHandle func(session *session.Enterprise, local string) *Achievement
|
||||
type AchievementHandle func(session *session.Enterprise, tenantID uint64) *Achievement
|
||||
|
||||
type (
|
||||
// AchievementInfo 成果信息
|
||||
@ -183,7 +183,7 @@ func (c *Achievement) Form(params *AchievementParams) error {
|
||||
mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining
|
||||
return model2.Updates(mTechnologyAchievement.TechnologyAchievement, mTechnologyAchievement.TechnologyAchievement)
|
||||
}
|
||||
mTechnologyAchievement.Local.Local = c.local
|
||||
mTechnologyAchievement.TenantID = c.tenantID
|
||||
mTechnologyAchievement.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
@ -231,10 +231,10 @@ func (c *Achievement) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewAchievement() AchievementHandle {
|
||||
return func(session *session.Enterprise, local string) *Achievement {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Achievement {
|
||||
return &Achievement{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Demand 技术需求管理
|
||||
type Demand struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type DemandHandle func(session *session.Enterprise, local string) *Demand
|
||||
type DemandHandle func(session *session.Enterprise, tenantID uint64) *Demand
|
||||
|
||||
type (
|
||||
// DemandInfo 需求信息
|
||||
@ -149,7 +149,7 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
|
||||
}
|
||||
mTechnologyDemand.UID = c.UID
|
||||
mTechnologyDemand.Local.Local = c.local
|
||||
mTechnologyDemand.TenantID = c.tenantID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining
|
||||
@ -178,7 +178,7 @@ func (c *Demand) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewDemand() DemandHandle {
|
||||
return func(session *session.Enterprise, local string) *Demand {
|
||||
return &Demand{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Demand {
|
||||
return &Demand{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Instance 技术管理
|
||||
type Instance struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
type InstanceHandle func(session *session.Enterprise, tenantID uint64) *Instance
|
||||
|
||||
type (
|
||||
// InstanceInfo 详细信息
|
||||
@ -108,7 +108,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
||||
}
|
||||
mTechnologyInstance.UID = c.UID
|
||||
mTechnologyInstance.Local.Local = c.local
|
||||
mTechnologyInstance.TenantID = c.tenantID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
||||
@ -161,7 +161,7 @@ func (c *Instance) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Enterprise, local string) *Instance {
|
||||
return &Instance{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Instance {
|
||||
return &Instance{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Paper 论文管理
|
||||
type Paper struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type PaperHandle func(session *session.Enterprise, local string) *Paper
|
||||
type PaperHandle func(session *session.Enterprise, tenantID uint64) *Paper
|
||||
|
||||
type (
|
||||
PaperInfo struct {
|
||||
@ -38,7 +38,7 @@ func (c *Paper) List(title string, page, pageSize int) (*controller.ReturnPages,
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("local", c.local),
|
||||
Where: model2.NewWhere("tenant_id", c.tenantID),
|
||||
}}
|
||||
if title != "" {
|
||||
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
|
||||
@ -83,7 +83,7 @@ func (c *Paper) Form(params *PaperParams) error {
|
||||
|
||||
if params.ID <= 0 {
|
||||
mTechnologyPaper.UID = c.UID
|
||||
mTechnologyPaper.Local.Local = c.local
|
||||
mTechnologyPaper.TenantID = c.tenantID
|
||||
return model2.Create(mTechnologyPaper.TechnologyPaper)
|
||||
}
|
||||
mTechnologyPaper.UpdatedAt = time.Now()
|
||||
@ -111,7 +111,7 @@ func (c *Paper) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewPaper() PaperHandle {
|
||||
return func(session *session.Enterprise, local string) *Paper {
|
||||
return &Paper{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Paper {
|
||||
return &Paper{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ import (
|
||||
// Patent 专利管理
|
||||
type Patent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type PatentHandle func(session *session.Enterprise, local string) *Patent
|
||||
type PatentHandle func(session *session.Enterprise, tenantID uint64) *Patent
|
||||
|
||||
type (
|
||||
// PatentInfo 专利信息
|
||||
@ -55,7 +55,7 @@ type (
|
||||
)
|
||||
|
||||
// add 新增专利信息
|
||||
func (c *PatentParams) add(uid uint64) error {
|
||||
func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
isExist, err := mSysPatent.IsExistParams(map[string]interface{}{
|
||||
"apply_code": c.ApplyCode, "open_code": c.OpenCode,
|
||||
@ -67,6 +67,7 @@ func (c *PatentParams) add(uid uint64) error {
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
mSysPatent.Kind = model2.SysParentKind(c.Kind)
|
||||
mSysPatent.TenantID = tenantID
|
||||
mSysPatent.Title = c.Title
|
||||
mSysPatent.FileUrl = c.FileUrl
|
||||
mSysPatent.ApplyCode = c.ApplyCode
|
||||
@ -258,7 +259,7 @@ func (c *Patent) Form(params *PatentParams) error {
|
||||
if params.ID > 0 {
|
||||
return params.edit(c.UID)
|
||||
}
|
||||
return params.add(c.UID)
|
||||
return params.add(c.tenantID, c.UID)
|
||||
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ func (c *Patent) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewPatent() PatentHandle {
|
||||
return func(session *session.Enterprise, local string) *Patent {
|
||||
return &Patent{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Patent {
|
||||
return &Patent{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Product 产品信息
|
||||
type Product struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ProductHandle func(session *session.Enterprise, local string) *Product
|
||||
type ProductHandle func(session *session.Enterprise, tenantID uint64) *Product
|
||||
|
||||
type (
|
||||
// ProductInfo 产品信息
|
||||
@ -205,7 +205,7 @@ func (c *Product) Form(params *ProductParams) error {
|
||||
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct)
|
||||
}
|
||||
mTechnologyProduct.Local.Local = c.local
|
||||
mTechnologyProduct.TenantID = c.tenantID
|
||||
mTechnologyProduct.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
@ -253,10 +253,10 @@ func (c *Product) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewProduct() ProductHandle {
|
||||
return func(session *session.Enterprise, local string) *Product {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Product {
|
||||
return &Product{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Project 项目列表
|
||||
type Project struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ProjectHandle func(session *session.Enterprise, local string) *Project
|
||||
type ProjectHandle func(session *session.Enterprise, tenantID uint64) *Project
|
||||
|
||||
type (
|
||||
// ProjectInfo 产品信息
|
||||
@ -90,7 +90,7 @@ func (c *Project) Form(params *ProjectParams) error {
|
||||
if mTechnologyProject.ID > 0 {
|
||||
return model2.Updates(mTechnologyProject.TechnologyProject, mTechnologyProject.TechnologyProject)
|
||||
}
|
||||
mTechnologyProject.Local.Local = c.local
|
||||
mTechnologyProject.TenantID = c.tenantID
|
||||
mTechnologyProject.UID = c.UID
|
||||
return model2.Create(mTechnologyProject.TechnologyProject)
|
||||
}
|
||||
@ -135,7 +135,7 @@ func (c *Project) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewProject() ProjectHandle {
|
||||
return func(session *session.Enterprise, local string) *Project {
|
||||
return &Project{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Project {
|
||||
return &Project{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
|
||||
type Topic struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type TopicHandle func(session *session.Enterprise, local string) *Topic
|
||||
type TopicHandle func(session *session.Enterprise, tenantID uint64) *Topic
|
||||
|
||||
type (
|
||||
// TopicInfo 课题信息
|
||||
@ -122,7 +122,7 @@ func (c *Topic) Form(params *TopicParams) error {
|
||||
mTechnologyTopic.UpdatedAt = time.Now()
|
||||
return model2.Updates(mTechnologyTopic.TechnologyTopic, mTechnologyTopic.TechnologyTopic)
|
||||
}
|
||||
mTechnologyTopic.Local.Local = c.local
|
||||
mTechnologyTopic.TenantID = c.tenantID
|
||||
mTechnologyTopic.UID = c.UID
|
||||
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
||||
}
|
||||
@ -145,10 +145,10 @@ func (c *Topic) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewTopic() TopicHandle {
|
||||
return func(session *session.Enterprise, local string) *Topic {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Topic {
|
||||
return &Topic{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user