feat ✨ 用户模块添加列排序
This commit is contained in:
1 parent
e0bd26d837
commit
5069c3074b
1 file changed
+8
-31
@@ -1,8 +1,6 @@
|
|||||||
package dto
|
package dto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/admin/models"
|
||||||
|
|
||||||
"go-admin/common/dto"
|
"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:"部门"`
|
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:"岗位"`
|
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:"状态"`
|
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{} {
|
func (m *SysUserSearch) GetNeedSearch() interface{} {
|
||||||
return *m
|
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 {
|
type SysUserControl struct {
|
||||||
UserId int `json:"userId" comment:"用户ID"` // 用户ID
|
UserId int `json:"userId" comment:"用户ID"` // 用户ID
|
||||||
Username string `json:"username" comment:"用户名"`
|
Username string `json:"username" comment:"用户名"`
|
||||||
@@ -58,16 +50,6 @@ type SysUserControl struct {
|
|||||||
common.ControlBy
|
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) {
|
func (s *SysUserControl) Generate(model *models.SysUser) {
|
||||||
if s.UserId != 0 {
|
if s.UserId != 0 {
|
||||||
model.UserId = s.UserId
|
model.UserId = s.UserId
|
||||||
@@ -95,11 +77,6 @@ type SysUserById struct {
|
|||||||
common.ControlBy
|
common.ControlBy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SysUserById) Generate() dto.Control {
|
|
||||||
cp := *s
|
|
||||||
return &cp
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SysUserById) GetId() interface{} {
|
func (s *SysUserById) GetId() interface{} {
|
||||||
if len(s.Ids) > 0 {
|
if len(s.Ids) > 0 {
|
||||||
s.Ids = append(s.Ids, s.Id)
|
s.Ids = append(s.Ids, s.Id)
|
||||||
|
|||||||
Reference in new issue
Block a user