mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
refactor: base.repo与base.app精简优化
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"mayfly-go/internal/sys/domain/repository"
|
||||
"mayfly-go/pkg/base"
|
||||
"mayfly-go/pkg/errorx"
|
||||
"mayfly-go/pkg/gormx"
|
||||
"mayfly-go/pkg/model"
|
||||
"mayfly-go/pkg/utils/collx"
|
||||
"mayfly-go/pkg/utils/stringx"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -138,14 +138,14 @@ func (r *resourceAppImpl) Sort(ctx context.Context, sortResource *entity.Resourc
|
||||
}
|
||||
|
||||
// 更新零值使用map,因为pid=0表示根节点
|
||||
updateMap := map[string]interface{}{
|
||||
updateMap := collx.M{
|
||||
"pid": sortResource.Pid,
|
||||
"weight": sortResource.Weight,
|
||||
"ui_path": newParentResourceUiPath + resourceUi,
|
||||
}
|
||||
condition := new(entity.Resource)
|
||||
condition.Id = sortResource.Id
|
||||
return gormx.Updates(condition, condition, updateMap)
|
||||
return r.UpdateByCond(ctx, updateMap, condition)
|
||||
}
|
||||
|
||||
func (r *resourceAppImpl) checkCode(code string) error {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"mayfly-go/internal/sys/domain/entity"
|
||||
"mayfly-go/internal/sys/domain/repository"
|
||||
"mayfly-go/pkg/base"
|
||||
"mayfly-go/pkg/gormx"
|
||||
)
|
||||
|
||||
type resourceRepoImpl struct {
|
||||
@@ -26,7 +25,7 @@ func (r *resourceRepoImpl) GetChildren(uiPath string) []entity.Resource {
|
||||
|
||||
func (r *resourceRepoImpl) UpdateByUiPathLike(resource *entity.Resource) error {
|
||||
sql := "UPDATE t_sys_resource SET status=? WHERE (ui_path LIKE ?)"
|
||||
return gormx.ExecSql(sql, resource.Status, resource.UiPath+"%")
|
||||
return r.ExecBySql(sql, resource.Status, resource.UiPath+"%")
|
||||
}
|
||||
|
||||
func (r *resourceRepoImpl) GetAccountResources(accountId uint64, toEntity any) error {
|
||||
|
||||
Reference in New Issue
Block a user