feat: dbms新增支持工单流程审批

This commit is contained in:
meilin.huang
2024-02-29 22:12:50 +08:00
parent bf75483a3c
commit f93231da61
115 changed files with 3280 additions and 553 deletions

View File

@@ -13,6 +13,7 @@ import (
"mayfly-go/pkg/model"
"mayfly-go/pkg/req"
"mayfly-go/pkg/utils/collx"
"mayfly-go/pkg/utils/conv"
"mayfly-go/pkg/utils/cryptox"
"strconv"
"strings"
@@ -119,13 +120,29 @@ func (a *Account) UpdateAccount(rc *req.Ctx) {
// @router /accounts [get]
func (a *Account) Accounts(rc *req.Ctx) {
condition := &entity.Account{}
condition := &entity.AccountQuery{}
condition.Username = rc.Query("username")
condition.Name = rc.Query("name")
res, err := a.AccountApp.GetPageList(condition, rc.GetPageParam(), new([]vo.AccountManageVO))
biz.ErrIsNil(err)
rc.ResData = res
}
func (a *Account) SimpleAccounts(rc *req.Ctx) {
condition := &entity.AccountQuery{}
condition.Username = rc.Query("username")
condition.Name = rc.Query("name")
idsStr := rc.Query("ids")
if idsStr != "" {
condition.Ids = collx.ArrayMap[string, uint64](strings.Split(idsStr, ","), func(val string) uint64 {
return uint64(conv.Str2Int(val, 0))
})
}
res, err := a.AccountApp.GetPageList(condition, rc.GetPageParam(), new([]vo.SimpleAccountVO))
biz.ErrIsNil(err)
rc.ResData = res
}
// @router /accounts
func (a *Account) SaveAccount(rc *req.Ctx) {
form := &form.AccountCreateForm{}

View File

@@ -15,6 +15,12 @@ type AccountManageVO struct {
OtpSecret string `json:"otpSecret"`
}
type SimpleAccountVO struct {
Id uint64 `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
}
// 账号角色信息
type AccountRoleVO struct {
RoleId uint64 `json:"roleId"`

View File

@@ -16,7 +16,7 @@ import (
type Account interface {
base.App[*entity.Account]
GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
GetPageList(condition *entity.AccountQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
Create(ctx context.Context, account *entity.Account) error
@@ -34,7 +34,7 @@ func (a *accountAppImpl) InjectAccountRepo(repo repository.Account) {
a.Repo = repo
}
func (a *accountAppImpl) GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
func (a *accountAppImpl) GetPageList(condition *entity.AccountQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
return a.GetRepo().GetPageList(condition, pageParam, toEntity)
}

View File

@@ -1,5 +1,11 @@
package entity
type AccountQuery struct {
Ids []uint64 `json:"ids"`
Name string `json:"name" form:"name"`
Username string `json:"code" form:"code"`
}
type SysLogQuery struct {
CreatorId uint64 `json:"creatorId" form:"creatorId"`
Type int8 `json:"type" form:"type"`

View File

@@ -9,5 +9,5 @@ import (
type Account interface {
base.Repo[*entity.Account]
GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
GetPageList(condition *entity.AccountQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
}

View File

@@ -16,9 +16,10 @@ func newAccountRepo() repository.Account {
return &AccountRepoImpl{base.RepoImpl[*entity.Account]{M: new(entity.Account)}}
}
func (m *AccountRepoImpl) GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
func (m *AccountRepoImpl) GetPageList(condition *entity.AccountQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
qd := gormx.NewQuery(new(entity.Account)).
Like("name", condition.Name).
Like("username", condition.Username)
Like("username", condition.Username).
In("id", condition.Ids)
return gormx.PageQuery(qd, pageParam, toEntity)
}

View File

@@ -34,6 +34,9 @@ func InitAccountRouter(router *gin.RouterGroup) {
// 获取所有用户列表
req.NewGet("", a.Accounts),
// 获取用户列表信息(只包含最基础信息)
req.NewGet("/simple", a.SimpleAccounts),
req.NewPost("", a.SaveAccount).Log(req.NewLogSave("保存账号信息")).RequiredPermission(addAccountPermission),
req.NewPut("change-status/:id/:status", a.ChangeStatus).Log(req.NewLogSave("修改账号状态")).RequiredPermission(addAccountPermission),