refactor🎨 : uint 调整为 int

This commit is contained in:
zhangwenjian
2020-12-21 22:04:20 +08:00
parent ab7c34f817
commit 46ea5f18aa
17 changed files with 125 additions and 172 deletions
+32 -43
View File
@@ -2,8 +2,6 @@ package dto
import (
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"go-admin/app/admin/models"
"go-admin/common/dto"
"go-admin/common/log"
@@ -12,12 +10,10 @@ import (
)
type SysCategorySearch struct {
dto.Pagination `search:"-"`
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"`
dto.Pagination `search:"-"`
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"`
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"`
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"`
}
func (m *SysCategorySearch) GetNeedSearch() interface{} {
@@ -25,12 +21,12 @@ func (m *SysCategorySearch) GetNeedSearch() interface{} {
}
func (m *SysCategorySearch) 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
msgID := tools.GenerateMsgIDFromContext(ctx)
err := ctx.ShouldBind(m)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
}
return err
}
func (m *SysCategorySearch) Generate() dto.Index {
@@ -39,37 +35,31 @@ func (m *SysCategorySearch) Generate() dto.Index {
}
type SysCategoryControl struct {
ID uint `uri:"ID" comment:"标识"` // 标识
ID int `uri:"ID" comment:"标识"` // 标识
Name string `json:"name" comment:"名称"`
Name string `json:"name" comment:"名称"`
Img string `json:"img" comment:"图标"`
Img string `json:"img" comment:"图标"`
Sort string `json:"sort" comment:"排序"`
Sort string `json:"sort" comment:"排序"`
Status string `json:"status" comment:"状态"`
Status string `json:"status" comment:"状态"`
Remark string `json:"remark" comment:"备注"`
Remark string `json:"remark" comment:"备注"`
}
func (s *SysCategoryControl) 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
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
}
func (s *SysCategoryControl) Generate() dto.Control {
@@ -79,13 +69,12 @@ func (s *SysCategoryControl) Generate() dto.Control {
func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) {
return &models.SysCategory{
Model: gorm.Model{ID: s.ID},
Name: s.Name,
Img: s.Img,
Sort: s.Sort,
Status: s.Status,
Remark: s.Remark,
Model: common.Model{ID: s.ID},
Name: s.Name,
Img: s.Img,
Sort: s.Sort,
Status: s.Status,
Remark: s.Remark,
}, nil
}
+2 -4
View File
@@ -3,8 +3,6 @@ package dto
import (
"github.com/gin-gonic/gin"
"go-admin/app/admin/models/system"
"gorm.io/gorm"
"go-admin/common/dto"
"go-admin/common/log"
common "go-admin/common/models"
@@ -37,7 +35,7 @@ func (m *SysConfigSearch) Generate() dto.Index {
}
type SysConfigControl struct {
ID uint `uri:"ID" comment:"编码"` // 编码
ID int `uri:"ID" comment:"编码"` // 编码
ConfigName string `json:"configName" comment:""`
ConfigKey string `json:"configKey" comment:""`
ConfigValue string `json:"configValue" comment:""`
@@ -66,7 +64,7 @@ func (s *SysConfigControl) Generate() dto.Control {
func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) {
return &system.SysConfig{
Model: gorm.Model{ID: s.ID},
Model: common.Model{ID: s.ID},
ConfigName: s.ConfigName,
ConfigKey: s.ConfigKey,
ConfigValue: s.ConfigValue,
+7 -6
View File
@@ -2,8 +2,6 @@ package dto
import (
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"go-admin/app/admin/models"
"go-admin/common/dto"
"go-admin/common/log"
@@ -14,7 +12,7 @@ import (
type SysFileDirSearch struct {
dto.Pagination `search:"-"`
ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"`
ID int `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"`
Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"`
PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"`
Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"`
@@ -40,11 +38,13 @@ func (m *SysFileDirSearch) Generate() dto.Index {
}
type SysFileDirControl struct {
ID uint `uri:"ID" comment:"标识"` // 标识
ID int `uri:"ID" comment:"标识"` // 标识
Label string `json:"label" comment:"目录名称"`
PId uint `json:"pId" comment:"上级目录"`
PId int `json:"pId" comment:"上级目录"`
Sort string `json:"sort" comment:"排序"`
Path string `json:"path" comment:"路径"`
CreateBy int `json:"-"`
UpdateBy int `json:"-"`
}
func (s *SysFileDirControl) Bind(ctx *gin.Context) error {
@@ -68,7 +68,7 @@ func (s *SysFileDirControl) Generate() dto.Control {
func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) {
return &models.SysFileDir{
Model: gorm.Model{ID: s.ID},
Model: common.Model{ID: s.ID},
Label: s.Label,
PId: s.PId,
Sort: s.Sort,
@@ -82,6 +82,7 @@ func (s *SysFileDirControl) GetId() interface{} {
type SysFileDirById struct {
dto.ObjectById
UpdateBy int `json:"-"`
}
func (s *SysFileDirById) Generate() dto.Control {
+2 -5
View File
@@ -2,8 +2,6 @@ package dto
import (
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"go-admin/app/admin/models/system"
"go-admin/common/dto"
"go-admin/common/log"
@@ -41,7 +39,7 @@ func (m *SysLoginLogSearch) Generate() dto.Index {
}
type SysLoginLogControl struct {
ID uint `uri:"ID" comment:"主键"` // 主键
ID int `uri:"ID" comment:"主键"` // 主键
Username string `json:"username" comment:"用户名"`
Status string `json:"status" comment:"状态"`
Ipaddr string `json:"ipaddr" comment:"ip地址"`
@@ -75,8 +73,7 @@ func (s *SysLoginLogControl) Generate() dto.Control {
func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) {
return &system.SysLoginLog{
Model: gorm.Model{ID: s.ID},
Model: common.Model{ID: s.ID},
Username: s.Username,
Status: s.Status,
Ipaddr: s.Ipaddr,
+2 -4
View File
@@ -2,8 +2,6 @@ package dto
import (
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"go-admin/app/admin/models/system"
"go-admin/common/dto"
"go-admin/common/log"
@@ -42,7 +40,7 @@ func (m *SysOperaLogSearch) Generate() dto.Index {
}
type SysOperaLogControl struct {
ID uint `uri:"ID" comment:"编码"` // 编码
ID int `uri:"ID" comment:"编码"` // 编码
Title string `json:"title" comment:"操作模块"`
BusinessType string `json:"businessType" comment:"操作类型"`
BusinessTypes string `json:"businessTypes" comment:""`
@@ -84,7 +82,7 @@ func (s *SysOperaLogControl) Generate() dto.Control {
func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) {
return &system.SysOperaLog{
Model: gorm.Model{ID: s.ID},
Model: common.Model{ID: s.ID},
Title: s.Title,
BusinessType: s.BusinessType,
BusinessTypes: s.BusinessTypes,
+2 -2
View File
@@ -37,7 +37,7 @@ func (m *SysJobSearch) Generate() dto.Index {
}
type SysJobControl struct {
JobId uint `json:"jobId"`
JobId int `json:"jobId"`
JobName string `json:"jobName" validate:"required"` // 名称
JobGroup string `json:"jobGroup"` // 任务分组
JobType int `json:"jobType"` // 任务类型
@@ -93,7 +93,7 @@ func (s *SysJobById) GenerateM() (common.ActiveRecord, error) {
}
type SysJobItem struct {
JobId uint `json:"jobId"`
JobId int `json:"jobId"`
JobName string `json:"jobName" validate:"required"` // 名称
JobGroup string `json:"jobGroup"` // 任务分组
JobType int `json:"jobType"` // 任务类型