feat:优化项目信息
This commit is contained in:
@ -31,10 +31,10 @@ func (c *Equipment) List(title string, page, pageSize int) (*controller.ReturnPa
|
|||||||
mTechnologyEquipment := model.NewTechnologyEquipment()
|
mTechnologyEquipment := model.NewTechnologyEquipment()
|
||||||
|
|
||||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("tenant_id", c.TenantID),
|
Where: model2.NewWhere("local", c.local),
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
}, &model2.ModelWhereOrder{
|
}, &model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("local", c.local),
|
Where: model2.NewWhere("uid", c.UID),
|
||||||
}}
|
}}
|
||||||
|
|
||||||
if title != "" {
|
if title != "" {
|
||||||
@ -82,6 +82,7 @@ func (c *Equipment) Form(params *EquipmentParams) error {
|
|||||||
if mTechnologyEquipment.ID > 0 {
|
if mTechnologyEquipment.ID > 0 {
|
||||||
return model2.Updates(mTechnologyEquipment.TechnologyEquipment, mTechnologyEquipment.TechnologyEquipment)
|
return model2.Updates(mTechnologyEquipment.TechnologyEquipment, mTechnologyEquipment.TechnologyEquipment)
|
||||||
}
|
}
|
||||||
|
mTechnologyEquipment.UID = c.UID
|
||||||
return model2.Create(mTechnologyEquipment.TechnologyEquipment)
|
return model2.Create(mTechnologyEquipment.TechnologyEquipment)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +96,8 @@ func (c *Equipment) Delete(id uint64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,设备信息不存在")
|
return errors.New("操作错误,设备信息不存在或已被删除")
|
||||||
} else if mTechnologyEquipment.Local.Local != c.local {
|
} else if mTechnologyEquipment.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mTechnologyEquipment.TechnologyEquipment)
|
return model2.Delete(mTechnologyEquipment.TechnologyEquipment)
|
||||||
|
@ -44,6 +44,8 @@ func (c *Instance) List(status, page, pageSize int) (*controller.ReturnPages, er
|
|||||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("status", status),
|
Where: model2.NewWhere("status", status),
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
|
}, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhere("uid", c.UID),
|
||||||
}}
|
}}
|
||||||
var count int64
|
var count int64
|
||||||
|
|
||||||
@ -68,14 +70,13 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
if params.ID > 0 {
|
if params.ID > 0 {
|
||||||
mTechnologyInstance.ID = params.ID
|
mTechnologyInstance.ID = params.ID
|
||||||
|
|
||||||
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid",
|
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid", "status", "created_at"})
|
||||||
"status", "created_at", "updated_at"})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("信息不存在")
|
return errors.New("操作错误,技术信息不存在或已被删除")
|
||||||
} else if c.ManageUID != mTechnologyInstance.MUid {
|
} else if c.UID != mTechnologyInstance.UID {
|
||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
||||||
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse {
|
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse {
|
||||||
@ -106,9 +107,8 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
||||||
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
||||||
}
|
}
|
||||||
mTechnologyInstance.MUid = c.ManageUID
|
mTechnologyInstance.UID = c.UID
|
||||||
mTechnologyInstance.Local.Local = c.local
|
mTechnologyInstance.Local.Local = c.local
|
||||||
mTechnologyInstance.TenantID = c.TenantID
|
|
||||||
|
|
||||||
if params.IsSubmit > 0 {
|
if params.IsSubmit > 0 {
|
||||||
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
||||||
@ -120,13 +120,13 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
func (c *Instance) Shelf(id uint64, status int) error {
|
func (c *Instance) Shelf(id uint64, status int) error {
|
||||||
mTechnologyInstance := model.NewTechnologyInstance()
|
mTechnologyInstance := model.NewTechnologyInstance()
|
||||||
mTechnologyInstance.ID = id
|
mTechnologyInstance.ID = id
|
||||||
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid", "shelf", "status"})
|
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid", "shelf", "status"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("信息不存在")
|
return errors.New("信息不存在")
|
||||||
} else if c.ManageUID != mTechnologyInstance.MUid {
|
} else if c.UID != mTechnologyInstance.UID {
|
||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
||||||
return errors.New("操作错误,当前状态不允许处理上下架")
|
return errors.New("操作错误,当前状态不允许处理上下架")
|
||||||
@ -145,13 +145,13 @@ func (c *Instance) Shelf(id uint64, status int) error {
|
|||||||
func (c *Instance) Delete(id uint64) error {
|
func (c *Instance) Delete(id uint64) error {
|
||||||
mTechnologyInstance := model.NewTechnologyInstance()
|
mTechnologyInstance := model.NewTechnologyInstance()
|
||||||
mTechnologyInstance.ID = id
|
mTechnologyInstance.ID = id
|
||||||
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid"})
|
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("信息不存在")
|
return errors.New("信息不存在")
|
||||||
} else if c.ManageUID != mTechnologyInstance.MUid {
|
} else if c.UID != mTechnologyInstance.UID {
|
||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
}
|
}
|
||||||
if err = model2.Delete(mTechnologyInstance.TechnologyInstance); err != nil {
|
if err = model2.Delete(mTechnologyInstance.TechnologyInstance); err != nil {
|
||||||
|
@ -49,7 +49,7 @@ func (c *Product) List(title string, status, page, pageSize int) ([]*ProductInfo
|
|||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
},
|
},
|
||||||
&model2.ModelWhereOrder{
|
&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("m_uid", c.ManageUID),
|
Where: model2.NewWhere("uid", c.UID),
|
||||||
},
|
},
|
||||||
&model2.ModelWhereOrder{
|
&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("status", status),
|
Where: model2.NewWhere("status", status),
|
||||||
@ -112,7 +112,7 @@ func (c *Product) Form(params *ProductParams) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||||
} else if mTechnologyProduct.MUid != c.ManageUID {
|
} else if mTechnologyProduct.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
} else if mTechnologyProduct.Status != model2.TechnologyProductStatusForRefuse &&
|
} else if mTechnologyProduct.Status != model2.TechnologyProductStatusForRefuse &&
|
||||||
mTechnologyProduct.Status != model2.TechnologyProductStatusForDraft {
|
mTechnologyProduct.Status != model2.TechnologyProductStatusForDraft {
|
||||||
@ -135,9 +135,8 @@ func (c *Product) Form(params *ProductParams) error {
|
|||||||
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
||||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct)
|
return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct)
|
||||||
}
|
}
|
||||||
mTechnologyProduct.TenantID = c.TenantID
|
|
||||||
mTechnologyProduct.Local.Local = c.local
|
mTechnologyProduct.Local.Local = c.local
|
||||||
mTechnologyProduct.MUid = c.UID
|
mTechnologyProduct.UID = c.UID
|
||||||
|
|
||||||
if params.IsSubmit > 0 {
|
if params.IsSubmit > 0 {
|
||||||
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
||||||
@ -150,13 +149,13 @@ func (c *Product) Shelf(id uint64, status int) error {
|
|||||||
mTechnologyProduct := model.NewTechnologyProduct()
|
mTechnologyProduct := model.NewTechnologyProduct()
|
||||||
mTechnologyProduct.ID = id
|
mTechnologyProduct.ID = id
|
||||||
|
|
||||||
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "m_uid", "status"})
|
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "uid", "status"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||||
} else if mTechnologyProduct.MUid != c.ManageUID {
|
} else if mTechnologyProduct.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
} else if mTechnologyProduct.ShelfStatus.Shelf == model2.ShelfStatusKind(status) {
|
} else if mTechnologyProduct.ShelfStatus.Shelf == model2.ShelfStatusKind(status) {
|
||||||
return errors.New("操作错误,无需变更上下架状态")
|
return errors.New("操作错误,无需变更上下架状态")
|
||||||
@ -171,13 +170,13 @@ func (c *Product) Delete(id uint64) error {
|
|||||||
mTechnologyProduct := model.NewTechnologyProduct()
|
mTechnologyProduct := model.NewTechnologyProduct()
|
||||||
mTechnologyProduct.ID = id
|
mTechnologyProduct.ID = id
|
||||||
|
|
||||||
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "m_uid"})
|
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "uid"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||||
} else if mTechnologyProduct.MUid != c.ManageUID {
|
} else if mTechnologyProduct.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mTechnologyProduct.TechnologyProduct)
|
return model2.Delete(mTechnologyProduct.TechnologyProduct)
|
||||||
|
@ -49,7 +49,7 @@ func (c *Topic) List(status int, page, pageSize int) (*controller.ReturnPages, e
|
|||||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("status", status),
|
Where: model2.NewWhere("status", status),
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
}, &model2.ModelWhereOrder{Where: model2.NewWhere("uid", c.ManageUID)}}
|
}, &model2.ModelWhereOrder{Where: model2.NewWhere("uid", c.UID)}}
|
||||||
|
|
||||||
var count int64
|
var count int64
|
||||||
|
|
||||||
@ -94,13 +94,13 @@ func (c *Topic) Form(params *TopicParams) error {
|
|||||||
|
|
||||||
if params.ID > 0 {
|
if params.ID > 0 {
|
||||||
mTechnologyTopic.ID = params.ID
|
mTechnologyTopic.ID = params.ID
|
||||||
isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "m_uid", "status"})
|
isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "uid", "status"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,课题信息不存在")
|
return errors.New("操作错误,课题信息不存在")
|
||||||
} else if mTechnologyTopic.MUid != c.ManageUID {
|
} else if mTechnologyTopic.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
} else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft &&
|
} else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft &&
|
||||||
mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse {
|
mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse {
|
||||||
@ -122,9 +122,8 @@ func (c *Topic) Form(params *TopicParams) error {
|
|||||||
mTechnologyTopic.UpdatedAt = time.Now()
|
mTechnologyTopic.UpdatedAt = time.Now()
|
||||||
return model2.Updates(mTechnologyTopic.TechnologyTopic, mTechnologyTopic.TechnologyTopic)
|
return model2.Updates(mTechnologyTopic.TechnologyTopic, mTechnologyTopic.TechnologyTopic)
|
||||||
}
|
}
|
||||||
mTechnologyTopic.TenantID = c.TenantID
|
|
||||||
mTechnologyTopic.Local.Local = c.local
|
mTechnologyTopic.Local.Local = c.local
|
||||||
mTechnologyTopic.MUid = c.ManageUID
|
mTechnologyTopic.UID = c.UID
|
||||||
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ func (c *Topic) Delete(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,课题信息不存在")
|
return errors.New("操作错误,课题信息不存在")
|
||||||
} else if mTechnologyTopic.MUid != c.ManageUID {
|
} else if mTechnologyTopic.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mTechnologyTopic.TechnologyTopic)
|
return model2.Delete(mTechnologyTopic.TechnologyTopic)
|
||||||
|
@ -3,8 +3,8 @@ package model
|
|||||||
// TechnologyEquipment 技术设备管理信息
|
// TechnologyEquipment 技术设备管理信息
|
||||||
type TechnologyEquipment struct {
|
type TechnologyEquipment struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
|
||||||
Local
|
Local
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"`
|
Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"`
|
||||||
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
|
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
|
||||||
Describe string `gorm:"column:describe;type:varchar(255);default:null;comment:描述" json:"describe"`
|
Describe string `gorm:"column:describe;type:varchar(255);default:null;comment:描述" json:"describe"`
|
||||||
|
@ -8,9 +8,8 @@ import (
|
|||||||
// TechnologyInstance 技术文档数据模型
|
// TechnologyInstance 技术文档数据模型
|
||||||
type TechnologyInstance struct {
|
type TechnologyInstance struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
|
||||||
Local
|
Local
|
||||||
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
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"`
|
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"`
|
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"`
|
Company string `gorm:"column:company;type:varchar(30);default:null;comment:单位" json:"company"`
|
||||||
|
@ -8,9 +8,8 @@ import (
|
|||||||
// TechnologyProduct 技术产品数据模型
|
// TechnologyProduct 技术产品数据模型
|
||||||
type TechnologyProduct struct {
|
type TechnologyProduct struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
|
||||||
Local
|
Local
|
||||||
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
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:null;comment:产品名称" json:"title"`
|
||||||
Image
|
Image
|
||||||
Video string `gorm:"column:video;type:varchar(255);default:null;comment:视频地址" json:"video"`
|
Video string `gorm:"column:video;type:varchar(255);default:null;comment:视频地址" json:"video"`
|
||||||
|
@ -8,9 +8,8 @@ import (
|
|||||||
// TechnologyTopic 技术课题数据模型
|
// TechnologyTopic 技术课题数据模型
|
||||||
type TechnologyTopic struct {
|
type TechnologyTopic struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
|
||||||
Local
|
Local
|
||||||
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
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:null;comment:名称" json:"title"`
|
||||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:编号" json:"code"`
|
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"`
|
Emcee string `gorm:"column:emcee;type:varchar(30);default:null;comment:主持人" json:"emcee"`
|
||||||
|
Reference in New Issue
Block a user