feat:完善项目
This commit is contained in:
@ -152,7 +152,15 @@ func (*Manage) Equipment(c *gin.Context) {
|
||||
* }
|
||||
*/
|
||||
func (*Manage) EquipmentSelect(c *gin.Context) {
|
||||
data, err := manage.NewEquipment()(getSession()(c).(*service.Session)).Select()
|
||||
form := &struct {
|
||||
ParentID string `json:"parent_id" form:"parent_id"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
obj := &IDStringForm{ID: form.ParentID}
|
||||
data, err := manage.NewEquipment()(getSession()(c).(*service.Session)).Select(obj.Convert())
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -335,6 +343,52 @@ func (*Manage) EquipmentDelete(c *gin.Context) {
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentMaterial(c *gin.Context) {
|
||||
form := &struct {
|
||||
EquipmentID string `json:"equipment_id" form:"equipment_id" binding:"required"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewEquipmentMaterial()(getSession()(c).(*service.Session)).
|
||||
List((&IDStringForm{ID: form.EquipmentID}).Convert())
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentMaterialBind(c *gin.Context) {
|
||||
form := &struct {
|
||||
EquipmentID string `json:"equipment_id" form:"equipment_id" binding:"required"`
|
||||
MaterialIDs []string `json:"material_ids" form:"material_ids"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
materialIDs := make([]uint64, 0)
|
||||
obj := new(IDStringForm)
|
||||
|
||||
for _, v := range form.MaterialIDs {
|
||||
obj.ID = v
|
||||
materialIDs = append(materialIDs, obj.Convert())
|
||||
}
|
||||
err := manage.NewEquipmentMaterial()(getSession()(c).(*service.Session)).Bind(&manage.EquipmentMaterialBindParams{
|
||||
EquipmentID: (&IDStringForm{ID: form.EquipmentID}).Convert(), MaterialIDs: materialIDs,
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentMaterialDelete(c *gin.Context) {
|
||||
form := new(IDStringForm)
|
||||
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipmentMaterial()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/manage/material 器材信息
|
||||
* @apiVersion 1.0.0
|
||||
@ -716,13 +770,14 @@ func (*Manage) MaterialSupplierDelete(c *gin.Context) {
|
||||
*/
|
||||
func (*Manage) Notice(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
PageForm
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewNotice()(getSession()(c).(*service.Session)).List(form.Page, form.PageSize)
|
||||
data, err := manage.NewNotice()(getSession()(c).(*service.Session)).List(form.Title, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user