diff --git a/app/admin/apis/basic/supplier.go b/app/admin/apis/basic/supplier.go index bb7f67b..528b698 100644 --- a/app/admin/apis/basic/supplier.go +++ b/app/admin/apis/basic/supplier.go @@ -31,6 +31,13 @@ type SupplierCreateRequest struct { } // SupplierCreate 添加供应商 +// @Summary 创建供应商 +// @Tags 供应商管理 +// @Produce json +// @Accept json +// @Param request body SupplierCreateRequest true "供应商模型" +// @Success 200 {object} models.Supplier +// @Router /api/v1/supplier/create [post] func SupplierCreate(c *gin.Context) { req := new(SupplierCreateRequest) if err := c.ShouldBindJSON(&req); err != nil { @@ -79,6 +86,13 @@ type SupplierUpdateRequest struct { } // SupplierUpdate 更新供应商 +// @Summary 更新供应商 +// @Tags 供应商管理 +// @Produce json +// @Accept json +// @Param request body SupplierUpdateRequest true "供应商模型" +// @Success 200 {object} app.Response +// @Router /api/v1/supplier/update [post] func SupplierUpdate(c *gin.Context) { req := new(SupplierUpdateRequest) if err := c.ShouldBindJSON(&req); err != nil { @@ -114,6 +128,13 @@ type SupplierListRequest struct { } // SupplierList 供应商列表 +// @Summary 供应商列表 +// @Tags 供应商管理 +// @Produce json +// @Accept json +// @Param request body SupplierListRequest true "供应商查询模型" +// @Success 200 {array} models.Supplier +// @Router /api/v1/supplier/list [post] func SupplierList(c *gin.Context) { req := new(SupplierListRequest) if err := c.ShouldBindJSON(&req); err != nil { @@ -136,6 +157,12 @@ func SupplierList(c *gin.Context) { } // SupplierDetail 供应商详情 +// @Summary 供应商详情 +// @Tags 供应商管理 +// @Produce json +// @Param id path int true "供应商id" +// @Success 200 {object} models.Supplier +// @Router /api/v1/supplier/detail/{id} [get] func SupplierDetail(c *gin.Context) { id := c.Param("id") @@ -152,6 +179,12 @@ func SupplierDetail(c *gin.Context) { } // SupplierDel 删除供应商 +// @Summary 删除供应商 +// @Tags 供应商管理 +// @Produce json +// @Param id path int true "供应商id" +// @Success 200 {object} app.Response +// @Router /api/v1/supplier/delete/{id} [delete] func SupplierDel(c *gin.Context) { id := c.Param("id") diff --git a/docs/docs.go b/docs/docs.go index 2b407a7..f3309ff 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1924,6 +1924,164 @@ const docTemplate = `{ } } }, + "/api/v1/supplier/create": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "创建供应商", + "parameters": [ + { + "description": "供应商模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/basic.SupplierCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.Supplier" + } + } + } + } + }, + "/api/v1/supplier/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "删除供应商", + "parameters": [ + { + "type": "integer", + "description": "供应商id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/supplier/detail/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "供应商详情", + "parameters": [ + { + "type": "integer", + "description": "供应商id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.Supplier" + } + } + } + } + }, + "/api/v1/supplier/list": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "供应商列表", + "parameters": [ + { + "description": "供应商查询模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/basic.SupplierListRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Supplier" + } + } + } + } + } + }, + "/api/v1/supplier/update": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "更新供应商", + "parameters": [ + { + "description": "供应商模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/basic.SupplierUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, "/api/v1/sys/tables/info": { "put": { "security": [ @@ -2515,6 +2673,175 @@ const docTemplate = `{ } } }, + "basic.SupplierCreateRequest": { + "type": "object", + "required": [ + "address", + "area", + "bank_account", + "city", + "contact", + "name", + "opening_bank", + "payment_cycle", + "province", + "tel" + ], + "properties": { + "account_holder": { + "description": "开户人", + "type": "string" + }, + "address": { + "description": "地址", + "type": "string" + }, + "area": { + "description": "地区", + "type": "string" + }, + "bank_account": { + "description": "银行卡号", + "type": "string" + }, + "city": { + "description": "城市", + "type": "string" + }, + "company_website": { + "description": "网站", + "type": "string" + }, + "contact": { + "description": "联系人", + "type": "string" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "landline": { + "description": "固话", + "type": "string" + }, + "name": { + "description": "供应商名称", + "type": "string" + }, + "opening_bank": { + "description": "开户行", + "type": "string" + }, + "payment_cycle": { + "description": "支付周期", + "type": "integer" + }, + "province": { + "description": "省份", + "type": "string" + }, + "tax_number": { + "description": "税点", + "type": "string" + }, + "tel": { + "description": "手机号", + "type": "string" + } + } + }, + "basic.SupplierListRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "number": { + "type": "string" + } + } + }, + "basic.SupplierUpdateRequest": { + "type": "object", + "required": [ + "address", + "area", + "bank_account", + "city", + "contact", + "id", + "name", + "opening_bank", + "payment_cycle", + "province", + "tel" + ], + "properties": { + "account_holder": { + "description": "开户人", + "type": "string" + }, + "address": { + "description": "地址", + "type": "string" + }, + "area": { + "description": "地区", + "type": "string" + }, + "bank_account": { + "description": "银行卡号", + "type": "string" + }, + "city": { + "description": "城市", + "type": "string" + }, + "company_website": { + "description": "网站", + "type": "string" + }, + "contact": { + "description": "联系人", + "type": "string" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "id": { + "type": "integer" + }, + "landline": { + "description": "固话", + "type": "string" + }, + "name": { + "description": "供应商名称", + "type": "string" + }, + "opening_bank": { + "description": "开户行", + "type": "string" + }, + "payment_cycle": { + "description": "支付周期", + "type": "integer" + }, + "province": { + "description": "省份", + "type": "string" + }, + "tax_number": { + "description": "税点", + "type": "string" + }, + "tel": { + "description": "手机号", + "type": "string" + } + } + }, "models.DictType": { "type": "object", "properties": { @@ -2798,6 +3125,85 @@ const docTemplate = `{ } } }, + "models.Supplier": { + "type": "object", + "properties": { + "account_holder": { + "description": "开户人", + "type": "string" + }, + "address": { + "description": "详细地址", + "type": "string" + }, + "area": { + "description": "区", + "type": "string" + }, + "bank_account": { + "description": "银行账号", + "type": "string" + }, + "city": { + "description": "市", + "type": "string" + }, + "company_website": { + "description": "网站", + "type": "string" + }, + "contact": { + "description": "联系人", + "type": "string" + }, + "cooperative_business_id": { + "description": "合作商id", + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "email": { + "description": "邮件", + "type": "string" + }, + "id": { + "type": "integer" + }, + "landline": { + "description": "固定电话", + "type": "string" + }, + "name": { + "description": "供应商名称", + "type": "string" + }, + "number": { + "description": "编号", + "type": "string" + }, + "opening_bank": { + "description": "开户银行", + "type": "string" + }, + "payment_cycle": { + "description": "支付周期", + "type": "integer" + }, + "province": { + "description": "省", + "type": "string" + }, + "tax_number": { + "description": "税号", + "type": "string" + }, + "tel": { + "description": "手机号", + "type": "string" + } + } + }, "models.SysCategory": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 155c2f1..78d6063 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1916,6 +1916,164 @@ } } }, + "/api/v1/supplier/create": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "创建供应商", + "parameters": [ + { + "description": "供应商模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/basic.SupplierCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.Supplier" + } + } + } + } + }, + "/api/v1/supplier/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "删除供应商", + "parameters": [ + { + "type": "integer", + "description": "供应商id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/supplier/detail/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "供应商详情", + "parameters": [ + { + "type": "integer", + "description": "供应商id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.Supplier" + } + } + } + } + }, + "/api/v1/supplier/list": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "供应商列表", + "parameters": [ + { + "description": "供应商查询模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/basic.SupplierListRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Supplier" + } + } + } + } + } + }, + "/api/v1/supplier/update": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "供应商管理" + ], + "summary": "更新供应商", + "parameters": [ + { + "description": "供应商模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/basic.SupplierUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, "/api/v1/sys/tables/info": { "put": { "security": [ @@ -2507,6 +2665,175 @@ } } }, + "basic.SupplierCreateRequest": { + "type": "object", + "required": [ + "address", + "area", + "bank_account", + "city", + "contact", + "name", + "opening_bank", + "payment_cycle", + "province", + "tel" + ], + "properties": { + "account_holder": { + "description": "开户人", + "type": "string" + }, + "address": { + "description": "地址", + "type": "string" + }, + "area": { + "description": "地区", + "type": "string" + }, + "bank_account": { + "description": "银行卡号", + "type": "string" + }, + "city": { + "description": "城市", + "type": "string" + }, + "company_website": { + "description": "网站", + "type": "string" + }, + "contact": { + "description": "联系人", + "type": "string" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "landline": { + "description": "固话", + "type": "string" + }, + "name": { + "description": "供应商名称", + "type": "string" + }, + "opening_bank": { + "description": "开户行", + "type": "string" + }, + "payment_cycle": { + "description": "支付周期", + "type": "integer" + }, + "province": { + "description": "省份", + "type": "string" + }, + "tax_number": { + "description": "税点", + "type": "string" + }, + "tel": { + "description": "手机号", + "type": "string" + } + } + }, + "basic.SupplierListRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "number": { + "type": "string" + } + } + }, + "basic.SupplierUpdateRequest": { + "type": "object", + "required": [ + "address", + "area", + "bank_account", + "city", + "contact", + "id", + "name", + "opening_bank", + "payment_cycle", + "province", + "tel" + ], + "properties": { + "account_holder": { + "description": "开户人", + "type": "string" + }, + "address": { + "description": "地址", + "type": "string" + }, + "area": { + "description": "地区", + "type": "string" + }, + "bank_account": { + "description": "银行卡号", + "type": "string" + }, + "city": { + "description": "城市", + "type": "string" + }, + "company_website": { + "description": "网站", + "type": "string" + }, + "contact": { + "description": "联系人", + "type": "string" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "id": { + "type": "integer" + }, + "landline": { + "description": "固话", + "type": "string" + }, + "name": { + "description": "供应商名称", + "type": "string" + }, + "opening_bank": { + "description": "开户行", + "type": "string" + }, + "payment_cycle": { + "description": "支付周期", + "type": "integer" + }, + "province": { + "description": "省份", + "type": "string" + }, + "tax_number": { + "description": "税点", + "type": "string" + }, + "tel": { + "description": "手机号", + "type": "string" + } + } + }, "models.DictType": { "type": "object", "properties": { @@ -2790,6 +3117,85 @@ } } }, + "models.Supplier": { + "type": "object", + "properties": { + "account_holder": { + "description": "开户人", + "type": "string" + }, + "address": { + "description": "详细地址", + "type": "string" + }, + "area": { + "description": "区", + "type": "string" + }, + "bank_account": { + "description": "银行账号", + "type": "string" + }, + "city": { + "description": "市", + "type": "string" + }, + "company_website": { + "description": "网站", + "type": "string" + }, + "contact": { + "description": "联系人", + "type": "string" + }, + "cooperative_business_id": { + "description": "合作商id", + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "email": { + "description": "邮件", + "type": "string" + }, + "id": { + "type": "integer" + }, + "landline": { + "description": "固定电话", + "type": "string" + }, + "name": { + "description": "供应商名称", + "type": "string" + }, + "number": { + "description": "编号", + "type": "string" + }, + "opening_bank": { + "description": "开户银行", + "type": "string" + }, + "payment_cycle": { + "description": "支付周期", + "type": "integer" + }, + "province": { + "description": "省", + "type": "string" + }, + "tax_number": { + "description": "税号", + "type": "string" + }, + "tel": { + "description": "手机号", + "type": "string" + } + } + }, "models.SysCategory": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 5a6fb6c..a403388 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -23,6 +23,134 @@ definitions: requestId: type: string type: object + basic.SupplierCreateRequest: + properties: + account_holder: + description: 开户人 + type: string + address: + description: 地址 + type: string + area: + description: 地区 + type: string + bank_account: + description: 银行卡号 + type: string + city: + description: 城市 + type: string + company_website: + description: 网站 + type: string + contact: + description: 联系人 + type: string + email: + description: 邮箱 + type: string + landline: + description: 固话 + type: string + name: + description: 供应商名称 + type: string + opening_bank: + description: 开户行 + type: string + payment_cycle: + description: 支付周期 + type: integer + province: + description: 省份 + type: string + tax_number: + description: 税点 + type: string + tel: + description: 手机号 + type: string + required: + - address + - area + - bank_account + - city + - contact + - name + - opening_bank + - payment_cycle + - province + - tel + type: object + basic.SupplierListRequest: + properties: + name: + type: string + number: + type: string + type: object + basic.SupplierUpdateRequest: + properties: + account_holder: + description: 开户人 + type: string + address: + description: 地址 + type: string + area: + description: 地区 + type: string + bank_account: + description: 银行卡号 + type: string + city: + description: 城市 + type: string + company_website: + description: 网站 + type: string + contact: + description: 联系人 + type: string + email: + description: 邮箱 + type: string + id: + type: integer + landline: + description: 固话 + type: string + name: + description: 供应商名称 + type: string + opening_bank: + description: 开户行 + type: string + payment_cycle: + description: 支付周期 + type: integer + province: + description: 省份 + type: string + tax_number: + description: 税点 + type: string + tel: + description: 手机号 + type: string + required: + - address + - area + - bank_account + - city + - contact + - id + - name + - opening_bank + - payment_cycle + - province + - tel + type: object models.DictType: properties: createBy: @@ -220,6 +348,64 @@ definitions: updatedAt: type: string type: object + models.Supplier: + properties: + account_holder: + description: 开户人 + type: string + address: + description: 详细地址 + type: string + area: + description: 区 + type: string + bank_account: + description: 银行账号 + type: string + city: + description: 市 + type: string + company_website: + description: 网站 + type: string + contact: + description: 联系人 + type: string + cooperative_business_id: + description: 合作商id + type: integer + createdAt: + type: string + email: + description: 邮件 + type: string + id: + type: integer + landline: + description: 固定电话 + type: string + name: + description: 供应商名称 + type: string + number: + description: 编号 + type: string + opening_bank: + description: 开户银行 + type: string + payment_cycle: + description: 支付周期 + type: integer + province: + description: 省 + type: string + tax_number: + description: 税号 + type: string + tel: + description: 手机号 + type: string + type: object models.SysCategory: properties: createBy: @@ -1996,6 +2182,107 @@ paths: summary: 系统信息 tags: - system/系统信息 + /api/v1/supplier/create: + post: + consumes: + - application/json + parameters: + - description: 供应商模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/basic.SupplierCreateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.Supplier' + summary: 创建供应商 + tags: + - 供应商管理 + /api/v1/supplier/delete/{id}: + delete: + parameters: + - description: 供应商id + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/app.Response' + summary: 删除供应商 + tags: + - 供应商管理 + /api/v1/supplier/detail/{id}: + get: + parameters: + - description: 供应商id + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.Supplier' + summary: 供应商详情 + tags: + - 供应商管理 + /api/v1/supplier/list: + post: + consumes: + - application/json + parameters: + - description: 供应商查询模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/basic.SupplierListRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/models.Supplier' + type: array + summary: 供应商列表 + tags: + - 供应商管理 + /api/v1/supplier/update: + post: + consumes: + - application/json + parameters: + - description: 供应商模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/basic.SupplierUpdateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/app.Response' + summary: 更新供应商 + tags: + - 供应商管理 /api/v1/sys/tables/info: post: consumes: