format🥚 代码格式化

This commit is contained in:
zhangwenjian committed 2021-05-31 18:10:23 +08:00
1 parent a7cc943b8e
commit a54d4ba0c1
96 files changed
+143 -151

No files matched your search

+3 -3
View File
@@ -37,7 +37,7 @@ func (e SysApi) GetSysApiList(c *gin.Context) {
d := new(dto.SysApiSearch)
err := e.MakeContext(c).
MakeOrm().
Bind(d,binding.Form).
Bind(d, binding.Form).
MakeService(&s.Service).
Errors
if err != nil {
@@ -71,7 +71,7 @@ func (e SysApi) GetSysApi(c *gin.Context) {
s := new(service.SysApi)
err := e.MakeContext(c).
MakeOrm().
Bind(control,nil).
Bind(control, nil).
MakeService(&s.Service).
Errors
if err != nil {
@@ -166,4 +166,4 @@ func (e SysApi) DeleteSysApi(c *gin.Context) {
return
}
e.OK(control.GetId(), "删除成功")
}
}
+1 -1
View File
@@ -291,4 +291,4 @@ func (e SysConfig) GetSysConfigByKEYForService(c *gin.Context) {
return
}
e.OK(control, s.Msg)
}
}
+1 -1
View File
@@ -247,4 +247,4 @@ func (e SysDept) GetDeptTreeRoleSelect(c *gin.Context) {
"depts": result,
"checkedKeys": menuIds,
}, "")
}
}
+1 -1
View File
@@ -212,7 +212,7 @@ func (e SysDictData) GetSysDictDataAll(c *gin.Context) {
d := &dto.SysDictDataSearch{}
err := e.MakeContext(c).
MakeOrm().
Bind(d,binding.Form).
Bind(d, binding.Form).
MakeService(&s.Service).
Errors
if err != nil {
+1 -1
View File
@@ -222,4 +222,4 @@ func (e SysDictType) GetSysDictTypeAll(c *gin.Context) {
}
e.OK(list, "查询成功")
}
}
+1 -1
View File
@@ -90,4 +90,4 @@ func (e SysLoginLog) DeleteSysLoginLog(c *gin.Context) {
return
}
e.OK(control.GetId(), "删除成功")
}
}
+1 -1
View File
@@ -292,4 +292,4 @@ func (e SysMenu) GetMenuTreeSelect(c *gin.Context) {
"menus": result,
"checkedKeys": menuIds,
}, "获取成功")
}
}
+1 -1
View File
@@ -89,4 +89,4 @@ func (e SysOperaLog) DeleteSysOperaLog(c *gin.Context) {
return
}
e.OK(req.GetId(), "删除成功")
}
}
+1 -1
View File
@@ -188,4 +188,4 @@ func (e SysPost) DeleteSysPost(c *gin.Context) {
return
}
e.OK(req.GetId(), "删除成功")
}
}
+1 -1
View File
@@ -555,4 +555,4 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
//ADelete.Id, err = ADelete.Create(db)
e.OK("", "数据生成成功!")
}
}
+1 -1
View File
@@ -348,4 +348,4 @@ func (e *SysTable) DeleteSysTables(c *gin.Context) {
return
}
e.OK(nil, "删除成功")
}
}
+1 -1
View File
@@ -13,4 +13,4 @@ type CasbinRule struct {
func (CasbinRule) TableName() string {
return "sys_casbin_rule"
}
}
+1 -1
View File
@@ -78,4 +78,4 @@ func DataScopes(tableName string, userId int) func(db *gorm.DB) *gorm.DB {
}
return db
}
}
}
+24 -24
View File
@@ -9,29 +9,29 @@ import (
)
type Menu struct {
MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
MenuName string `json:"menuName" gorm:"size:128;"`
Title string `json:"title" gorm:"size:128;"`
Icon string `json:"icon" gorm:"size:128;"`
Path string `json:"path" gorm:"size:128;"`
Paths string `json:"paths" gorm:"size:128;"`
MenuType string `json:"menuType" gorm:"size:1;"`
Action string `json:"action" gorm:"size:16;"`
Permission string `json:"permission" gorm:"size:255;"`
ParentId int `json:"parentId" gorm:"size:11;"`
NoCache bool `json:"noCache" gorm:"size:8;"`
Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
Component string `json:"component" gorm:"size:255;"`
Sort int `json:"sort" gorm:"size:4;"`
Visible string `json:"visible" gorm:"size:1;"`
CreateBy string `json:"createBy" gorm:"size:128;"`
UpdateBy string `json:"updateBy" gorm:"size:128;"`
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
DataScope string `json:"dataScope" gorm:"-"`
Params string `json:"params" gorm:"-"`
RoleId int `gorm:"-"`
Children []Menu `json:"children" gorm:"-"`
IsSelect bool `json:"is_select" gorm:"-"`
MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
MenuName string `json:"menuName" gorm:"size:128;"`
Title string `json:"title" gorm:"size:128;"`
Icon string `json:"icon" gorm:"size:128;"`
Path string `json:"path" gorm:"size:128;"`
Paths string `json:"paths" gorm:"size:128;"`
MenuType string `json:"menuType" gorm:"size:1;"`
Action string `json:"action" gorm:"size:16;"`
Permission string `json:"permission" gorm:"size:255;"`
ParentId int `json:"parentId" gorm:"size:11;"`
NoCache bool `json:"noCache" gorm:"size:8;"`
Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
Component string `json:"component" gorm:"size:255;"`
Sort int `json:"sort" gorm:"size:4;"`
Visible string `json:"visible" gorm:"size:1;"`
CreateBy string `json:"createBy" gorm:"size:128;"`
UpdateBy string `json:"updateBy" gorm:"size:128;"`
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
DataScope string `json:"dataScope" gorm:"-"`
Params string `json:"params" gorm:"-"`
RoleId int `gorm:"-"`
Children []Menu `json:"children" gorm:"-"`
IsSelect bool `json:"is_select" gorm:"-"`
models.ModelTime
}
@@ -159,4 +159,4 @@ func InitPaths(tx *gorm.DB, menu *Menu) (err error) {
}
tx.Table("sys_menu").Where("menu_id = ?", menu.MenuId).Update("paths", menu.Paths)
return
}
}
+1 -1
View File
@@ -238,4 +238,4 @@ type MenuIdList struct {
// }
//
// return true, nil
//}
//}
+1 -1
View File
@@ -8,4 +8,4 @@ type SysRoleDept struct {
func (SysRoleDept) TableName() string {
return "sys_role_dept"
}
}
+1 -1
View File
@@ -168,4 +168,4 @@ func (rm *RoleMenu) Delete(tx *gorm.DB, RoleId string, MenuID string) (bool, err
}
return true, nil
}
}
+1 -1
View File
@@ -27,4 +27,4 @@ func (e *SysConfig) Generate() models.ActiveRecord {
func (e *SysConfig) GetId() interface{} {
return e.Id
}
}
+1 -1
View File
@@ -30,4 +30,4 @@ func (e *SysDept) Generate() models.ActiveRecord {
func (e *SysDept) GetId() interface{} {
return e.DeptId
}
}
+1 -1
View File
@@ -32,4 +32,4 @@ func (e *SysDictData) Generate() models.ActiveRecord {
func (e *SysDictData) GetId() interface{} {
return e.DictCode
}
}
+1 -1
View File
@@ -26,4 +26,4 @@ func (e *SysDictType) Generate() models.ActiveRecord {
func (e *SysDictType) GetId() interface{} {
return e.ID
}
}
+1 -1
View File
@@ -69,4 +69,4 @@ func SaveLoginLog(message storage.Messager) (err error) {
return err
}
return nil
}
}
+1 -1
View File
@@ -63,4 +63,4 @@ func (e *SysMenu) Generate() models.ActiveRecord {
func (e *SysMenu) GetId() interface{} {
return e.MenuId
}
}
+1 -1
View File
@@ -82,4 +82,4 @@ func SaveOperaLog(message storage.Messager) (err error) {
return err
}
return nil
}
}
+1 -1
View File
@@ -27,4 +27,4 @@ func (e *SysPost) Generate() models.ActiveRecord {
func (e *SysPost) GetId() interface{} {
return e.PostId
}
}
+1 -1
View File
@@ -31,4 +31,4 @@ func (e *SysRole) Generate() models.ActiveRecord {
func (e *SysRole) GetId() interface{} {
return e.RoleId
}
}
+1 -1
View File
@@ -74,4 +74,4 @@ func (e *SysUser) AfterFind(_ *gorm.DB) error {
e.PostIds = []int{e.PostId}
e.RoleIds = []int{e.RoleId}
return nil
}
}
+1 -1
View File
@@ -21,4 +21,4 @@ func registerSysApiRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew
r.GET("/:id", api.GetSysApi)
r.PUT("/:id", api.UpdateSysApi)
}
}
}
+1 -1
View File
@@ -21,4 +21,4 @@ func registerSysLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi
r.GET("/:id", api.GetSysLoginLog)
r.DELETE("", api.DeleteSysLoginLog)
}
}
}
+1 -1
View File
@@ -20,4 +20,4 @@ func registerSysOperaLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi
r.GET("/:id", api.GetSysOperaLog)
r.DELETE("", api.DeleteSysOperaLog)
}
}
}
+3 -5
View File
@@ -16,8 +16,8 @@ type SysApiSearch struct {
}
type SysApiOrder struct {
TitleOrder string `search:"type:order;column:title;table:sys_api" form:"titleOrder"`
PathOrder string `search:"type:order;column:path;table:sys_api" form:"pathOrder"`
TitleOrder string `search:"type:order;column:title;table:sys_api" form:"titleOrder"`
PathOrder string `search:"type:order;column:path;table:sys_api" form:"pathOrder"`
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_api" form:"createdAtOrder"`
}
@@ -25,7 +25,6 @@ func (m *SysApiSearch) GetNeedSearch() interface{} {
return *m
}
type SysApiControl struct {
Id int `uri:"id" comment:"编码"` // 编码
Handle string `json:"handle" comment:"handle"`
@@ -64,7 +63,6 @@ func (s *SysApiById) GetId() interface{} {
return s.Id
}
func (s *SysApiById) Generate() dto.Control {
o := *s
return &o
@@ -72,4 +70,4 @@ func (s *SysApiById) Generate() dto.Control {
func (s *SysApiById) GenerateM() (common.ActiveRecord, error) {
return &models.SysApi{}, nil
}
}
+3 -2
View File
@@ -61,7 +61,7 @@ func (s *SysConfigControl) GetId() interface{} {
// GetSetSysConfigReq 增、改使用的结构体
type GetSetSysConfigReq struct {
ConfigKey string `json:"configKey" comment:""`
ConfigKey string `json:"configKey" comment:""`
ConfigValue string `json:"configValue" comment:""`
}
@@ -69,6 +69,7 @@ type GetSetSysConfigReq struct {
func (s *GetSetSysConfigReq) Generate(model *models.SysConfig) {
model.ConfigValue = s.ConfigValue
}
type UpdateSetSysConfigReq map[string]string
// SysConfigByKeyReq 根据Key获取配置
@@ -98,4 +99,4 @@ func (s *SysConfigById) GetId() interface{} {
return s.Ids
}
return s.Id
}
}
+1 -2
View File
@@ -99,7 +99,6 @@ func (s *SysDeptById) GetId() interface{} {
return s.Id
}
func (s *SysDeptById) GenerateM() (*models.SysDept, error) {
return &models.SysDept{}, nil
}
@@ -108,4 +107,4 @@ type DeptLabel struct {
Id int `gorm:"-" json:"id"`
Label string `gorm:"-" json:"label"`
Children []DeptLabel `gorm:"-" json:"children"`
}
}
+1 -1
View File
@@ -106,4 +106,4 @@ func (s *SysDictDataById) Generate() dto.Control {
func (s *SysDictDataById) GenerateM() (common.ActiveRecord, error) {
return &models.SysDictData{}, nil
}
}
+1 -1
View File
@@ -83,4 +83,4 @@ func (s *SysDictTypeById) GetId() interface{} {
func (s *SysDictTypeById) GenerateM() (common.ActiveRecord, error) {
return &models.SysDictType{}, nil
}
}
+1 -1
View File
@@ -115,4 +115,4 @@ func (s *SysLoginLogById) Generate() *SysLoginLogById {
func (s *SysLoginLogById) GenerateM() (*models.SysLoginLog, error) {
return &models.SysLoginLog{}, nil
}
}
+1 -3
View File
@@ -24,7 +24,6 @@ func (m *SysMenuSearch) GetNeedSearch() interface{} {
return *m
}
// SysMenuControl 增、改使用的结构体
type SysMenuControl struct {
MenuId int `uri:"id" comment:"编码"` // 编码
@@ -97,7 +96,6 @@ type SysMenuById struct {
common.ControlBy
}
func (s *SysMenuById) Generate() *SysMenuById {
cp := *s
return &cp
@@ -128,4 +126,4 @@ type MenuRole struct {
type SelectRole struct {
RoleId int `uri:"roleId"`
}
}
+1 -1
View File
@@ -120,4 +120,4 @@ func (s *SysOperaLogById) Bind(ctx *gin.Context) error {
func (s *SysOperaLogById) SetUpdateBy(id int) {
}
}
+2 -2
View File
@@ -31,7 +31,7 @@ type SysRoleOrder struct {
RoleIdOrder string `search:"type:order;column:role_id;table:sys_role" form:"roleIdOrder"`
RoleNameOrder string `search:"type:order;column:role_name;table:sys_role" form:"roleNameOrder"`
RoleSortOrder string `search:"type:order;column:role_sort;table:sys_role" form:"usernameOrder"`
StatusOrder string `search:"type:order;column:status;table:sys_role" form:"statusOrder"`
StatusOrder string `search:"type:order;column:status;table:sys_role" form:"statusOrder"`
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_role" form:"createdAtOrder"`
}
@@ -147,4 +147,4 @@ type RoleDataScopeReq struct {
type DeptIdList struct {
DeptId int `json:"DeptId"`
}
}
+1 -1
View File
@@ -89,4 +89,4 @@ func (s *SysSettingById) Bind(ctx *gin.Context) error {
func (s *SysSettingById) GenerateM() (*models.SysSetting, error) {
return &models.SysSetting{}, nil
}
}
+2 -2
View File
@@ -25,7 +25,7 @@ type SysUserSearch struct {
type SysUserOrder struct {
UserIdOrder string `search:"type:order;column:user_id;table:sys_user" form:"userIdOrder"`
UsernameOrder string `search:"type:order;column:username;table:sys_user" form:"usernameOrder"`
StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"`
StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"`
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_user" form:"createdAtOrder"`
}
@@ -93,4 +93,4 @@ func (s *SysUserById) GenerateM() (common.ActiveRecord, error) {
type PassWord struct {
NewPassword string `json:"newPassword" binding:"required"`
OldPassword string `json:"oldPassword" binding:"required"`
}
}
+1 -1
View File
@@ -107,4 +107,4 @@ func (e *SysApi) RemoveSysApi(d *dto.SysApiById, p *actions.DataPermission) erro
return errors.New("无权删除该数据")
}
return nil
}
}
+3 -5
View File
@@ -138,16 +138,14 @@ func (e *SysConfig) UpdateSetSysConfig(c *[]dto.GetSetSysConfigReq) error {
for _, req := range m {
var data models.SysConfig
if err := e.Orm.Where("config_key = ?", req.ConfigKey).
First(&data).Error;
err != nil {
First(&data).Error; err != nil {
e.Log.Errorf("Service GetSysConfigPage error:%s", err)
return err
}
if data.ConfigValue != req.ConfigValue {
data.ConfigValue = req.ConfigValue
if err := e.Orm.Save(&data).Error;
err != nil {
if err := e.Orm.Save(&data).Error; err != nil {
e.Log.Errorf("Service GetSysConfigPage error:%s", err)
return err
}
@@ -188,4 +186,4 @@ func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigByKeyReq) error {
}
return nil
}
}
+1 -1
View File
@@ -282,4 +282,4 @@ func digitDeptLabel(deptList *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabe
}
dept.Children = min
return dept
}
}
+1 -1
View File
@@ -118,4 +118,4 @@ func (e *SysDictData) GetAll(c *dto.SysDictDataSearch, list *[]models.SysDictDat
return err
}
return nil
}
}
+1 -1
View File
@@ -116,4 +116,4 @@ func (e *SysDictType) GetAll(c *dto.SysDictTypeSearch, list *[]models.SysDictTyp
return err
}
return nil
}
}
+2 -2
View File
@@ -2,7 +2,7 @@ package service
import (
"errors"
"go-admin/app/admin/models"
"go-admin/app/admin/service/dto"
cDto "go-admin/common/dto"
@@ -97,4 +97,4 @@ func (e *SysOperaLog) RemoveSysOperaLog(d *dto.SysOperaLogById) error {
return errors.New("无权删除该数据")
}
return nil
}
}
+1 -1
View File
@@ -103,4 +103,4 @@ func (e *SysPost) RemoveSysPost(d *dto.SysPostById) error {
return err
}
return nil
}
}
+1 -1
View File
@@ -224,4 +224,4 @@ func (e *SysRole) UpdateDataScope(c *models.SysRole) (err error) {
}
}
return err
}
}
+1 -1
View File
@@ -110,4 +110,4 @@ func (e *SysRoleMenu) GetIDS(tx *gorm.DB, roleName string) ([]models.MenuPath, e
return nil, err
}
return r, nil
}
}
+1 -1
View File
@@ -49,4 +49,4 @@ func (e *SysSetting) UpdateSysSetting(c *models.SysSetting) error {
}
return nil
}
}
+1 -1
View File
@@ -176,4 +176,4 @@ func (e *SysUser) GetSysUserProfile(c *dto.SysUserById, user *models.SysUser, ro
}
return nil
}
}