feat :添加行政区域基础数据

This commit is contained in:
wenjianzhang
2021-02-26 01:05:20 +08:00
parent 19e96a01de
commit b8ec705e0a
24 changed files with 530 additions and 54 deletions
+3 -3
View File
@@ -35,7 +35,7 @@ func (m *SysCategorySearch) Generate() dto.Index {
}
type SysCategoryControl struct {
ID int `uri:"ID" comment:"标识"` // 标识
ID int `uri:"Id" comment:"标识"` // 标识
Name string `json:"name" comment:"名称"`
@@ -69,7 +69,7 @@ func (s *SysCategoryControl) Generate() dto.Control {
func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) {
return &models.SysCategory{
Model: common.Model{ID: s.ID},
Model: common.Model{Id: s.ID},
Name: s.Name,
Img: s.Img,
Sort: s.Sort,
@@ -93,4 +93,4 @@ func (s *SysCategoryById) Generate() dto.Control {
func (s *SysCategoryById) GenerateM() (common.ActiveRecord, error) {
return &models.SysCategory{}, nil
}
}
+3 -3
View File
@@ -35,7 +35,7 @@ func (m *SysConfigSearch) Bind(ctx *gin.Context) error {
// SysConfigControl 增、改使用的结构体
type SysConfigControl struct {
ID int `uri:"ID" comment:"编码"` // 编码
ID int `uri:"Id" comment:"编码"` // 编码
ConfigName string `json:"configName" comment:""`
ConfigKey string `uri:"configKey" json:"configKey" comment:""`
ConfigValue string `json:"configValue" comment:""`
@@ -67,7 +67,7 @@ func (s *SysConfigControl) Bind(ctx *gin.Context) error {
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
func (s *SysConfigControl) Generate() (*system.SysConfig, error) {
return &system.SysConfig{
Model: common.Model{ID: s.ID},
Model: common.Model{Id: s.ID},
ConfigName: s.ConfigName,
ConfigKey: s.ConfigKey,
ConfigValue: s.ConfigValue,
@@ -112,4 +112,4 @@ func (s *SysConfigById) Bind(ctx *gin.Context) error {
func (s *SysConfigById) GenerateM() (*system.SysConfig, error) {
return &system.SysConfig{}, nil
}
}
+4 -4
View File
@@ -13,7 +13,7 @@ import (
type SysFileDirSearch struct {
dto.Pagination `search:"-"`
ID int `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:"排序"`
@@ -39,7 +39,7 @@ func (m *SysFileDirSearch) Generate() dto.Index {
}
type SysFileDirControl struct {
ID int `uri:"ID" comment:"标识"` // 标识
ID int `uri:"Id" comment:"标识"` // 标识
Label string `json:"label" comment:"目录名称"`
PId int `json:"pId" comment:"上级目录"`
Sort string `json:"sort" comment:"排序"`
@@ -69,7 +69,7 @@ func (s *SysFileDirControl) Generate() dto.Control {
func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) {
return &models.SysFileDir{
Model: common.Model{ID: s.ID},
Model: common.Model{Id: s.ID},
Label: s.Label,
PId: s.PId,
//Sort: s.Sort,
@@ -97,4 +97,4 @@ func (s *SysFileDirById) Generate() dto.Control {
func (s *SysFileDirById) GenerateM() (common.ActiveRecord, error) {
return &models.SysFileDir{}, nil
}
}
+3 -3
View File
@@ -8,7 +8,7 @@ import (
type SysFileInfoSearch struct {
dto.Pagination `search:"-"`
ID int `form:"ID" search:"type:exact;column:id;table:sys_file_info" comment:"标识"`
ID int `form:"Id" search:"type:exact;column:id;table:sys_file_info" comment:"标识"`
Type string `form:"type" search:"type:exact;column:type;table:sys_file_info" comment:"类型"`
Name string `form:"name" search:"type:exact;column:name;table:sys_file_info" comment:"名称"`
PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_info" comment:"目录"`
@@ -34,7 +34,7 @@ type SysFileInfoControl struct {
func (s *SysFileInfoControl) Generate() (*models.SysFileInfo, error) {
return &models.SysFileInfo{
Model: common.Model{ID: s.ID},
Model: common.Model{Id: s.ID},
Type: s.Type,
Name: s.Name,
Size: s.Size,
@@ -49,4 +49,4 @@ func (s *SysFileInfoControl) Generate() (*models.SysFileInfo, error) {
type SysFileInfoById struct {
dto.ObjectById
UpdateBy int `json:"-"`
}
}
+3 -3
View File
@@ -33,7 +33,7 @@ func (m *SysLoginLogSearch) Bind(ctx *gin.Context) error {
}
type SysLoginLogControl struct {
ID int `uri:"ID" comment:"主键"` // 主键
ID int `uri:"Id" comment:"主键"` // 主键
Username string `json:"username" comment:"用户名"`
Status string `json:"status" comment:"状态"`
Ipaddr string `json:"ipaddr" comment:"ip地址"`
@@ -62,7 +62,7 @@ func (s *SysLoginLogControl) Bind(ctx *gin.Context) error {
func (s *SysLoginLogControl) Generate() (*system.SysLoginLog, error) {
return &system.SysLoginLog{
Model: common.Model{ID: s.ID},
Model: common.Model{Id: s.ID},
Username: s.Username,
Status: s.Status,
Ipaddr: s.Ipaddr,
@@ -110,4 +110,4 @@ func (s *SysLoginLogById) Generate() *SysLoginLogById {
func (s *SysLoginLogById) GenerateM() (*system.SysLoginLog, error) {
return &system.SysLoginLog{}, nil
}
}
+3 -3
View File
@@ -35,7 +35,7 @@ func (m *SysOperaLogSearch) Bind(ctx *gin.Context) error {
}
type SysOperaLogControl struct {
ID int `uri:"ID" comment:"编码"` // 编码
ID int `uri:"Id" comment:"编码"` // 编码
Title string `json:"title" comment:"操作模块"`
BusinessType string `json:"businessType" comment:"操作类型"`
BusinessTypes string `json:"businessTypes" comment:""`
@@ -72,7 +72,7 @@ func (s *SysOperaLogControl) Bind(ctx *gin.Context) error {
func (s *SysOperaLogControl) Generate() (*system.SysOperaLog, error) {
return &system.SysOperaLog{
Model: common.Model{ID: s.ID},
Model: common.Model{Id: s.ID},
Title: s.Title,
BusinessType: s.BusinessType,
BusinessTypes: s.BusinessTypes,
@@ -127,4 +127,4 @@ func (s *SysOperaLogById) Bind(ctx *gin.Context) error {
func (s *SysOperaLogById) SetUpdateBy(id int) {
}
}
+114
View File
@@ -0,0 +1,114 @@
package dto
import (
"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"
)
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:"名称"`
}
func (m *SysChinaAreaDataSearch) GetNeedSearch() interface{} {
return *m
}
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
}
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:""`
}
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
}
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,
}, nil
}
func (s *SysChinaAreaDataControl) GetId() interface{} {
return s.Id
}
type SysChinaAreaDataById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
}
func (s *SysChinaAreaDataById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
return s.Id
}
func (s *SysChinaAreaDataById) 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
}
func (s *SysChinaAreaDataById) SetUpdateBy(id int) {
}