mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 10:13:01 +00:00
feat ✨ 用户模块添加列排序
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"go-admin/common/dto"
|
||||
@@ -21,26 +19,20 @@ type SysUserSearch struct {
|
||||
DeptId string `form:"deptId" search:"type:exact;column:dept_id;table:sys_user" comment:"部门"`
|
||||
PostId string `form:"postId" search:"type:exact;column:post_id;table:sys_user" comment:"岗位"`
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_user" comment:"状态"`
|
||||
SysUserOrder
|
||||
}
|
||||
|
||||
type SysUserOrder struct {
|
||||
UserIdOrder string `search:"type:order;column:user_id;table:sys_user" form:"userId_order"`
|
||||
UsernameOrder string `search:"type:order;column:username;table:sys_user" form:"username_order"`
|
||||
StatusOrder string `search:"type:order;column:status;table:sys_user" form:"status_order"`
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_user" form:"createdAt_order"`
|
||||
}
|
||||
|
||||
func (m *SysUserSearch) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
func (m *SysUserSearch) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBind(m)
|
||||
if err != nil {
|
||||
log.Debugf("ShouldBind error: %s", err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *SysUserSearch) Generate() dto.Index {
|
||||
o := *m
|
||||
return &o
|
||||
}
|
||||
|
||||
type SysUserControl struct {
|
||||
UserId int `json:"userId" comment:"用户ID"` // 用户ID
|
||||
Username string `json:"username" comment:"用户名"`
|
||||
@@ -58,16 +50,6 @@ type SysUserControl struct {
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysUserControl) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
|
||||
err := ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Debugf("ShouldBind error: %s", err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysUserControl) Generate(model *models.SysUser) {
|
||||
if s.UserId != 0 {
|
||||
model.UserId = s.UserId
|
||||
@@ -95,11 +77,6 @@ type SysUserById struct {
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysUserById) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysUserById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
@@ -116,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"`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user