mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-11 03:33:53 +08:00
v2.0
This commit is contained in:
113
server/internal/controller/backend/sys/attachment.go
Normal file
113
server/internal/controller/backend/sys/attachment.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/attachment"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Attachment = cAttachment{}
|
||||
)
|
||||
|
||||
type cAttachment struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
|
||||
var in sysin.AttachmentDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysAttachment().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cAttachment) Edit(ctx context.Context, req *attachment.EditReq) (res *attachment.EditRes, err error) {
|
||||
|
||||
var in sysin.AttachmentEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysAttachment().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cAttachment) MaxSort(ctx context.Context, req *attachment.MaxSortReq) (*attachment.MaxSortRes, error) {
|
||||
|
||||
data, err := service.SysAttachment().MaxSort(ctx, sysin.AttachmentMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res attachment.MaxSortRes
|
||||
res.Sort = data.Sort
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (*attachment.ViewRes, error) {
|
||||
|
||||
data, err := service.SysAttachment().View(ctx, sysin.AttachmentViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res attachment.ViewRes
|
||||
res.AttachmentViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (*attachment.ListRes, error) {
|
||||
|
||||
var (
|
||||
in sysin.AttachmentListInp
|
||||
res attachment.ListRes
|
||||
)
|
||||
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysAttachment().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cAttachment) Status(ctx context.Context, req *attachment.StatusReq) (res *attachment.StatusRes, err error) {
|
||||
|
||||
var in sysin.AttachmentStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysAttachment().Status(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
113
server/internal/controller/backend/sys/blacklist.go
Normal file
113
server/internal/controller/backend/sys/blacklist.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/blacklist"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Blacklist = cBlacklist{}
|
||||
)
|
||||
|
||||
type cBlacklist struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) {
|
||||
var in sysin.BlacklistDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysBlacklist().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) {
|
||||
|
||||
var in sysin.BlacklistEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysBlacklist().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cBlacklist) MaxSort(ctx context.Context, req *blacklist.MaxSortReq) (*blacklist.MaxSortRes, error) {
|
||||
|
||||
data, err := service.SysBlacklist().MaxSort(ctx, sysin.BlacklistMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res blacklist.MaxSortRes
|
||||
res.Sort = data.Sort
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (*blacklist.ViewRes, error) {
|
||||
|
||||
data, err := service.SysBlacklist().View(ctx, sysin.BlacklistViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res blacklist.ViewRes
|
||||
res.BlacklistViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (*blacklist.ListRes, error) {
|
||||
|
||||
var (
|
||||
in sysin.BlacklistListInp
|
||||
res blacklist.ListRes
|
||||
)
|
||||
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysBlacklist().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) {
|
||||
|
||||
var in sysin.BlacklistStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysBlacklist().Status(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
57
server/internal/controller/backend/sys/config.go
Normal file
57
server/internal/controller/backend/sys/config.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/config"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Config = cConfig{}
|
||||
)
|
||||
|
||||
type cConfig struct{}
|
||||
|
||||
// GetConfig 获取指定分组的配置
|
||||
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (*config.GetRes, error) {
|
||||
var (
|
||||
in sysin.GetConfigInp
|
||||
res config.GetRes
|
||||
err error
|
||||
)
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// UpdateConfig 更新指定分组的配置
|
||||
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (*config.UpdateRes, error) {
|
||||
var (
|
||||
in sysin.UpdateConfigInp
|
||||
res config.UpdateRes
|
||||
err error
|
||||
)
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = service.SysConfig().UpdateConfigByGroup(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
113
server/internal/controller/backend/sys/cron.go
Normal file
113
server/internal/controller/backend/sys/cron.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/cron"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cron = cCron{}
|
||||
)
|
||||
|
||||
type cCron struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
|
||||
var in sysin.CronDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysCron().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) {
|
||||
|
||||
var in sysin.CronEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysCron().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (*cron.MaxSortRes, error) {
|
||||
|
||||
data, err := service.SysCron().MaxSort(ctx, sysin.CronMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res cron.MaxSortRes
|
||||
res.Sort = data.Sort
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (*cron.ViewRes, error) {
|
||||
|
||||
data, err := service.SysCron().View(ctx, sysin.CronViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res cron.ViewRes
|
||||
res.CronViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCron) List(ctx context.Context, req *cron.ListReq) (*cron.ListRes, error) {
|
||||
|
||||
var (
|
||||
in sysin.CronListInp
|
||||
res cron.ListRes
|
||||
)
|
||||
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysCron().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) {
|
||||
|
||||
var in sysin.CronStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysCron().Status(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
124
server/internal/controller/backend/sys/cron_group.go
Normal file
124
server/internal/controller/backend/sys/cron_group.go
Normal file
@@ -0,0 +1,124 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/cron"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CronGroup = cCronGroup{}
|
||||
)
|
||||
|
||||
type cCronGroup struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) {
|
||||
var in sysin.CronGroupDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysCronGroup().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) {
|
||||
|
||||
var in sysin.CronGroupEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysCronGroup().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (*cron.GroupMaxSortRes, error) {
|
||||
|
||||
data, err := service.SysCronGroup().MaxSort(ctx, sysin.CronGroupMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res cron.GroupMaxSortRes
|
||||
res.Sort = data.Sort
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (*cron.GroupViewRes, error) {
|
||||
|
||||
data, err := service.SysCronGroup().View(ctx, sysin.CronGroupViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res cron.GroupViewRes
|
||||
res.CronGroupViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (*cron.GroupListRes, error) {
|
||||
|
||||
var (
|
||||
in sysin.CronGroupListInp
|
||||
res cron.GroupListRes
|
||||
)
|
||||
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysCronGroup().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) {
|
||||
|
||||
var in sysin.CronGroupStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysCronGroup().Status(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Select 选项
|
||||
func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) {
|
||||
list, err := service.SysCronGroup().Select(ctx, sysin.CronGroupSelectInp{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = (*cron.GroupSelectRes)(&list)
|
||||
|
||||
return res, nil
|
||||
}
|
||||
73
server/internal/controller/backend/sys/dict_data.go
Normal file
73
server/internal/controller/backend/sys/dict_data.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/dict"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictData = cDictData{}
|
||||
)
|
||||
|
||||
type cDictData struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) {
|
||||
var in sysin.DictDataDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysDictData().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) {
|
||||
|
||||
var in sysin.DictDataEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysDictData().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (*dict.DataListRes, error) {
|
||||
|
||||
var (
|
||||
in sysin.DictDataListInp
|
||||
res dict.DataListRes
|
||||
)
|
||||
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysDictData().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
72
server/internal/controller/backend/sys/dict_type.go
Normal file
72
server/internal/controller/backend/sys/dict_type.go
Normal file
@@ -0,0 +1,72 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/dict"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictType = cDictType{}
|
||||
)
|
||||
|
||||
type cDictType struct{}
|
||||
|
||||
// Tree 树
|
||||
func (c *cDictType) Tree(ctx context.Context, req *dict.TypeTreeReq) (*dict.TypeTreeRes, error) {
|
||||
var (
|
||||
res dict.TypeTreeRes
|
||||
err error
|
||||
)
|
||||
res.List, err = service.SysDictType().Tree(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) {
|
||||
var in sysin.DictTypeDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysDictType().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) {
|
||||
|
||||
var in sysin.DictTypeEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysDictType().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Select 选项
|
||||
func (c *cDictType) Select(ctx context.Context, req *dict.TypeSelectReq) (res *dict.TypeSelectRes, err error) {
|
||||
list, err := service.SysDictType().Select(ctx, sysin.DictTypeSelectInp{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = (*dict.TypeSelectRes)(&list)
|
||||
|
||||
return res, nil
|
||||
}
|
||||
88
server/internal/controller/backend/sys/log.go
Normal file
88
server/internal/controller/backend/sys/log.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/log"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Log 日志
|
||||
var Log = sLog{}
|
||||
|
||||
type sLog struct{}
|
||||
|
||||
// Clear 清空日志
|
||||
func (c *sLog) Clear(ctx context.Context, req *log.ClearReq) (res *log.ClearRes, err error) {
|
||||
err = gerror.New("考虑安全,请到数据库清空")
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出
|
||||
func (c *sLog) Export(ctx context.Context, req *log.ExportReq) (res *log.ExportRes, err error) {
|
||||
var in sysin.LogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysLog().Export(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取全局日志列表
|
||||
func (c *sLog) List(ctx context.Context, req *log.ListReq) (*log.ListRes, error) {
|
||||
var (
|
||||
in sysin.LogListInp
|
||||
res log.ListRes
|
||||
)
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *sLog) View(ctx context.Context, req *log.ViewReq) (*log.ViewRes, error) {
|
||||
var res log.ViewRes
|
||||
data, err := service.SysLog().View(ctx, sysin.LogViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.LogViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *sLog) Delete(ctx context.Context, req *log.DeleteReq) (res *log.DeleteRes, err error) {
|
||||
var in sysin.LogDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysLog().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
106
server/internal/controller/backend/sys/provinces.go
Normal file
106
server/internal/controller/backend/sys/provinces.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/backend/provinces"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Provinces = cProvinces{}
|
||||
)
|
||||
|
||||
type cProvinces struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cProvinces) Delete(ctx context.Context, req *provinces.DeleteReq) (res *provinces.DeleteRes, err error) {
|
||||
var in sysin.ProvincesDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysProvinces().Delete(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cProvinces) Edit(ctx context.Context, req *provinces.EditReq) (res *provinces.EditRes, err error) {
|
||||
var in sysin.ProvincesEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysProvinces().Edit(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cProvinces) MaxSort(ctx context.Context, req *provinces.MaxSortReq) (*provinces.MaxSortRes, error) {
|
||||
data, err := service.SysProvinces().MaxSort(ctx, sysin.ProvincesMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res provinces.MaxSortRes
|
||||
res.Sort = data.Sort
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cProvinces) View(ctx context.Context, req *provinces.ViewReq) (*provinces.ViewRes, error) {
|
||||
data, err := service.SysProvinces().View(ctx, sysin.ProvincesViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var res provinces.ViewRes
|
||||
res.ProvincesViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cProvinces) List(ctx context.Context, req *provinces.ListReq) (*provinces.ListRes, error) {
|
||||
var (
|
||||
in sysin.ProvincesListInp
|
||||
res provinces.ListRes
|
||||
)
|
||||
|
||||
if err := gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list, totalCount, err := service.SysProvinces().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cProvinces) Status(ctx context.Context, req *provinces.StatusReq) (res *provinces.StatusRes, err error) {
|
||||
var in sysin.ProvincesStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = service.SysProvinces().Status(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user