Browse Source

fix bug

main
梁俊景 4 years ago
parent
commit
cb3adddce1
  1. 6
      server/api/v1/sys_operation_record.go
  2. 2
      server/model/request/common.go
  3. 6
      server/resource/template/server/api.go.tpl

6
server/api/v1/sys_operation_record.go

@ -36,7 +36,7 @@ func CreateSysOperationRecord(c *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @accept application/json // @accept application/json
// @Produce application/json // @Produce application/json
// @Param data body request.GetByIdUnit true "SysOperationRecord模型"
// @Param data body request.GetByIdUint true "SysOperationRecord模型"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /sysOperationRecord/deleteSysOperationRecord [delete] // @Router /sysOperationRecord/deleteSysOperationRecord [delete]
func DeleteSysOperationRecord(c *gin.Context) { func DeleteSysOperationRecord(c *gin.Context) {
@ -74,11 +74,11 @@ func DeleteSysOperationRecordByIds(c *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @accept application/json // @accept application/json
// @Produce application/json // @Produce application/json
// @Param data query request.GetByIdUnit false "编号"
// @Param data query request.GetByIdUint false "编号"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /sysOperationRecord/findSysOperationRecord [get] // @Router /sysOperationRecord/findSysOperationRecord [get]
func FindSysOperationRecord(c *gin.Context) { func FindSysOperationRecord(c *gin.Context) {
var sysOperationRecord request.GetByIdUnit
var sysOperationRecord request.GetByIdUint
_ = c.ShouldBindQuery(&sysOperationRecord) _ = c.ShouldBindQuery(&sysOperationRecord)
if err := utils.Verify(sysOperationRecord, utils.IdVerify); err != nil { if err := utils.Verify(sysOperationRecord, utils.IdVerify); err != nil {
response.FailWithMessage(err.Error(), c) response.FailWithMessage(err.Error(), c)

2
server/model/request/common.go

@ -12,7 +12,7 @@ type GetById struct {
} }
// Find by id structure // Find by id structure
type GetByIdUnit struct {
type GetByIdUint struct {
Id uint `json:"id" form:"id"` Id uint `json:"id" form:"id"`
} }

6
server/resource/template/server/api.go.tpl

@ -34,7 +34,7 @@ func Create{{.StructName}}(c *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @accept application/json // @accept application/json
// @Produce application/json // @Produce application/json
// @Param data body request.GetByIdUnit true "删除{{.StructName}}"
// @Param data body request.GetByIdUint true "删除{{.StructName}}"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /{{.Abbreviation}}/delete{{.StructName}} [delete] // @Router /{{.Abbreviation}}/delete{{.StructName}} [delete]
func Delete{{.StructName}}(c *gin.Context) { func Delete{{.StructName}}(c *gin.Context) {
@ -99,11 +99,11 @@ func Update{{.StructName}}(c *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @accept application/json // @accept application/json
// @Produce application/json // @Produce application/json
// @Param data query request.GetByIdUnit true "用id查询{{.StructName}}"
// @Param data query request.GetByIdUint true "用id查询{{.StructName}}"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /{{.Abbreviation}}/find{{.StructName}} [get] // @Router /{{.Abbreviation}}/find{{.StructName}} [get]
func Find{{.StructName}}(c *gin.Context) { func Find{{.StructName}}(c *gin.Context) {
var {{.Abbreviation}} request.GetByIdUnit
var {{.Abbreviation}} request.GetByIdUint
_ = c.ShouldBindQuery(&{{.Abbreviation}}) _ = c.ShouldBindQuery(&{{.Abbreviation}})
if err, re{{.Abbreviation}} := service.Get{{.StructName}}({{.Abbreviation}}.Id); err != nil { if err, re{{.Abbreviation}} := service.Get{{.StructName}}({{.Abbreviation}}.Id); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) global.GVA_LOG.Error("查询失败!", zap.Any("err", err))

Loading…
Cancel
Save