feat:优化项目信息,增加用户器材信息管理
This commit is contained in:
@ -20,6 +20,14 @@ type (
|
|||||||
Papers []string `json:"papers" form:"papers"`
|
Papers []string `json:"papers" form:"papers"`
|
||||||
Patents []string `json:"patents" form:"patents"`
|
Patents []string `json:"patents" form:"patents"`
|
||||||
}
|
}
|
||||||
|
// equipmentForm 设备信息
|
||||||
|
equipmentForm struct {
|
||||||
|
Kind int `json:"kind" form:"kind" binding:"required"`
|
||||||
|
Code string `json:"code" form:"code" binding:"required"`
|
||||||
|
Title string `json:"title" form:"title" binding:"required"`
|
||||||
|
Params string `json:"params" form:"params"`
|
||||||
|
Description string `json:"description" form:"description"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *enterpriseForm) paperInfo() []uint64 {
|
func (a *enterpriseForm) paperInfo() []uint64 {
|
||||||
@ -100,3 +108,59 @@ func (*Manage) EnterpriseDelete(c *gin.Context) {
|
|||||||
Delete(form.Convert())
|
Delete(form.Convert())
|
||||||
api.APIResponse(err)(c)
|
api.APIResponse(err)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*Manage) Equipment(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
Kind int `json:"kind" form:"kind"`
|
||||||
|
Code string `json:"code" form:"code"`
|
||||||
|
Title string `json:"title" form:"title"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
List(form.Kind, form.Code, form.Title, form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) EquipmentAdd(c *gin.Context) {
|
||||||
|
form := new(equipmentForm)
|
||||||
|
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Form(&manage.EquipmentParams{Kind: form.Kind, Code: form.Code, Title: form.Title, Params: form.Params, Description: form.Description})
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) EquipmentEdit(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
api.IDStringForm
|
||||||
|
equipmentForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Form(&manage.EquipmentParams{ID: form.Convert(), Kind: form.Kind, Code: form.Code, Title: form.Title,
|
||||||
|
Params: form.Params, Description: form.Description})
|
||||||
|
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) EquipmentDelete(c *gin.Context) {
|
||||||
|
form := new(api.IDStringForm)
|
||||||
|
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Delete(form.Convert())
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
@ -88,12 +88,6 @@ type (
|
|||||||
Kind int `json:"kind" form:"kind" binding:"required"`
|
Kind int `json:"kind" form:"kind" binding:"required"`
|
||||||
Keywords []string `json:"keywords" form:"keywords"`
|
Keywords []string `json:"keywords" form:"keywords"`
|
||||||
}
|
}
|
||||||
// equipmentForm 设备参数
|
|
||||||
equipmentForm struct {
|
|
||||||
Title string `json:"title" form:"title" binding:"required"`
|
|
||||||
Research string `json:"research" form:"research" binding:"required"`
|
|
||||||
Describe string `json:"describe" form:"describe"`
|
|
||||||
}
|
|
||||||
// productForm 产品参数
|
// productForm 产品参数
|
||||||
productForm struct {
|
productForm struct {
|
||||||
Title string `json:"title" form:"title" binding:"required"`
|
Title string `json:"title" form:"title" binding:"required"`
|
||||||
@ -494,58 +488,6 @@ func (a *Technology) TopicDelete(c *gin.Context) {
|
|||||||
api.APIResponse(err)(c)
|
api.APIResponse(err)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Technology) Equipment(c *gin.Context) {
|
|
||||||
form := &struct {
|
|
||||||
Title string `json:"title" form:"title"`
|
|
||||||
api.PageForm
|
|
||||||
}{}
|
|
||||||
if err := api.Bind(form)(c); err != nil {
|
|
||||||
api.APIFailure(err.(error))(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
|
||||||
List(form.Title, form.Page, form.PageSize)
|
|
||||||
api.APIResponse(err, data)(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Technology) EquipmentAdd(c *gin.Context) {
|
|
||||||
form := new(equipmentForm)
|
|
||||||
|
|
||||||
if err := api.Bind(form)(c); err != nil {
|
|
||||||
api.APIFailure(err.(error))(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
|
||||||
Form(&technology2.EquipmentParams{Title: form.Title, Research: form.Research, Describe: form.Describe})
|
|
||||||
api.APIResponse(err)(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Technology) EquipmentEdit(c *gin.Context) {
|
|
||||||
form := &struct {
|
|
||||||
api.IDStringForm
|
|
||||||
equipmentForm
|
|
||||||
}{}
|
|
||||||
if err := api.Bind(form)(c); err != nil {
|
|
||||||
api.APIFailure(err.(error))(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
|
||||||
Form(&technology2.EquipmentParams{ID: form.Convert(), Title: form.Title, Research: form.Research, Describe: form.Describe})
|
|
||||||
api.APIResponse(err)(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Technology) EquipmentDelete(c *gin.Context) {
|
|
||||||
form := new(api.IDStringForm)
|
|
||||||
|
|
||||||
if err := api.Bind(form)(c); err != nil {
|
|
||||||
api.APIFailure(err.(error))(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
|
||||||
Delete(form.Convert())
|
|
||||||
api.APIResponse(err)(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Technology) Product(c *gin.Context) {
|
func (*Technology) Product(c *gin.Context) {
|
||||||
form := &struct {
|
form := &struct {
|
||||||
Title string `json:"title" form:"title"`
|
Title string `json:"title" form:"title"`
|
||||||
|
@ -98,6 +98,8 @@ func (c *Enterprise) Form(params *EnterpriseParams) error {
|
|||||||
if mUserCooperateEnterprise.ID > 0 {
|
if mUserCooperateEnterprise.ID > 0 {
|
||||||
return model2.Updates(mUserCooperateEnterprise.UserCooperateEnterprise, mUserCooperateEnterprise.UserCooperateEnterprise)
|
return model2.Updates(mUserCooperateEnterprise.UserCooperateEnterprise, mUserCooperateEnterprise.UserCooperateEnterprise)
|
||||||
}
|
}
|
||||||
|
mUserCooperateEnterprise.Local.Local = c.local
|
||||||
|
mUserCooperateEnterprise.UID = c.UID
|
||||||
return model2.Create(mUserCooperateEnterprise.UserCooperateEnterprise)
|
return model2.Create(mUserCooperateEnterprise.UserCooperateEnterprise)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
126
app/api/enterprise/controller/manage/equipment.go
Normal file
126
app/api/enterprise/controller/manage/equipment.go
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package manage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/enterprise/model"
|
||||||
|
"SciencesServer/app/basic/controller"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/session"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Equipment 设备信息
|
||||||
|
type Equipment struct {
|
||||||
|
*session.Enterprise
|
||||||
|
local string
|
||||||
|
}
|
||||||
|
|
||||||
|
type EquipmentHandle func(session *session.Enterprise, local string) *Equipment
|
||||||
|
|
||||||
|
type (
|
||||||
|
EquipmentInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model2.ManageEquipment
|
||||||
|
}
|
||||||
|
EquipmentParams struct {
|
||||||
|
ID uint64
|
||||||
|
Kind int
|
||||||
|
Code, Title, Params, Description string
|
||||||
|
PurchaseAt string
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// List 列表信息
|
||||||
|
func (c *Equipment) List(kind int, code, title string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mManageEquipment := model.NewManageEquipment()
|
||||||
|
|
||||||
|
where := []*model2.ModelWhereOrder{
|
||||||
|
&model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhere("local", c.local),
|
||||||
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
|
},
|
||||||
|
&model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhere("uid", c.UID),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if kind > 0 {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhere("kind", kind)})
|
||||||
|
}
|
||||||
|
if code != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("code", code)})
|
||||||
|
}
|
||||||
|
if title != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
|
||||||
|
}
|
||||||
|
out := make([]*model2.ManageEquipment, 0)
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
if err := model2.Pages(mManageEquipment.ManageEquipment, &out, page, pageSize, &count, where...); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*EquipmentInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &EquipmentInfo{
|
||||||
|
ID: v.GetEncodeID(), ManageEquipment: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form 数据操作
|
||||||
|
func (c *Equipment) Form(params *EquipmentParams) error {
|
||||||
|
mManageEquipment := model.NewManageEquipment()
|
||||||
|
|
||||||
|
if params.ID > 0 {
|
||||||
|
mManageEquipment.ID = params.ID
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mManageEquipment.ManageEquipment, []string{"id", "uid", "created_at"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,器材信息不存在或已被删除")
|
||||||
|
} else if mManageEquipment.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mManageEquipment.Kind = model2.ManageEquipmentKind(params.Kind)
|
||||||
|
mManageEquipment.Code = params.Code
|
||||||
|
mManageEquipment.Title = params.Title
|
||||||
|
mManageEquipment.Params = params.Params
|
||||||
|
mManageEquipment.Description = params.Description
|
||||||
|
|
||||||
|
if mManageEquipment.ID > 0 {
|
||||||
|
return model2.Updates(mManageEquipment.ManageEquipment, mManageEquipment.ManageEquipment)
|
||||||
|
}
|
||||||
|
mManageEquipment.Local.Local = c.local
|
||||||
|
mManageEquipment.UID = c.UID
|
||||||
|
return model2.Create(mManageEquipment.ManageEquipment)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete 删除操作
|
||||||
|
func (c *Equipment) Delete(id uint64) error {
|
||||||
|
mManageEquipment := model.NewManageEquipment()
|
||||||
|
mManageEquipment.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mManageEquipment.ManageEquipment, []string{"id", "uid", "created_at"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,器材信息不存在或已被删除")
|
||||||
|
} else if mManageEquipment.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
}
|
||||||
|
return model2.Delete(mManageEquipment.ManageEquipment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEquipment() EquipmentHandle {
|
||||||
|
return func(session *session.Enterprise, local string) *Equipment {
|
||||||
|
return &Equipment{
|
||||||
|
Enterprise: session,
|
||||||
|
local: local,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,113 +0,0 @@
|
|||||||
package technology
|
|
||||||
|
|
||||||
import (
|
|
||||||
"SciencesServer/app/api/enterprise/model"
|
|
||||||
"SciencesServer/app/api/manage/controller"
|
|
||||||
model2 "SciencesServer/app/common/model"
|
|
||||||
"SciencesServer/app/session"
|
|
||||||
"errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Equipment 技术设备
|
|
||||||
type Equipment struct {
|
|
||||||
*session.Enterprise
|
|
||||||
local string
|
|
||||||
}
|
|
||||||
|
|
||||||
type EquipmentHandle func(session *session.Enterprise, local string) *Equipment
|
|
||||||
|
|
||||||
type EquipmentParams struct {
|
|
||||||
ID uint64
|
|
||||||
Title, Research, Describe string
|
|
||||||
}
|
|
||||||
|
|
||||||
type EquipmentInfo struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
*model2.TechnologyEquipment
|
|
||||||
}
|
|
||||||
|
|
||||||
// List 列表信息
|
|
||||||
func (c *Equipment) List(title string, page, pageSize int) (*controller.ReturnPages, error) {
|
|
||||||
mTechnologyEquipment := model.NewTechnologyEquipment()
|
|
||||||
|
|
||||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhere("local", c.local),
|
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
|
||||||
}, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhere("uid", c.UID),
|
|
||||||
}}
|
|
||||||
|
|
||||||
if title != "" {
|
|
||||||
where = append(where, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhereLike("title", title),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
out := make([]*model2.TechnologyEquipment, 0)
|
|
||||||
|
|
||||||
var count int64
|
|
||||||
|
|
||||||
if err := model2.Pages(mTechnologyEquipment.TechnologyEquipment, &out, page, pageSize, &count, where...); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
list := make([]*EquipmentInfo, 0)
|
|
||||||
|
|
||||||
for _, v := range out {
|
|
||||||
list = append(list, &EquipmentInfo{
|
|
||||||
ID: v.GetEncodeID(), TechnologyEquipment: v,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Equipment) Form(params *EquipmentParams) error {
|
|
||||||
mTechnologyEquipment := model.NewTechnologyEquipment()
|
|
||||||
|
|
||||||
if params.ID > 0 {
|
|
||||||
mTechnologyEquipment.ID = params.ID
|
|
||||||
|
|
||||||
isExist, err := model2.First(mTechnologyEquipment.TechnologyEquipment)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
} else if !isExist {
|
|
||||||
return errors.New("操作错误,设备信息不存在")
|
|
||||||
} else if mTechnologyEquipment.Local.Local != c.local {
|
|
||||||
return errors.New("无权限操作")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mTechnologyEquipment.Title = params.Title
|
|
||||||
mTechnologyEquipment.Research = params.Research
|
|
||||||
mTechnologyEquipment.Describe = params.Describe
|
|
||||||
|
|
||||||
if mTechnologyEquipment.ID > 0 {
|
|
||||||
return model2.Updates(mTechnologyEquipment.TechnologyEquipment, mTechnologyEquipment.TechnologyEquipment)
|
|
||||||
}
|
|
||||||
mTechnologyEquipment.UID = c.UID
|
|
||||||
return model2.Create(mTechnologyEquipment.TechnologyEquipment)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete 删除操作
|
|
||||||
func (c *Equipment) Delete(id uint64) error {
|
|
||||||
mTechnologyEquipment := model.NewTechnologyEquipment()
|
|
||||||
mTechnologyEquipment.ID = id
|
|
||||||
|
|
||||||
isExist, err := model2.First(mTechnologyEquipment.TechnologyEquipment)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
} else if !isExist {
|
|
||||||
return errors.New("操作错误,设备信息不存在或已被删除")
|
|
||||||
} else if mTechnologyEquipment.UID != c.UID {
|
|
||||||
return errors.New("无权限操作")
|
|
||||||
}
|
|
||||||
return model2.Delete(mTechnologyEquipment.TechnologyEquipment)
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewEquipment() EquipmentHandle {
|
|
||||||
return func(session *session.Enterprise, local string) *Equipment {
|
|
||||||
return &Equipment{
|
|
||||||
Enterprise: session,
|
|
||||||
local: local,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,7 +44,7 @@ func (c *Bank) List() ([]*BankInfo, error) {
|
|||||||
out := make([]*model2.UserManageBank, 0)
|
out := make([]*model2.UserManageBank, 0)
|
||||||
|
|
||||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("uid", c.ManageUID),
|
Where: model2.NewWhere("uid", c.UID),
|
||||||
Order: model2.NewOrder("is_default", model2.OrderModeToDesc),
|
Order: model2.NewOrder("is_default", model2.OrderModeToDesc),
|
||||||
}}
|
}}
|
||||||
if err := model2.Find(mUserManageBank.UserManageBank, &out, where...); err != nil {
|
if err := model2.Find(mUserManageBank.UserManageBank, &out, where...); err != nil {
|
||||||
@ -84,13 +84,13 @@ func (c *Bank) Bind(params *BankParams, captcha string) error {
|
|||||||
} else if count > 0 {
|
} else if count > 0 {
|
||||||
return errors.New("当前银行卡已被注册")
|
return errors.New("当前银行卡已被注册")
|
||||||
}
|
}
|
||||||
mUserManageBank.MUid = c.ManageUID
|
mUserManageBank.UID = c.UID
|
||||||
mUserManageBank.Name = params.Name
|
mUserManageBank.Name = params.Name
|
||||||
mUserManageBank.IDCard = params.IDCard
|
mUserManageBank.IDCard = params.IDCard
|
||||||
mUserManageBank.BankCard = params.BankCard
|
mUserManageBank.BankCard = params.BankCard
|
||||||
mUserManageBank.BankName = params.BankName
|
mUserManageBank.BankName = params.BankName
|
||||||
|
|
||||||
if err = model2.Count(mUserManageBank.UserManageBank, &count, model2.NewWhere("uid", c.ManageUID)); err != nil {
|
if err = model2.Count(mUserManageBank.UserManageBank, &count, model2.NewWhere("uid", c.UID)); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if count <= 0 {
|
} else if count <= 0 {
|
||||||
mUserManageBank.IsDefault = model2.UserManageBankDefaultForYes
|
mUserManageBank.IsDefault = model2.UserManageBankDefaultForYes
|
||||||
@ -109,7 +109,7 @@ func (c *Bank) Unbind(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,绑定信息不存在")
|
return errors.New("操作错误,绑定信息不存在")
|
||||||
} else if mUserManageBank.MUid != c.ManageUID {
|
} else if mUserManageBank.UID != c.UID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mUserManageBank)
|
return model2.Delete(mUserManageBank)
|
||||||
|
11
app/api/enterprise/model/manage_equipment.go
Normal file
11
app/api/enterprise/model/manage_equipment.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type ManageEquipment struct {
|
||||||
|
*model.ManageEquipment
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManageEquipment() *ManageEquipment {
|
||||||
|
return &ManageEquipment{model.NewManageEquipment()}
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import "SciencesServer/app/common/model"
|
|
||||||
|
|
||||||
type TechnologyEquipment struct {
|
|
||||||
*model.TechnologyEquipment
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTechnologyEquipment() *TechnologyEquipment {
|
|
||||||
return &TechnologyEquipment{model.NewTechnologyEquipment()}
|
|
||||||
}
|
|
34
app/common/model/manage_equipment.go
Normal file
34
app/common/model/manage_equipment.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// ManageEquipment 器材数据模型管理
|
||||||
|
type ManageEquipment struct {
|
||||||
|
Model
|
||||||
|
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"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// ManageEquipmentKind 器材类型
|
||||||
|
type ManageEquipmentKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ManageEquipmentKindForExperiment 实验器材
|
||||||
|
ManageEquipmentKindForExperiment ManageEquipmentKind = iota + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *ManageEquipment) TableName() string {
|
||||||
|
return "manage_equipment"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManageEquipment() *ManageEquipment {
|
||||||
|
return &ManageEquipment{}
|
||||||
|
}
|
@ -8,7 +8,6 @@ import (
|
|||||||
// ManageExpert 专家入驻信息管理
|
// ManageExpert 专家入驻信息管理
|
||||||
type ManageExpert struct {
|
type ManageExpert struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
Area
|
Area
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
// ManageLaboratory 实验室信息管理
|
// ManageLaboratory 实验室信息管理
|
||||||
type ManageLaboratory struct {
|
type ManageLaboratory struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
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"`
|
Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"`
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
// TechnologyEquipment 技术设备管理信息
|
|
||||||
type TechnologyEquipment struct {
|
|
||||||
Model
|
|
||||||
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"`
|
|
||||||
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"`
|
|
||||||
ModelDeleted
|
|
||||||
ModelAt
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TechnologyEquipment) TableName() string {
|
|
||||||
return m.NewTableName("technology_equipment")
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTechnologyEquipment() *TechnologyEquipment {
|
|
||||||
return &TechnologyEquipment{}
|
|
||||||
}
|
|
@ -3,8 +3,7 @@ package model
|
|||||||
// UserManageBank 用户银行卡管理
|
// UserManageBank 用户银行卡管理
|
||||||
type UserManageBank struct {
|
type UserManageBank struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
|
||||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"`
|
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"`
|
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"`
|
BankCard string `gorm:"column:bank_card;type:varchar(18);default:null;comment:银行卡号" json:"bank_card"`
|
||||||
|
@ -176,10 +176,6 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
technologyV1.POST("/topic/add", _api.TopicAdd)
|
technologyV1.POST("/topic/add", _api.TopicAdd)
|
||||||
technologyV1.POST("/topic/edit", _api.TopicEdit)
|
technologyV1.POST("/topic/edit", _api.TopicEdit)
|
||||||
technologyV1.POST("/topic/delete", _api.TopicDelete)
|
technologyV1.POST("/topic/delete", _api.TopicDelete)
|
||||||
technologyV1.POST("/equipment", _api.Equipment)
|
|
||||||
technologyV1.POST("/equipment/add", _api.EquipmentAdd)
|
|
||||||
technologyV1.POST("/equipment/edit", _api.EquipmentEdit)
|
|
||||||
technologyV1.POST("/equipment/delete", _api.EquipmentDelete)
|
|
||||||
technologyV1.POST("/product", _api.Product)
|
technologyV1.POST("/product", _api.Product)
|
||||||
technologyV1.POST("/product/add", _api.ProductAdd)
|
technologyV1.POST("/product/add", _api.ProductAdd)
|
||||||
technologyV1.POST("/product/edit", _api.ProductEdit)
|
technologyV1.POST("/product/edit", _api.ProductEdit)
|
||||||
@ -209,6 +205,10 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
manageV1.POST("/enterprise/add", _api.EnterpriseAdd)
|
manageV1.POST("/enterprise/add", _api.EnterpriseAdd)
|
||||||
manageV1.POST("/enterprise/edit", _api.EnterpriseEdit)
|
manageV1.POST("/enterprise/edit", _api.EnterpriseEdit)
|
||||||
manageV1.POST("/enterprise/delete", _api.EnterpriseDelete)
|
manageV1.POST("/enterprise/delete", _api.EnterpriseDelete)
|
||||||
|
manageV1.POST("/equipment", _api.Equipment)
|
||||||
|
manageV1.POST("/equipment/add", _api.EquipmentAdd)
|
||||||
|
manageV1.POST("/equipment/edit", _api.EquipmentEdit)
|
||||||
|
manageV1.POST("/equipment/delete", _api.EquipmentDelete)
|
||||||
}
|
}
|
||||||
// Identity 身份信息
|
// Identity 身份信息
|
||||||
identityV1 := v1.Group("/config")
|
identityV1 := v1.Group("/config")
|
||||||
|
Reference in New Issue
Block a user