| | |
| | | package test |
| | | |
| | | import ( |
| | | "github.com/flipped-aurora/gin-vue-admin/server/global" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/model/common/request" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/model/test" |
| | | testReq "github.com/flipped-aurora/gin-vue-admin/server/model/test/request" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/service" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/utils" |
| | | "github.com/gin-gonic/gin" |
| | | "go.uber.org/zap" |
| | | "srm/global" |
| | | "srm/model/common/request" |
| | | "srm/model/common/response" |
| | | "srm/model/test" |
| | | testReq "srm/model/test/request" |
| | | "srm/service" |
| | | "srm/utils" |
| | | ) |
| | | |
| | | type SupplierApi struct { |
| | |
| | | // @Produce application/json |
| | | // @Param data body test.Supplier true "创建Supplier" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" |
| | | // @Router /api/s/createSupplier [post] |
| | | // @Router /s/createSupplier [post] |
| | | func (sApi *SupplierApi) CreateSupplier(c *gin.Context) { |
| | | var s test.Supplier |
| | | err := c.ShouldBindJSON(&s) |
| | | if err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | return |
| | | } |
| | | verify := utils.Rules{ |
| | | "Name": {utils.NotEmpty()}, |
| | | "ResponsiblePersonId": {utils.NotEmpty()}, |
| | | } |
| | | if err := utils.Verify(s, verify); err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | return |
| | | } |
| | |
| | | // @Produce application/json |
| | | // @Param data body test.Supplier true "删除Supplier" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" |
| | | // @Router /api/s/deleteSupplier [delete] |
| | | // @Router /s/deleteSupplier [delete] |
| | | func (sApi *SupplierApi) DeleteSupplier(c *gin.Context) { |
| | | var s test.Supplier |
| | | err := c.ShouldBindJSON(&s) |
| | |
| | | // @Produce application/json |
| | | // @Param data body request.IdsReq true "批量删除Supplier" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}" |
| | | // @Router /api/s/deleteSupplierByIds [delete] |
| | | // @Router /s/deleteSupplierByIds [delete] |
| | | func (sApi *SupplierApi) DeleteSupplierByIds(c *gin.Context) { |
| | | var IDS request.IdsReq |
| | | err := c.ShouldBindJSON(&IDS) |
| | |
| | | // @Produce application/json |
| | | // @Param data body test.Supplier true "更新Supplier" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" |
| | | // @Router /api/s/updateSupplier [put] |
| | | // @Router /s/updateSupplier [put] |
| | | func (sApi *SupplierApi) UpdateSupplier(c *gin.Context) { |
| | | var s test.Supplier |
| | | err := c.ShouldBindJSON(&s) |
| | |
| | | // @Produce application/json |
| | | // @Param data query test.Supplier true "用id查询Supplier" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" |
| | | // @Router /api/s/findSupplier [get] |
| | | // @Router /s/findSupplier [get] |
| | | func (sApi *SupplierApi) FindSupplier(c *gin.Context) { |
| | | var s test.Supplier |
| | | err := c.ShouldBindQuery(&s) |
| | |
| | | // @Produce application/json |
| | | // @Param data query testReq.SupplierSearch true "分页获取Supplier列表" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" |
| | | // @Router /api/s/getSupplierList [get] |
| | | // @Router /s/getSupplierList [get] |
| | | func (sApi *SupplierApi) GetSupplierList(c *gin.Context) { |
| | | var pageInfo testReq.SupplierSearch |
| | | err := c.ShouldBindQuery(&pageInfo) |
| | |
| | | // @Produce application/json |
| | | // @Param data body testReq.SupplierStatus true "修改Supplier状态" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" |
| | | // @Router /api/s/changeSupplierStatus [post] |
| | | // @Router /s/changeSupplierStatus [post] |
| | | func (sApi *SupplierApi) ChangeSupplierStatus(c *gin.Context) { |
| | | var params testReq.SupplierStatus |
| | | err := c.ShouldBindJSON(¶ms) |