feat:完善项目
This commit is contained in:
@ -134,7 +134,7 @@ func (*Manage) EquipmentSelect(c *gin.Context) {
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {String} [id="''"] 区域标识
|
||||
* @apiParam {String} id ID
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {String} data.id ID
|
||||
@ -325,3 +325,120 @@ func (*Manage) MaterialDelete(c *gin.Context) {
|
||||
err := manage.NewMaterial()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/manage/material/supplier/select 器材供应商信息
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName ManageMaterialSupplierSelect
|
||||
* @apiGroup Manage
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {String} material_id 器材ID
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {String} data.id ID
|
||||
* @apiSuccess (200) {String} data.supplier_name 供应商名称
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "EgmJ4Ga7LQ",
|
||||
* "supplier_name": "供应商名称",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Manage) MaterialSupplierSelect(c *gin.Context) {
|
||||
form := &struct {
|
||||
MaterialID string `json:"material_id" form:"material_id" binding:"required"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
obj := &IDStringForm{ID: form.MaterialID}
|
||||
data, err := manage.NewMaterialSuppler()(getSession()(c).(*service.Session)).Select(obj.Convert())
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/manage/material/supplier/bind 器材供应商绑定
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName ManageMaterialSupplierBind
|
||||
* @apiGroup Manage
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {String} material_id 器材ID
|
||||
* @apiParam {String} supplier_id 供应商ID
|
||||
* @apiParam {Float} stock 库存数
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": null
|
||||
* }
|
||||
*/
|
||||
func (*Manage) MaterialSupplierBind(c *gin.Context) {
|
||||
form := &struct {
|
||||
MaterialID string `json:"material_id" form:"material_id" binding:"required"`
|
||||
SupplierID string `json:"supplier_id" form:"supplier_id" binding:"required"`
|
||||
Stock float64 `json:"stock" form:"stock"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
obj := &IDStringForm{ID: form.MaterialID}
|
||||
materialID := obj.Convert()
|
||||
obj.ID = form.SupplierID
|
||||
supplierID := obj.Convert()
|
||||
err := manage.NewMaterialSuppler()(getSession()(c).(*service.Session)).Form(materialID, supplierID, form.Stock)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/manage/material/supplier/delete 器材供应商删除
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName ManageMaterialSupplierDelete
|
||||
* @apiGroup Manage
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {String} id ID
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": null
|
||||
* }
|
||||
*/
|
||||
func (*Manage) MaterialSupplierDelete(c *gin.Context) {
|
||||
form := new(IDStringForm)
|
||||
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewMaterialSuppler()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
Reference in New Issue
Block a user