修改新代码兼容

This commit is contained in:
linwenxiang
2021-03-04 23:52:00 +08:00
parent c294bb1585
commit 1105d98f27
+41 -54
View File
@@ -1,22 +1,20 @@
package dto
import (
"time"
"github.com/gin-gonic/gin"
"go-admin/app/admin/models"
"go-admin/common/dto"
"go-admin/common/log"
common "go-admin/common/models"
"go-admin/tools"
"time"
"go-admin/pkg/logger"
)
type SysChinaAreaDataSearch struct {
dto.Pagination `search:"-"`
PId string `form:"pId" search:"type:exact;column:p_id;table:sys_china_area_data" comment:"上级编码"`
Name string `form:"name" search:"type:exact;column:name;table:sys_china_area_data" comment:"名称"`
dto.Pagination `search:"-"`
PId string `form:"pId" search:"type:exact;column:p_id;table:sys_china_area_data" comment:"上级编码"`
Name string `form:"name" search:"type:exact;column:name;table:sys_china_area_data" comment:"名称"`
}
func (m *SysChinaAreaDataSearch) GetNeedSearch() interface{} {
@@ -24,57 +22,46 @@ func (m *SysChinaAreaDataSearch) GetNeedSearch() interface{} {
}
func (m *SysChinaAreaDataSearch) Bind(ctx *gin.Context) error {
msgID := tools.GenerateMsgIDFromContext(ctx)
err := ctx.ShouldBind(m)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
}
return err
log := logger.GetRequestLogger(ctx)
err := ctx.ShouldBind(m)
if err != nil {
log.Debugf("ShouldBind error: %s", err.Error())
}
return err
}
type SysChinaAreaDataControl struct {
Id int `uri:"id" comment:"编码"` // 编码
PId string `json:"pId" comment:"上级编码"`
Name string `json:"name" comment:"名称"`
CreateTime time.Time `json:"createTime" comment:""`
UpdateTime time.Time `json:"updateTime" comment:""`
DeleteTime time.Time `json:"deleteTime" comment:""`
Id int `uri:"id" comment:"编码"` // 编码
PId string `json:"pId" comment:"上级编码"`
Name string `json:"name" comment:"名称"`
CreateTime time.Time `json:"createTime" comment:""`
UpdateTime time.Time `json:"updateTime" comment:""`
DeleteTime time.Time `json:"deleteTime" comment:""`
}
func (s *SysChinaAreaDataControl) Bind(ctx *gin.Context) error {
msgID := tools.GenerateMsgIDFromContext(ctx)
err := ctx.ShouldBindUri(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
return err
}
err = ctx.ShouldBind(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
}
return err
log := logger.GetRequestLogger(ctx)
err := ctx.ShouldBindUri(s)
if err != nil {
log.Debugf("ShouldBindUri error: %s", err.Error())
return err
}
err = ctx.ShouldBind(s)
if err != nil {
log.Debugf("ShouldBind error: %s", err.Error())
}
return err
}
func (s *SysChinaAreaDataControl) Generate() (*models.SysChinaAreaData, error) {
return &models.SysChinaAreaData{
Model: common.Model{ Id: s.Id },
PId: s.PId,
Name: s.Name,
CreateTime: s.CreateTime,
UpdateTime: s.UpdateTime,
DeleteTime: s.DeleteTime,
Model: common.Model{Id: s.Id},
PId: s.PId,
Name: s.Name,
CreateTime: s.CreateTime,
UpdateTime: s.UpdateTime,
DeleteTime: s.DeleteTime,
}, nil
}
@@ -96,19 +83,19 @@ func (s *SysChinaAreaDataById) GetId() interface{} {
}
func (s *SysChinaAreaDataById) Bind(ctx *gin.Context) error {
msgID := tools.GenerateMsgIDFromContext(ctx)
log := logger.GetRequestLogger(ctx)
err := ctx.ShouldBindUri(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
log.Debugf("ShouldBindUri error: %s", err.Error())
return err
}
err = ctx.ShouldBind(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
log.Debugf("ShouldBind error: %s", err.Error())
}
return err
}
func (s *SysChinaAreaDataById) SetUpdateBy(id int) {
}
}