chore: 初始开源发布
iotlcm-app:小程序端 + 用户端服务。 - app/:uni-app 小程序前端(基于 unibest,MIT) - 微信 AppID → YOUR_WX_APPID,uni-app AppID → __UNI__YOURAPPID - 内网后端地址 → admin.iotlcm.example.com - 应用标题与 unibest 模板 README 重写(保留上游致谢与 MIT 声明) - server/:GoFrame 用户端服务(基于 XiuAdmin,Apache-2.0) - module xiuadmin → git.5iot.com/iotlcm-public/iotlcm-app(360 文件) - 支付回调地址 → app.iotlcm.example.com,商户名与应用名泛化 - 真实手机号 → 合法 11 位编造号(保留号段前 3 位 + 后 4 位) - 依赖号码尾部的断言同步更新 - 补 server/LICENSE(Apache-2.0) - 移除内部资产:CI 触发器 - 补根 README,LF 行尾 + .gitattributes 已知:TestSysDept_RefreshDeptAncestors 在源仓同一提交上同样失败,属既有缺陷。
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
package ai
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
openaiModel "github.com/cloudwego/eino-ext/components/model/openai"
|
||||
"github.com/cloudwego/eino/components/model"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
)
|
||||
|
||||
type OpenAICompatibleConfig struct {
|
||||
APIKey string
|
||||
BaseURL string
|
||||
Endpoint string
|
||||
Model string
|
||||
Timeout time.Duration
|
||||
MaxTokens int
|
||||
JSONOutput bool
|
||||
}
|
||||
|
||||
const ProviderOpenAICompatible = "openai-compatible"
|
||||
|
||||
type ChatModelConfig struct {
|
||||
Provider string
|
||||
APIKey string
|
||||
BaseURL string
|
||||
Endpoint string
|
||||
Model string
|
||||
Timeout time.Duration
|
||||
MaxTokens int
|
||||
JSONOutput bool
|
||||
}
|
||||
|
||||
func NewChatModel(ctx context.Context, config ChatModelConfig) (model.BaseChatModel, error) {
|
||||
provider := strings.ToLower(strings.TrimSpace(config.Provider))
|
||||
if provider == "" {
|
||||
provider = ProviderOpenAICompatible
|
||||
}
|
||||
switch provider {
|
||||
case ProviderOpenAICompatible, "openai":
|
||||
return NewOpenAICompatibleChatModel(ctx, OpenAICompatibleConfig{
|
||||
APIKey: config.APIKey,
|
||||
BaseURL: config.BaseURL,
|
||||
Endpoint: config.Endpoint,
|
||||
Model: config.Model,
|
||||
Timeout: config.Timeout,
|
||||
MaxTokens: config.MaxTokens,
|
||||
JSONOutput: config.JSONOutput,
|
||||
})
|
||||
default:
|
||||
return nil, gerror.Newf("暂不支持AI模型提供方:%s", provider)
|
||||
}
|
||||
}
|
||||
|
||||
func NewOpenAICompatibleChatModel(ctx context.Context, config OpenAICompatibleConfig) (model.BaseChatModel, error) {
|
||||
apiKey := strings.TrimSpace(config.APIKey)
|
||||
if apiKey == "" {
|
||||
return nil, gerror.New("AI模型API Key不能为空")
|
||||
}
|
||||
modelName := strings.TrimSpace(config.Model)
|
||||
if modelName == "" {
|
||||
return nil, gerror.New("AI模型名称不能为空")
|
||||
}
|
||||
baseURL, err := ResolveOpenAIBaseURL(config.BaseURL, config.Endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
modelConfig := &openaiModel.ChatModelConfig{
|
||||
APIKey: apiKey,
|
||||
BaseURL: baseURL,
|
||||
Model: modelName,
|
||||
Timeout: config.Timeout,
|
||||
}
|
||||
if config.MaxTokens > 0 {
|
||||
modelConfig.MaxTokens = &config.MaxTokens
|
||||
}
|
||||
if config.JSONOutput {
|
||||
modelConfig.ResponseFormat = &openaiModel.ChatCompletionResponseFormat{
|
||||
Type: openaiModel.ChatCompletionResponseFormatTypeJSONObject,
|
||||
}
|
||||
}
|
||||
|
||||
chatModel, err := openaiModel.NewChatModel(ctx, modelConfig)
|
||||
if err != nil {
|
||||
return nil, gerror.Wrap(err, "初始化Eino AI模型失败")
|
||||
}
|
||||
return chatModel, nil
|
||||
}
|
||||
|
||||
func ResolveOpenAIBaseURL(baseURL string, endpoint string) (string, error) {
|
||||
value := strings.TrimSpace(baseURL)
|
||||
if value == "" {
|
||||
value = strings.TrimSpace(endpoint)
|
||||
}
|
||||
if value == "" {
|
||||
return "", gerror.New("AI模型BaseURL不能为空")
|
||||
}
|
||||
|
||||
parsed, err := url.Parse(value)
|
||||
if err != nil || parsed.Scheme == "" || parsed.Host == "" {
|
||||
return "", gerror.New("AI模型BaseURL格式不正确")
|
||||
}
|
||||
parsed.Path = strings.TrimSuffix(strings.TrimRight(parsed.Path, "/"), "/chat/completions")
|
||||
parsed.RawPath = ""
|
||||
parsed.RawQuery = ""
|
||||
parsed.Fragment = ""
|
||||
return strings.TrimRight(parsed.String(), "/"), nil
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package ai
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cloudwego/eino/schema"
|
||||
)
|
||||
|
||||
func TestResolveOpenAIBaseURL(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
baseURL string
|
||||
endpoint string
|
||||
want string
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "base url", baseURL: "https://xueyangai.com/v1/", want: "https://xueyangai.com/v1"},
|
||||
{name: "legacy endpoint", endpoint: "https://xueyangai.com/v1/chat/completions", want: "https://xueyangai.com/v1"},
|
||||
{name: "base url preferred", baseURL: "https://example.com/v1", endpoint: "https://legacy.example.com/v1/chat/completions", want: "https://example.com/v1"},
|
||||
{name: "invalid", baseURL: "xueyangai.com/v1", wantErr: true},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
got, err := ResolveOpenAIBaseURL(test.baseURL, test.endpoint)
|
||||
if test.wantErr {
|
||||
if err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("ResolveOpenAIBaseURL() error = %v", err)
|
||||
}
|
||||
if got != test.want {
|
||||
t.Fatalf("ResolveOpenAIBaseURL() = %s, want %s", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenAICompatibleChatModel(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||
if request.URL.Path != "/v1/chat/completions" {
|
||||
t.Errorf("path = %s, want /v1/chat/completions", request.URL.Path)
|
||||
}
|
||||
if request.Header.Get("Authorization") != "Bearer test-key" {
|
||||
t.Errorf("authorization = %s", request.Header.Get("Authorization"))
|
||||
}
|
||||
var body map[string]any
|
||||
if err := json.NewDecoder(request.Body).Decode(&body); err != nil {
|
||||
t.Errorf("decode request: %v", err)
|
||||
}
|
||||
if body["model"] != "test-model" {
|
||||
t.Errorf("model = %v, want test-model", body["model"])
|
||||
}
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
_, _ = writer.Write([]byte(`{"id":"chatcmpl-test","object":"chat.completion","created":1,"model":"test-model","choices":[{"index":0,"message":{"role":"assistant","content":"{\"ok\":true}"},"finish_reason":"stop"}],"usage":{"prompt_tokens":1,"completion_tokens":1,"total_tokens":2}}`))
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
chatModel, err := NewOpenAICompatibleChatModel(context.Background(), OpenAICompatibleConfig{
|
||||
APIKey: "test-key",
|
||||
BaseURL: server.URL + "/v1",
|
||||
Model: "test-model",
|
||||
Timeout: 3 * time.Second,
|
||||
MaxTokens: 64,
|
||||
JSONOutput: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("NewOpenAICompatibleChatModel() error = %v", err)
|
||||
}
|
||||
response, err := chatModel.Generate(context.Background(), []*schema.Message{schema.UserMessage("hello")})
|
||||
if err != nil {
|
||||
t.Fatalf("Generate() error = %v", err)
|
||||
}
|
||||
if response.Content != `{"ok":true}` {
|
||||
t.Fatalf("response content = %s", response.Content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewChatModelRejectsUnsupportedProvider(t *testing.T) {
|
||||
_, err := NewChatModel(context.Background(), ChatModelConfig{Provider: "unsupported"})
|
||||
if err == nil {
|
||||
t.Fatal("expected unsupported provider error")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package cmd
|
||||
|
||||
var (
|
||||
Main = Http
|
||||
)
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/cache"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmode"
|
||||
)
|
||||
|
||||
// 系统初始化
|
||||
func SystemInit(ctx context.Context) {
|
||||
// 检查数据库连接
|
||||
if err := CheckConnDB(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// 设置gf运行模式
|
||||
SetGFMode(ctx)
|
||||
// 默认上海时区
|
||||
if err := gtime.SetTimeZone("Asia/Shanghai"); err != nil {
|
||||
g.Log().Fatalf(ctx, "时区设置异常 err: %+v", err)
|
||||
return
|
||||
}
|
||||
// 设置缓存适配器
|
||||
cache.SetAdapter(ctx)
|
||||
}
|
||||
|
||||
// CheckConnDB 检查数据库连接
|
||||
func CheckConnDB(ctx context.Context) error {
|
||||
err := g.DB().PingMaster()
|
||||
if err != nil {
|
||||
return errors.New("连接到数据库失败")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 设置gf运行模式
|
||||
func SetGFMode(ctx context.Context) {
|
||||
gfmode := g.Cfg().MustGet(ctx, "system.gfmode").String()
|
||||
if len(gfmode) == 0 {
|
||||
gfmode = gmode.NOT_SET
|
||||
}
|
||||
var modes = []string{gmode.DEVELOP, gmode.TESTING, gmode.STAGING, gmode.PRODUCT}
|
||||
for _, mode := range modes {
|
||||
if mode == gfmode {
|
||||
gmode.Set(mode)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func DBHandle(ctx context.Context) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/cmd/inithttp"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/websocket"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/router"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/tasks"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
|
||||
_ "git.5iot.com/iotlcm-public/iotlcm-app/internal/queues/httpqueues"
|
||||
)
|
||||
|
||||
func init() {
|
||||
inithttp.RegisterHttpInitFunc("initJobTask", initJobTask)
|
||||
}
|
||||
|
||||
var Http = &gcmd.Command{
|
||||
Name: "http",
|
||||
Usage: "http",
|
||||
Brief: "HTTP控制台服务",
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
g.Log().Infof(ctx, "Http init start")
|
||||
serverWg.Add(1)
|
||||
s := g.Server()
|
||||
go func() {
|
||||
waitServerClose(ctx)
|
||||
websocket.StopWebSocket(ctx)
|
||||
s.Shutdown()
|
||||
serverWg.Done()
|
||||
}()
|
||||
err = inithttp.InitHttp(ctx)
|
||||
if err != nil {
|
||||
g.Log().Errorf(ctx, "http init error: %v", err)
|
||||
return err
|
||||
}
|
||||
dumpRouterMap := g.Cfg().MustGet(ctx, "server.dumpRouterMap", false).Bool()
|
||||
s.SetDumpRouterMap(dumpRouterMap)
|
||||
router.InitRouter(ctx, s)
|
||||
websocket.StartWebSocket(ctx)
|
||||
s.Run()
|
||||
inithttp.CleanupHttp(ctx)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func initJobTask(ctx context.Context) error {
|
||||
tasks.TasksInstance(ctx)
|
||||
service.SysJob().InitRegister()
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/xgen"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gmode"
|
||||
)
|
||||
|
||||
var (
|
||||
initFuncList map[string]func(ctx context.Context) error
|
||||
)
|
||||
|
||||
func RegisterInitFunc(name string, fn func(ctx context.Context) error) {
|
||||
if initFuncList == nil {
|
||||
initFuncList = make(map[string]func(ctx context.Context) error)
|
||||
}
|
||||
initFuncList[name] = fn
|
||||
}
|
||||
|
||||
func InitSystemDeferFunc(ctx context.Context) error {
|
||||
for name, fn := range initFuncList {
|
||||
if fn == nil {
|
||||
g.Log().Errorf(ctx, "InitSystemDeferFunc %s fn is nil.", name)
|
||||
return errors.New("func is nil")
|
||||
}
|
||||
err := fn(ctx)
|
||||
if err != nil {
|
||||
g.Log().Errorf(ctx, "InitSystemDeferFunc %s err: %v", name, err)
|
||||
return err
|
||||
}
|
||||
g.Log().Infof(ctx, "InitSystemDeferFunc %s success.", name)
|
||||
}
|
||||
// 初始化生成代码配置
|
||||
if !gmode.IsProduct() {
|
||||
xgen.Init(ctx)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package inithttp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
var (
|
||||
httpInitFunc map[string]func(ctx context.Context) error
|
||||
httpCleanupFunc map[string]func(ctx context.Context) error
|
||||
rwLock sync.RWMutex
|
||||
)
|
||||
|
||||
func RegisterHttpInitFunc(name string, fn func(ctx context.Context) error) {
|
||||
rwLock.Lock()
|
||||
defer rwLock.Unlock()
|
||||
if httpInitFunc == nil {
|
||||
httpInitFunc = make(map[string]func(ctx context.Context) error)
|
||||
}
|
||||
httpInitFunc[name] = fn
|
||||
}
|
||||
|
||||
func RegisterHttpCleanupFunc(name string, fn func(ctx context.Context) error) {
|
||||
rwLock.Lock()
|
||||
defer rwLock.Unlock()
|
||||
if httpCleanupFunc == nil {
|
||||
httpCleanupFunc = make(map[string]func(ctx context.Context) error)
|
||||
}
|
||||
httpCleanupFunc[name] = fn
|
||||
}
|
||||
|
||||
func InitHttp(ctx context.Context) error {
|
||||
rwLock.RLock()
|
||||
defer rwLock.RUnlock()
|
||||
for name, fn := range httpInitFunc {
|
||||
if err := fn(ctx); err != nil {
|
||||
g.Log().Errorf(ctx, "httpInitFunc %s error: %v", name, err)
|
||||
return err
|
||||
} else {
|
||||
g.Log().Infof(ctx, "httpInitFunc %s success", name)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CleanupHttp(ctx context.Context) error {
|
||||
rwLock.RLock()
|
||||
defer rwLock.RUnlock()
|
||||
for name, fn := range httpCleanupFunc {
|
||||
if err := fn(ctx); err != nil {
|
||||
g.Log().Errorf(ctx, "httpCleanupFunc %s error: %v", name, err)
|
||||
} else {
|
||||
g.Log().Infof(ctx, "httpCleanupFunc %s success", name)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/cmd/inithttp"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/consts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/websocket"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
inithttp.RegisterHttpInitFunc("InitMonitor", func(ctx context.Context) error {
|
||||
InitMonitor()
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func InitMonitor() {
|
||||
go func() {
|
||||
for {
|
||||
RunMonitor()
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
}()
|
||||
websocket.RegisterTagCallback(consts.WSTagMonitorServer, func(client *websocket.Client, tag string) {
|
||||
RunMonitor()
|
||||
})
|
||||
}
|
||||
|
||||
func RunMonitor() {
|
||||
ctx := context.Background()
|
||||
hostInfo := service.MonitorServer().GetHostInfo(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerHost),
|
||||
Data: hostInfo,
|
||||
})
|
||||
sysLoad := service.MonitorServer().GetSysLoad(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerSysLoad),
|
||||
Data: sysLoad,
|
||||
})
|
||||
cpuInfo := service.MonitorServer().GetCpuInfo(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerCpu),
|
||||
Data: cpuInfo,
|
||||
})
|
||||
memInfo := service.MonitorServer().GetMemInfo(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerMem),
|
||||
Data: memInfo,
|
||||
})
|
||||
diskInfo := service.MonitorServer().GetDiskInfo(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerDisk),
|
||||
Data: diskInfo,
|
||||
})
|
||||
netInfo := service.MonitorServer().GetNetStatusInfo(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerNet),
|
||||
Data: netInfo,
|
||||
})
|
||||
goInfo := service.MonitorServer().GetGoInfo(ctx)
|
||||
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
|
||||
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerGo),
|
||||
Data: goInfo,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/consts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/event"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/gproc"
|
||||
)
|
||||
|
||||
var (
|
||||
serverCloseSignal = make(chan struct{}, 1)
|
||||
serverWg = sync.WaitGroup{}
|
||||
once sync.Once
|
||||
)
|
||||
|
||||
// 等待接收服务关闭信号
|
||||
func waitServerClose(ctx context.Context) {
|
||||
signalListen(ctx, handleSignalClose)
|
||||
<-serverCloseSignal
|
||||
}
|
||||
|
||||
// 等待所有服务关闭
|
||||
func waitAllServerClose(ctx context.Context) {
|
||||
serverWg.Wait()
|
||||
}
|
||||
|
||||
// 处理服务关闭信号
|
||||
func handleSignalClose(sig os.Signal) {
|
||||
serverCloseEvent(gctx.GetInitCtx())
|
||||
serverCloseSignal <- struct{}{}
|
||||
}
|
||||
|
||||
// 监听信号
|
||||
func signalListen(ctx context.Context, handler ...gproc.SigHandler) {
|
||||
g.Go(ctx, func(ctx context.Context) {
|
||||
// syscall.SIGINT,
|
||||
// syscall.SIGQUIT,
|
||||
// syscall.SIGKILL,
|
||||
// syscall.SIGTERM,
|
||||
// syscall.SIGABRT.
|
||||
gproc.AddSigHandlerShutdown(handler...)
|
||||
gproc.Listen()
|
||||
}, func(ctx context.Context, exception error) {
|
||||
g.Log().Fatalf(ctx, "信号监听异常 err: %+v", exception)
|
||||
})
|
||||
}
|
||||
|
||||
// serverCloseEvent 关闭事件
|
||||
func serverCloseEvent(ctx context.Context) {
|
||||
once.Do(func() {
|
||||
event.EventsInstance().Emit(ctx, consts.EventKeyServerClose, nil)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
ConfigKeyAppRegisterDeptId = "iot.register.app.dept"
|
||||
ConfigKeyAppRegisterRoleId = "iot.register.app.role"
|
||||
)
|
||||
@@ -0,0 +1,151 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
// 批次异步状态 batch_status
|
||||
BatchAsyncStatusCreated = 0
|
||||
BatchAsyncStatusPending = 1
|
||||
BatchAsyncStatusProcessing = 2
|
||||
BatchAsyncStatusSuccess = 3
|
||||
BatchAsyncStatusFailed = 4
|
||||
BatchAsyncStatusPartialSuccess = 5
|
||||
|
||||
// 兼容旧业务命名。
|
||||
BatchStatusNormal = BatchAsyncStatusCreated
|
||||
BatchStatusSuccess = BatchAsyncStatusSuccess
|
||||
|
||||
// 批次运行结果 run_result
|
||||
BatchRunResultPending = 0
|
||||
BatchRunResultRunning = 1
|
||||
BatchRunResultSuccess = 2
|
||||
BatchRunResultFailed = 3
|
||||
BatchRunResultPartialSuccess = 4
|
||||
|
||||
// 批次明细状态 detail_status
|
||||
BatchDetailStatusPending = 0
|
||||
BatchDetailStatusRunning = 1
|
||||
BatchDetailStatusSuccess = 2
|
||||
BatchDetailStatusFailed = 3
|
||||
|
||||
BatchSourceTypeBatchSelect = 0
|
||||
|
||||
BatchTypePrepare = 4
|
||||
BatchTypeAllocate = 3
|
||||
BatchTypeRenew = 101
|
||||
BatchTypeChange = 102
|
||||
BatchTypeStart = 103
|
||||
BatchTypeStop = 104
|
||||
BatchTypeRestart = 105
|
||||
BatchTypeDataStart = 109
|
||||
BatchTypeDataStop = 110
|
||||
|
||||
BatchNoPrefixAllocate = "ALC"
|
||||
BatchNoPrefixRenew = "REN"
|
||||
BatchNoPrefixChange = "CHG"
|
||||
BatchNoPrefixStart = "STR"
|
||||
BatchNoPrefixStop = "STP"
|
||||
BatchNoPrefixRestart = "RST"
|
||||
BatchNoPrefixDataStart = "DOP"
|
||||
BatchNoPrefixDataStop = "DST"
|
||||
BatchNoPrefixWarning = "SWC"
|
||||
|
||||
BlankOutStatusNo = 1
|
||||
)
|
||||
|
||||
const (
|
||||
DownloadStatusPending = 0
|
||||
DownloadStatusGenerated = 1
|
||||
DownloadStatusRunning = 2
|
||||
DownloadStatusFailed = 3
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceTypeExcel = 1
|
||||
ResourceExportSceneAllocate = 3
|
||||
ResourceExportSceneRenew = 101
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceBatchDownloadTaskSimCardAllocate = "卡划拨结果"
|
||||
ResourceBatchDownloadTaskSimCardRenew = "卡续费结果"
|
||||
SimCardAllocateSubDirImportExcel = "sim-card-allocate/import"
|
||||
SimCardAllocateSubDirResultExcel = "sim-card-allocate/result"
|
||||
SimCardRenewSubDirImportExcel = "sim-card-renew/import"
|
||||
SimCardRenewSubDirResultExcel = "sim-card-renew/result"
|
||||
)
|
||||
|
||||
const (
|
||||
CustomerTypeAgent = 1
|
||||
CustomerTypeTerminal = 2
|
||||
|
||||
OrderTypeCardSubscribe = 1
|
||||
OrderTypeBalanceRecharge = 2
|
||||
|
||||
OrderStatusPendingPay = 0
|
||||
OrderStatusCompleted = 5
|
||||
|
||||
OrderReturnStatusNone = 0
|
||||
OrderReturnStatusPending = 1
|
||||
OrderReturnStatusRunning = 2
|
||||
OrderReturnStatusPartial = 3
|
||||
OrderReturnStatusSuccess = 4
|
||||
|
||||
PayTypeBalance = 0
|
||||
PayTypeOnline = 1
|
||||
|
||||
PayStatusUnpaid = 0
|
||||
PayStatusPaid = 2
|
||||
|
||||
ShippingMethodNone = 3
|
||||
|
||||
ProductTypeCard = 1
|
||||
ProductTypeBalance = 4
|
||||
|
||||
PayModeYearMonth = 1
|
||||
|
||||
PackageBusinessTypeSubscribe = 0
|
||||
PackageBusinessTypeChange = 1
|
||||
PackageBusinessTypeRenew = 2
|
||||
|
||||
PackageStatusNone = 0
|
||||
PackageStatusPending = 1
|
||||
PackageStatusEffective = 2
|
||||
PackageStatusExpired = 3
|
||||
|
||||
EffectiveStatusPending = 0
|
||||
EffectiveStatusEffective = 1
|
||||
EffectiveStatusExpired = 2
|
||||
EffectiveStatusTerminated = 3
|
||||
EffectiveStatusVoided = 4
|
||||
)
|
||||
|
||||
const (
|
||||
V3ApiSimBossCardStatusPendingActivate = 1
|
||||
V3ApiSimBossCardStatusActivated = 2
|
||||
V3ApiSimBossCardStatusStopped = 4
|
||||
)
|
||||
|
||||
const (
|
||||
SimCardStatusOperTypeStop = "0"
|
||||
SimCardStatusOperTypeStart = "1"
|
||||
SimCardDataOperTypeStart = 0
|
||||
SimCardDataOperTypeStop = 1
|
||||
SimCardDataApnName = "CMIOT"
|
||||
)
|
||||
|
||||
const (
|
||||
ImportStatusSuccess = "success"
|
||||
ImportStatusFailed = "failed"
|
||||
)
|
||||
|
||||
const (
|
||||
BalanceIncome = 0
|
||||
BalanceExpense = 1
|
||||
|
||||
BalanceTransactionTypeRecharge = 0
|
||||
BalanceTransactionTypeConsume = 1
|
||||
|
||||
BalanceTransactionChannelBalance = 0
|
||||
BalanceTransactionChannelWechat = 2
|
||||
BalanceTransactionChannelAlipay = 3
|
||||
BalanceTransactionChannelMock = 9
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
KeySysAuthToken = "login:%d:%s" // 系统认证token缓存 login:{userId}:{uuid}
|
||||
KeySysAuthTokenReject = "login_reject:%d:%s:" // 系统认证token拒绝缓存 login_reject:{userId}:{uuid}
|
||||
KeyLoginScanWechat = "login:scan:wechat:%d" // 系统二维码登录缓存 hash Key:SceneId field:tempUserId value:QrcodeCacheModel
|
||||
KeyUserBindWechat = "user:bind:wechat:%d" // 系统二维码绑定缓存 hash Key:SceneId field:userId value:QrcodeCacheModel
|
||||
)
|
||||
@@ -0,0 +1,41 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import "github.com/gogf/gf/v2/errors/gcode"
|
||||
|
||||
var (
|
||||
// 账号不存在
|
||||
CodeUserNotFound = gcode.New(10001, "账号不存在", nil)
|
||||
// 账号已删除
|
||||
CodeUserDeleted = gcode.New(10002, "账号已删除", nil)
|
||||
// 密码错误
|
||||
CodeUserPasswordError = gcode.New(10003, "密码错误", nil)
|
||||
// 账号已禁用
|
||||
CodeUserDisabled = gcode.New(10004, "账号已禁用", nil)
|
||||
// 账号已锁定
|
||||
CodeUserLocked = gcode.New(10005, "账号已锁定", nil)
|
||||
// 账号已过期
|
||||
CodeUserExpired = gcode.New(10006, "账号已过期", nil)
|
||||
// 验证码错误
|
||||
CodeCaptchaError = gcode.New(10007, "验证码错误", nil)
|
||||
// 用户名已存在
|
||||
CodeUserExists = gcode.New(10008, "用户名已存在", nil)
|
||||
// 部门不存在
|
||||
CodeDeptNotFound = gcode.New(10009, "部门不存在", nil)
|
||||
// 手机号已存在
|
||||
CodePhoneExists = gcode.New(10010, "手机号已存在", nil)
|
||||
// 邮箱已存在
|
||||
CodeEmailExists = gcode.New(10011, "邮箱已存在", nil)
|
||||
// 登录已过期
|
||||
CodeLoginExpired = gcode.New(10012, "登录已过期", nil)
|
||||
// 部门下有子部门,不能删除
|
||||
CodeDeptHasSub = gcode.New(10013, "部门下有子部门,不能删除", nil)
|
||||
// 没有权限
|
||||
CodeNoPermission = gcode.New(10014, "没有权限", nil)
|
||||
// 无效Token
|
||||
CodeInvalidToken = gcode.New(10015, "无效Token", nil)
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
ConfigOssUrlPath = "sys.oss.urlPath" // 上传文件Url路径 "http://ab.com/" 或 "/" 或 "resource/upload|http://ab.com/upload"
|
||||
ConfigOssFileTypeKey = "sys.oss.fileType" // 上传文件类型
|
||||
ConfigOssImgTypeKey = "sys.oss.imgType" // 上传图片类型
|
||||
ConfigOssFileSizeKey = "sys.oss.fileSize" // 上传文件大小
|
||||
ConfigOssImgSizeKey = "sys.oss.imgSize" // 上传图片大小
|
||||
ConfigOnlineForceLogout = "sys.online.forceLogout" // 在线用户强制退出
|
||||
ConfigOssNewFileTypePath = "sys.oss.newFileTypePath.%d" // 上传文件类型路径 ${newFileType}
|
||||
)
|
||||
|
||||
const (
|
||||
ConfigOnlineForceLogoutTrue = "true" // 在线用户强制退出
|
||||
ConfigOnlineForceLogoutFalse = "false" // 在线用户强制退出
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
ContextKey = "ContextKey" // 上下文变量存储键名,前后端系统共享
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
DBNameDefault = "default"
|
||||
DBNameMemory = "memorydb"
|
||||
)
|
||||
@@ -0,0 +1,55 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
EventKeyServerClose = "server_close" // 服务关闭 args=[]
|
||||
)
|
||||
|
||||
const (
|
||||
EventKeyUserLogin = "user_login" // 用户登录 args=[uid,]
|
||||
EventKeyUserLogout = "user_logout" // 用户退出 args=[uid,]
|
||||
EventKeyUserCreate = "user_create" // 用户创建 args=[uid,]
|
||||
EventKeyUserDelete = "user_delete" // 用户删除 args=[uidArray,]
|
||||
EventKeyUserUpdate = "user_update" // 用户更新 args=[uid,]
|
||||
)
|
||||
const (
|
||||
EventKeyDBSysConfigUpdate = "db.sys_config_update" // 系统配置创建更新删除 args=[configId, tenantId,key?]
|
||||
EventKeyDBSysConfigCreate = "db.sys_config_create" // 系统配置创建 args=[configId, tenantId,key?]
|
||||
EventKeyDBSysConfigDelete = "db.sys_config_delete" // 系统配置删除 args=[configId, tenantId]
|
||||
)
|
||||
|
||||
const (
|
||||
EventKeyDBSysDeptCreate = "db.sys_dept_create" // 系统部门创建 args=[deptId,]
|
||||
EventKeyDBSysDeptUpdate = "db.sys_dept_update" // 系统部门更新 args=[deptId,]
|
||||
EventKeyDBSysDeptDelete = "db.sys_dept_delete" // 系统部门删除 args=[deptId[],]
|
||||
)
|
||||
|
||||
const (
|
||||
EventKeyDBSysTenantCreate = "db.sys_tenant_create" // 租户创建 args=[pk,]
|
||||
EventKeyDBSysTenantUpdate = "db.sys_tenant_update" // 租户更新 args=[pk,]
|
||||
EventKeyDBSysTenantDelete = "db.sys_tenant_delete" // 租户删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysRoleCreate = "db.sys_role_create" // 角色创建 args=[pk,]
|
||||
EventKeyDBSysRoleUpdate = "db.sys_role_update" // 角色更新 args=[pk,]
|
||||
EventKeyDBSysRoleDelete = "db.sys_role_delete" // 角色删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysMenuCreate = "db.sys_menu_create" // 菜单创建 args=[pk,]
|
||||
EventKeyDBSysMenuUpdate = "db.sys_menu_update" // 菜单更新 args=[pk,]
|
||||
EventKeyDBSysMenuDelete = "db.sys_menu_delete" // 菜单删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysPostCreate = "db.sys_post_create" // 岗位创建 args=[pk,]
|
||||
EventKeyDBSysPostUpdate = "db.sys_post_update" // 岗位更新 args=[pk,]
|
||||
EventKeyDBSysPostDelete = "db.sys_post_delete" // 岗位删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysDictDataCreate = "db.sys_dict_data_create" // 字典数据创建 args=[pk,]
|
||||
EventKeyDBSysDictDataUpdate = "db.sys_dict_data_update" // 字典数据更新 args=[pk,]
|
||||
EventKeyDBSysDictDataDelete = "db.sys_dict_data_delete" // 字典数据删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysDictTypeCreate = "db.sys_dict_type_create" // 字典类型创建 args=[pk,]
|
||||
EventKeyDBSysDictTypeUpdate = "db.sys_dict_type_update" // 字典类型更新 args=[pk,]
|
||||
EventKeyDBSysDictTypeDelete = "db.sys_dict_type_delete" // 字典类型删除 args=[pk[],]
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
HTTPContentTypeXml = "text/xml"
|
||||
HTTPContentTypeHtml = "text/html"
|
||||
HTTPContentTypeStream = "text/event-stream"
|
||||
HTTPContentTypeJson = "application/json"
|
||||
HTTPContentTypeExcel = "application/octet-stream"
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 内存缓存KEY常量 注明 key组成和 过期时间 清理方式
|
||||
const (
|
||||
MemCacheDeptName = "dept_name_%d" // 部门名称缓存 部门id:name 24小时过期
|
||||
MemCacheUserInfo = "user_info_%d" // 用户信息缓存 用户id:miniinfo 24小时过期 用户修改是清理
|
||||
MemCacheUserAccessCodeList = "user_access_code_list_%d" // 用户访问码列表缓存 用户id:access_code_list 24小时过期 用户退出清理
|
||||
MemCacheUserRoleDataAccessCodeList = "user_role_data_access_code_list_%d" // 用户角色数据访问码列表缓存 用户id:role_id:data_access_code_list 24小时过期 用户退出清理
|
||||
MemCacheSystemConfig = "system_config_%s" // 系统配置缓存 租户ID:map[key]value 24小时过期
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
QueueSysOptLog = "queue:sys_opt_log"
|
||||
)
|
||||
|
||||
// 数据库变动类型
|
||||
const (
|
||||
DbChgTypeAdd = "add" // 数据库变动新增
|
||||
DbChgTypeEdit = "edit" // 数据库变动编辑
|
||||
DbChgTypeDel = "del" // 数据库变动删除
|
||||
)
|
||||
const (
|
||||
BroadcastDbChg = "broadcast:db:chg" // 数据库配置表变动更新广播消息 obj{table_name,pk,type:add/edit/del,data:{主要字段数据}}
|
||||
)
|
||||
@@ -0,0 +1,150 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
var (
|
||||
// 默认系统租客编号,禁止修改编号
|
||||
DefaultSystemTenantCode = "000000"
|
||||
SuperAdminRoleId = int64(1)
|
||||
)
|
||||
|
||||
var (
|
||||
// 状态: 0正常 1停用
|
||||
SysStatusNormal = "0"
|
||||
SysStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单状态: 0正常 1停用
|
||||
SysMenuStatusNormal = "0"
|
||||
SysMenuStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单类型: M目录 C菜单 F按钮
|
||||
SysMenuTypeDir = "M"
|
||||
SysMenuTypeMenu = "C"
|
||||
SysMenuTypeBtn = "F"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单可见: 0显示 1隐藏
|
||||
SysMenuVisibleShow = "0"
|
||||
SysMenuVisibleHide = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单是否为外链: 0是 1否
|
||||
SysMenuIsFrameNo = 1
|
||||
SysMenuIsFrameYes = 0
|
||||
)
|
||||
|
||||
var (
|
||||
// 用户状态: 0正常 1停用
|
||||
SysUserStatusNormal = "0"
|
||||
SysUserStatusDisable = "1"
|
||||
SysUserStatusLocked = "2"
|
||||
SysUserStatusExpired = "3"
|
||||
SysUserStatusDeleted = "4"
|
||||
)
|
||||
|
||||
var (
|
||||
// 角色菜单数据范围: 0继承角色数据范围
|
||||
SysRoleMenuDataScopeRole = "0"
|
||||
// 角色数据范围: 1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限
|
||||
SysRoleDataScopeAll = "1"
|
||||
SysRoleDataScopeCustom = "2"
|
||||
SysRoleDataScopeDept = "3"
|
||||
SysRoleDataScopeDeptAndBelow = "4"
|
||||
SysRoleDataScopePersonal = "5"
|
||||
SysRoleDataScopeDeptAndBelowOrPersonal = "6"
|
||||
SysRoleDataScopeOrgAndNextLevel = "7"
|
||||
SysRoleDataScopeOrgNextLevel = "8"
|
||||
)
|
||||
|
||||
var (
|
||||
// 上传文件类型: 1文件 2图片
|
||||
SysUploadFileTypeFile = "file"
|
||||
SysUploadFileTypeImg = "img"
|
||||
)
|
||||
|
||||
var (
|
||||
// 新文件类型
|
||||
SysUploadNewFileTypeUserFile = 1 // 用户文件
|
||||
SysUploadNewFileTypeUserImg = 2 // 用户图片
|
||||
SysUploadNewFileTypeDeviceFile = 3 // 设备文件 ${device_key}
|
||||
)
|
||||
var (
|
||||
// 新文件类型路径
|
||||
SysUploadNewFileTypePathUserFile = "user/file" // 用户文件
|
||||
SysUploadNewFileTypePathUserImg = "user/img" // 用户图片
|
||||
SysUploadNewFileTypePathDeviceFile = "device" // 设备文件 ${device_key}
|
||||
)
|
||||
var (
|
||||
// 用户性别: 0男 1女 2未知
|
||||
SysUserSexMale = "0"
|
||||
SysUserSexFemale = "1"
|
||||
SysUserSexUnknown = "2"
|
||||
)
|
||||
|
||||
var (
|
||||
// 用户类型: pc端 app端
|
||||
SysUserTypeSys = "sys_user"
|
||||
SysUserTypeAPP = "app_user"
|
||||
)
|
||||
|
||||
var (
|
||||
// AppTerminalDeptId 仅作为旧数据兜底默认部门;终端用户身份以 sys_config 的小程序角色和所属组织配置为准。
|
||||
AppTerminalDeptId = int64(147)
|
||||
)
|
||||
|
||||
var (
|
||||
// 部门状态: 0正常 1停用
|
||||
SysDeptStatusNormal = "0"
|
||||
SysDeptStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 任务状态: 0正常 1停用
|
||||
SysJobStatusNormal = "0"
|
||||
SysJobStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 计划执行策略 0不限制并发 1限制并发
|
||||
SysJobMisfirePolicyMulty = 1
|
||||
SysJobMisfirePolicyOnce = 2
|
||||
)
|
||||
var (
|
||||
// 权限码前缀 x-check-permission
|
||||
SysCheckPermissionPrefix = "cp"
|
||||
SysCheckPermissionRolePrefix = "cpr:" // 角色权限码前缀+角色权限
|
||||
SysCheckPermissionMenuPrefix = "cpm:" // 菜单权限码前缀+菜单权限
|
||||
SysCheckPermissionDeptPrefix = "cpd:" // 部门权限码前缀+部门编码
|
||||
SysCheckPermissionPostPrefix = "cpp:" // 岗位权限码前缀+岗位编码
|
||||
SysCheckPermissionUserPrefix = "cpu:" // 用户权限码前缀+用户名
|
||||
SysCheckPermissionCurrentUser = "cpc:current:user" // 当前登录用户默认权限
|
||||
SysCheckPermissionTerminalUser = "cpa:terminal:user" // 小程序终端用户专用权限
|
||||
)
|
||||
var StatusSlice = []int{0, 1}
|
||||
|
||||
var (
|
||||
// 公告范围: 1全部 2指定组织 3指定用户
|
||||
NoticeRangeAll = 1
|
||||
NoticeRangeDept = 2
|
||||
NoticeRangeUser = 3
|
||||
)
|
||||
|
||||
var (
|
||||
// 租户配置
|
||||
ConfigKeyTenantDefaultRegisterDeptId = "iot.register.dept"
|
||||
ConfigKeyTenantDefaultRegisterRoleId = "iot.register.role"
|
||||
)
|
||||
|
||||
var (
|
||||
// 微信平台
|
||||
SourceWechatMp = "wechat_mp"
|
||||
)
|
||||
@@ -0,0 +1,23 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 服务器监控信息
|
||||
const (
|
||||
MonitorServerHost = "host"
|
||||
MonitorServerSysLoad = "sysLoad"
|
||||
MonitorServerCpu = "cpu"
|
||||
MonitorServerMem = "mem"
|
||||
MonitorServerDisk = "disk"
|
||||
MonitorServerNet = "net"
|
||||
MonitorServerGo = "go"
|
||||
)
|
||||
|
||||
// WEBSOCKET订阅Tag 服务器监控信息
|
||||
const (
|
||||
WSTagMonitorServer = "ws:tag:monitor:server" // WEBSOCKET订阅Tag 服务器监控信息
|
||||
WSEventMonitorServer = "ws:event:monitor:server:%s" // WEBSOCKET订阅 服务器监控信息 %s in [host,sysLoad,cpu,disk,net,go]
|
||||
)
|
||||
@@ -0,0 +1,9 @@
|
||||
package app
|
||||
|
||||
import apiApp "git.5iot.com/iotlcm-public/iotlcm-app/api/app"
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() apiApp.IAppV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Captcha(ctx context.Context, req *v1.CaptchaReq) (res *v1.CaptchaRes, err error) {
|
||||
captchaID, captchaImage, err := service.AppAuth().Captcha(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.CaptchaRes{
|
||||
CaptchaID: captchaID,
|
||||
CaptchaImage: captchaImage,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SideCaptcha(ctx context.Context, req *v1.SideCaptchaReq) (res *v1.SideCaptchaRes, err error) {
|
||||
captcha, err := service.AppAuth().SideCaptcha(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SideCaptchaRes{AppSideCaptchaModel: *captcha}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) CheckSideCaptcha(ctx context.Context, req *v1.CheckSideCaptchaReq) (res *v1.CheckSideCaptchaRes, err error) {
|
||||
if err = service.AppAuth().CheckSideCaptcha(ctx, &req.AppCheckSideCaptchaParam); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.CheckSideCaptchaRes{Success: true}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SendSms(ctx context.Context, req *v1.SendSmsReq) (res *v1.SendSmsRes, err error) {
|
||||
sms, err := service.AppAuth().SendSms(ctx, &req.AppSendSmsParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SendSmsRes{AppSendSmsModel: *sms}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) PhoneRegister(ctx context.Context, req *v1.PhoneRegisterReq) (res *v1.PhoneRegisterRes, err error) {
|
||||
token, err := service.AppAuth().PhoneRegister(ctx, &req.AppPhoneRegisterParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PhoneRegisterRes{AppAuthTokenModel: *token}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) PhoneLogin(ctx context.Context, req *v1.PhoneLoginReq) (res *v1.PhoneLoginRes, err error) {
|
||||
token, err := service.AppAuth().PhoneLogin(ctx, &req.AppPhoneLoginParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PhoneLoginRes{AppAuthTokenModel: *token}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WechatLogin(ctx context.Context, req *v1.WechatLoginReq) (res *v1.WechatLoginRes, err error) {
|
||||
data, err := service.AppAuth().WechatLogin(ctx, &req.AppWechatLoginParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WechatLoginRes{AppWechatLoginModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WechatBindPhone(ctx context.Context, req *v1.WechatBindPhoneReq) (res *v1.WechatBindPhoneRes, err error) {
|
||||
data, err := service.AppAuth().WechatBindPhone(ctx, &req.AppWechatBindPhoneParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WechatBindPhoneRes{AppWechatBindPhoneModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) ForgotPassword(ctx context.Context, req *v1.ForgotPasswordReq) (res *v1.ForgotPasswordRes, err error) {
|
||||
if err = service.AppAuth().ForgotPassword(ctx, &req.AppForgotPasswordParam); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.ForgotPasswordRes{Success: true}, nil
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) BalanceRechargeSubmit(ctx context.Context, req *v1.BalanceRechargeSubmitReq) (res *v1.BalanceRechargeSubmitRes, err error) {
|
||||
order, err := service.AppCard().BalanceRechargeSubmit(ctx, &req.AppBalanceRechargeSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BalanceRechargeSubmitRes{AppBalanceRechargeSubmitModel: order}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BalanceRechargeStatus(ctx context.Context, req *v1.BalanceRechargeStatusReq) (res *v1.BalanceRechargeStatusRes, err error) {
|
||||
status, err := service.AppCard().BalanceRechargeStatus(ctx, &req.AppBalanceRechargeStatusParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BalanceRechargeStatusRes{AppBalanceRechargeStatusModel: status}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BalanceRechargeMockPay(ctx context.Context, req *v1.BalanceRechargeMockPayReq) (res *v1.BalanceRechargeMockPayRes, err error) {
|
||||
status, err := service.AppCard().BalanceRechargeMockPay(ctx, &req.AppBalanceRechargeMockPayParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BalanceRechargeMockPayRes{AppBalanceRechargeStatusModel: status}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BalanceRechargeRefund(ctx context.Context, req *v1.BalanceRechargeRefundReq) (res *v1.BalanceRechargeRefundRes, err error) {
|
||||
order, err := service.AppCard().BalanceRechargeRefund(ctx, &req.AppBalanceRechargeRefundParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BalanceRechargeRefundRes{AppOrderModel: order}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BalanceRechargeWechatNotify(ctx context.Context, req *v1.BalanceRechargeWechatNotifyReq) (res *v1.BalanceRechargeWechatNotifyRes, err error) {
|
||||
r := ghttp.RequestFromCtx(ctx)
|
||||
if r == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if err = service.AppCard().BalanceRechargeWechatNotify(ctx); err != nil {
|
||||
g.Log().Errorf(ctx, "微信支付余额充值回调处理失败: %v", err)
|
||||
r.Response.Status = 500
|
||||
r.Response.WriteJson(g.Map{
|
||||
"code": "FAIL",
|
||||
"message": err.Error(),
|
||||
})
|
||||
r.ExitAll()
|
||||
return nil, nil
|
||||
}
|
||||
r.Response.WriteJson(g.Map{
|
||||
"code": "SUCCESS",
|
||||
"message": "成功",
|
||||
})
|
||||
r.ExitAll()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BalanceRechargeWechatRefundNotify(ctx context.Context, req *v1.BalanceRechargeWechatRefundNotifyReq) (res *v1.BalanceRechargeWechatRefundNotifyRes, err error) {
|
||||
r := ghttp.RequestFromCtx(ctx)
|
||||
if r == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if err = service.AppCard().BalanceRechargeWechatRefundNotify(ctx); err != nil {
|
||||
g.Log().Errorf(ctx, "微信支付退款回调处理失败: %v", err)
|
||||
r.Response.Status = 500
|
||||
r.Response.WriteJson(g.Map{
|
||||
"code": "FAIL",
|
||||
"message": err.Error(),
|
||||
})
|
||||
r.ExitAll()
|
||||
return nil, nil
|
||||
}
|
||||
r.Response.WriteJson(g.Map{
|
||||
"code": "SUCCESS",
|
||||
"message": "成功",
|
||||
})
|
||||
r.ExitAll()
|
||||
return nil, nil
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) PublicQueryCard(ctx context.Context, req *v1.PublicQueryCardReq) (res *v1.PublicQueryCardRes, err error) {
|
||||
card, err := service.AppCard().PublicQuery(ctx, &req.AppCardQueryParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PublicQueryCardRes{Card: card}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RecognizeCard(ctx context.Context, req *v1.RecognizeCardReq) (res *v1.RecognizeCardRes, err error) {
|
||||
result, err := service.AppCard().RecognizeCard(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RecognizeCardRes{AppCardRecognitionModel: result}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) CardList(ctx context.Context, req *v1.CardListReq) (res *v1.CardListRes, err error) {
|
||||
items, total, err := service.AppCard().List(ctx, &req.AppCardListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hasMore := len(items) >= req.PageSize
|
||||
if req.IncludeTotal == nil || *req.IncludeTotal {
|
||||
hasMore = req.Page*req.PageSize < total
|
||||
}
|
||||
return &v1.CardListRes{Items: items, Total: total, HasMore: hasMore}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) PackageList(ctx context.Context, req *v1.PackageListReq) (res *v1.PackageListRes, err error) {
|
||||
items, total, err := service.AppCard().PackageList(ctx, &req.AppPackageListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PackageListRes{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) PublicPackageDetail(ctx context.Context, req *v1.PublicPackageDetailReq) (res *v1.PublicPackageDetailRes, err error) {
|
||||
pkg, err := service.AppCard().PublicPackageDetail(ctx, &req.AppPackagePublicDetailParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PublicPackageDetailRes{Package: pkg}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) CardDetail(ctx context.Context, req *v1.CardDetailReq) (res *v1.CardDetailRes, err error) {
|
||||
card, err := service.AppCard().Detail(ctx, &req.AppCardDetailParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.CardDetailRes{Card: card}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BindCard(ctx context.Context, req *v1.BindCardReq) (res *v1.BindCardRes, err error) {
|
||||
card, err := service.AppCard().Bind(ctx, &req.AppCardBindParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BindCardRes{Card: card}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RestartCard(ctx context.Context, req *v1.RestartCardReq) (res *v1.RestartCardRes, err error) {
|
||||
restart, err := service.AppCard().Restart(ctx, &req.AppCardRestartParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RestartCardRes{AppCardRestartModel: restart}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) StopCard(ctx context.Context, req *v1.StopCardReq) (res *v1.StopCardRes, err error) {
|
||||
stop, err := service.AppCard().Stop(ctx, &req.AppCardRestartParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.StopCardRes{AppCardLifecycleModel: stop}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) StartCard(ctx context.Context, req *v1.StartCardReq) (res *v1.StartCardRes, err error) {
|
||||
start, err := service.AppCard().Start(ctx, &req.AppCardRestartParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.StartCardRes{AppCardLifecycleModel: start}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) LifecycleBatchSubmit(ctx context.Context, req *v1.LifecycleBatchSubmitReq) (res *v1.LifecycleBatchSubmitRes, err error) {
|
||||
submit, err := service.AppCard().LifecycleBatchSubmit(ctx, &req.AppCardLifecycleParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.LifecycleBatchSubmitRes{AppCardLifecycleModel: submit}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) LifecycleBatchStatus(ctx context.Context, req *v1.LifecycleBatchStatusReq) (res *v1.LifecycleBatchStatusRes, err error) {
|
||||
status, err := service.AppCard().LifecycleBatchStatus(ctx, &req.AppCardLifecycleStatusParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.LifecycleBatchStatusRes{AppCardLifecycleModel: status}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RenewPrepare(ctx context.Context, req *v1.RenewPrepareReq) (res *v1.RenewPrepareRes, err error) {
|
||||
prepare, err := service.AppCard().RenewPrepare(ctx, &req.AppCardRenewPrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RenewPrepareRes{AppCardRenewPrepareModel: prepare}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RenewBatchPrepare(ctx context.Context, req *v1.RenewBatchPrepareReq) (res *v1.RenewBatchPrepareRes, err error) {
|
||||
prepare, err := service.AppCard().RenewBatchPrepare(ctx, &req.AppCardRenewBatchPrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RenewBatchPrepareRes{AppCardRenewPrepareModel: prepare}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RenewSubmit(ctx context.Context, req *v1.RenewSubmitReq) (res *v1.RenewSubmitRes, err error) {
|
||||
submit, err := service.AppCard().RenewSubmit(ctx, &req.AppCardRenewSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RenewSubmitRes{AppCardRenewSubmitModel: submit}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RenewBatchSubmit(ctx context.Context, req *v1.RenewBatchSubmitReq) (res *v1.RenewBatchSubmitRes, err error) {
|
||||
submit, err := service.AppCard().RenewBatchSubmit(ctx, &req.AppCardRenewBatchSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RenewBatchSubmitRes{AppCardRenewSubmitModel: submit}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) AllocateTargets(ctx context.Context, req *v1.AllocateTargetsReq) (res *v1.AllocateTargetsRes, err error) {
|
||||
items, total, err := service.AppCard().AllocateTargets(ctx, &req.AppCardAllocateTargetListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.AllocateTargetsRes{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) AllocateBatchPrepare(ctx context.Context, req *v1.AllocateBatchPrepareReq) (res *v1.AllocateBatchPrepareRes, err error) {
|
||||
prepare, err := service.AppCard().AllocateBatchPrepare(ctx, &req.AppCardAllocateBatchPrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.AllocateBatchPrepareRes{AppCardAllocateBatchModel: prepare}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) AllocateBatchSubmit(ctx context.Context, req *v1.AllocateBatchSubmitReq) (res *v1.AllocateBatchSubmitRes, err error) {
|
||||
submit, err := service.AppCard().AllocateBatchSubmit(ctx, &req.AppCardAllocateBatchSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.AllocateBatchSubmitRes{AppCardAllocateBatchModel: submit}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) ChangePrepare(ctx context.Context, req *v1.ChangePrepareReq) (res *v1.ChangePrepareRes, err error) {
|
||||
prepare, err := service.AppCard().ChangePrepare(ctx, &req.AppCardChangePrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.ChangePrepareRes{AppCardChangePrepareModel: prepare}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) ChangeSubmit(ctx context.Context, req *v1.ChangeSubmitReq) (res *v1.ChangeSubmitRes, err error) {
|
||||
submit, err := service.AppCard().ChangeSubmit(ctx, &req.AppCardChangeSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.ChangeSubmitRes{AppCardChangeSubmitModel: submit}, nil
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) CustomerList(ctx context.Context, req *v1.CustomerListReq) (res *v1.CustomerListRes, err error) {
|
||||
items, total, err := service.AppUser().CustomerList(ctx, &req.AppCustomerListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.CustomerListRes{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) CustomerDetail(ctx context.Context, req *v1.CustomerDetailReq) (res *v1.CustomerDetailRes, err error) {
|
||||
customer, err := service.AppUser().CustomerDetail(ctx, &req.AppCustomerDetailParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.CustomerDetailRes{Customer: customer}, nil
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) DiagnosisInfo(ctx context.Context, req *v1.DiagnosisInfoReq) (res *v1.DiagnosisInfoRes, err error) {
|
||||
info, err := service.AppDiagnosis().Info(ctx, &req.AppDiagnosisInfoParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DiagnosisInfoRes{AppDiagnosisInfoModel: info}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) DiagnosisFlow(ctx context.Context, req *v1.DiagnosisFlowReq) (res *v1.DiagnosisFlowRes, err error) {
|
||||
flow, err := service.AppDiagnosis().Flow(ctx, &req.AppDiagnosisFlowParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DiagnosisFlowRes{AppDiagnosisFlowModel: flow}, nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) MessageList(ctx context.Context, req *v1.MessageListReq) (res *v1.MessageListRes, err error) {
|
||||
items, total, err := service.AppMessage().List(ctx, &req.AppMessageListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MessageListRes{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) MessageDetail(ctx context.Context, req *v1.MessageDetailReq) (res *v1.MessageDetailRes, err error) {
|
||||
message, err := service.AppMessage().Detail(ctx, &req.AppMessageDetailParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MessageDetailRes{Message: message}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) MessageRead(ctx context.Context, req *v1.MessageReadReq) (res *v1.MessageReadRes, err error) {
|
||||
err = service.AppMessage().Read(ctx, &req.AppMessageReadParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MessageReadRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) OpenDiagnosisInfo(ctx context.Context, req *v1.OpenDiagnosisInfoReq) (res *v1.OpenDiagnosisInfoRes, err error) {
|
||||
info, err := service.AppDiagnosis().OpenInfo(ctx, &req.AppOpenDiagnosisInfoParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.OpenDiagnosisInfoRes{AppDiagnosisInfoModel: info}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) OpenDiagnosisFlow(ctx context.Context, req *v1.OpenDiagnosisFlowReq) (res *v1.OpenDiagnosisFlowRes, err error) {
|
||||
flow, err := service.AppDiagnosis().OpenFlow(ctx, &req.AppOpenDiagnosisFlowParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.OpenDiagnosisFlowRes{AppDiagnosisFlowModel: flow}, nil
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) OrderList(ctx context.Context, req *v1.OrderListReq) (res *v1.OrderListRes, err error) {
|
||||
items, total, err := service.AppOrder().List(ctx, &req.AppOrderListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.OrderListRes{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) OrderDetail(ctx context.Context, req *v1.OrderDetailReq) (res *v1.OrderDetailRes, err error) {
|
||||
order, err := service.AppOrder().Detail(ctx, &req.AppOrderDetailParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.OrderDetailRes{Order: order}, nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) UserInfo(ctx context.Context, req *v1.UserInfoReq) (res *v1.UserInfoRes, err error) {
|
||||
user, err := service.AppUser().Info(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UserInfoRes{AppUserInfoModel: *user}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) UpdateUserInfo(ctx context.Context, req *v1.UpdateUserInfoReq) (res *v1.UpdateUserInfoRes, err error) {
|
||||
user, err := service.AppUser().UpdateInfo(ctx, &req.AppUpdateUserInfoParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UpdateUserInfoRes{AppUserInfoModel: *user}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) BindWechat(ctx context.Context, req *v1.BindWechatReq) (res *v1.BindWechatRes, err error) {
|
||||
data, err := service.AppUser().BindWechat(ctx, &req.AppWechatBindParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BindWechatRes{AppWechatBindModel: *data}, nil
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) WarningConfigList(ctx context.Context, req *v1.WarningConfigListReq) (res *v1.WarningConfigListRes, err error) {
|
||||
data, err := service.AppWarning().ConfigList(ctx, &req.AppWarningConfigListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WarningConfigListRes{AppWarningConfigListModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WarningConfigSave(ctx context.Context, req *v1.WarningConfigSaveReq) (res *v1.WarningConfigSaveRes, err error) {
|
||||
data, err := service.AppWarning().ConfigSave(ctx, &req.AppWarningConfigSaveParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WarningConfigSaveRes{AppWarningConfigSaveModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WarningConfigNotify(ctx context.Context, req *v1.WarningConfigNotifyReq) (res *v1.WarningConfigNotifyRes, err error) {
|
||||
data, err := service.AppWarning().ConfigNotify(ctx, &req.AppWarningConfigNotifyParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WarningConfigNotifyRes{AppWarningConfigNotifyModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WarningConfigMeta(ctx context.Context, req *v1.WarningConfigMetaReq) (res *v1.WarningConfigMetaRes, err error) {
|
||||
data, err := service.AppWarning().ConfigMeta(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WarningConfigMetaRes{AppWarningConfigMetaModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WarningConfigBatchSave(ctx context.Context, req *v1.WarningConfigBatchSaveReq) (res *v1.WarningConfigBatchSaveRes, err error) {
|
||||
data, err := service.AppWarning().ConfigBatchSave(ctx, &req.AppWarningConfigBatchSaveParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WarningConfigBatchSaveRes{AppWarningConfigBatchSaveModel: *data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WarningConfigBatchNotify(ctx context.Context, req *v1.WarningConfigBatchNotifyReq) (res *v1.WarningConfigBatchNotifyRes, err error) {
|
||||
data, err := service.AppWarning().ConfigBatchNotify(ctx, &req.AppWarningConfigBatchNotifyParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WarningConfigBatchNotifyRes{AppWarningConfigBatchNotifyModel: *data}, nil
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/app/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) WorkOrderList(ctx context.Context, req *v1.WorkOrderListReq) (res *v1.WorkOrderListRes, err error) {
|
||||
items, total, err := service.AppWorkOrder().List(ctx, &req.AppWorkOrderListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WorkOrderListRes{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WorkOrderDetail(ctx context.Context, req *v1.WorkOrderDetailReq) (res *v1.WorkOrderDetailRes, err error) {
|
||||
workOrder, err := service.AppWorkOrder().Detail(ctx, &req.AppWorkOrderDetailParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WorkOrderDetailRes{WorkOrder: workOrder}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WorkOrderCreate(ctx context.Context, req *v1.WorkOrderCreateReq) (res *v1.WorkOrderCreateRes, err error) {
|
||||
workOrder, err := service.AppWorkOrder().Create(ctx, &req.AppWorkOrderCreateParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WorkOrderCreateRes{WorkOrder: workOrder}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) WorkOrderUpload(ctx context.Context, req *v1.WorkOrderUploadReq) (res *v1.WorkOrderUploadRes, err error) {
|
||||
workOrderFile, err := service.AppWorkOrder().Upload(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.WorkOrderUploadRes{SysOssUploadModel: workOrderFile}, nil
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package common
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/api/common"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() common.ICommonV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/common/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysOssUpload(ctx context.Context, req *v1.SysOssUploadReq) (res *v1.SysOssUploadRes, err error) {
|
||||
|
||||
info, err := service.SysOss().Upload(ctx, req.SysOssUploadParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysOssUploadRes{
|
||||
SysOssUploadModel: info,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysOssDownload(ctx context.Context, req *v1.SysOssDownloadReq) (res *v1.SysOssDownloadRes, err error) {
|
||||
if _, err = service.SysOss().Download(ctx, req.SysOssDownloadParam); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if r := ghttp.RequestFromCtx(ctx); r != nil {
|
||||
r.ExitAll()
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/gen/testdemo/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/genin"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
TestDemo = cTestDemo{}
|
||||
)
|
||||
|
||||
type cTestDemo struct{}
|
||||
|
||||
// List 查看测试单表列表
|
||||
func (c *cTestDemo) TestDemoList(ctx context.Context, req *v1.TestDemoListReq) (res *v1.TestDemoListRes, err error) {
|
||||
list, totalCount, err := service.GenTestDemo().List(ctx, &req.TestDemoListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*genin.TestDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TestDemoListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出测试单表列表
|
||||
func (c *cTestDemo) TestDemoExport(ctx context.Context, req *v1.TestDemoExportReq) (res *v1.TestDemoExportRes, err error) {
|
||||
err = service.GenTestDemo().Export(ctx, &req.TestDemoListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新测试单表
|
||||
func (c *cTestDemo) TestDemoEdit(ctx context.Context, req *v1.TestDemoEditReq) (res *v1.TestDemoEditRes, err error) {
|
||||
err = service.GenTestDemo().Edit(ctx, &req.TestDemoEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定测试单表信息
|
||||
func (c *cTestDemo) TestDemoView(ctx context.Context, req *v1.TestDemoViewReq) (res *v1.TestDemoViewRes, err error) {
|
||||
data, err := service.GenTestDemo().View(ctx, &req.TestDemoViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TestDemoViewRes)
|
||||
res.TestDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除测试单表
|
||||
func (c *cTestDemo) TestDemoDelete(ctx context.Context, req *v1.TestDemoDeleteReq) (res *v1.TestDemoDeleteRes, err error) {
|
||||
err = service.GenTestDemo().Delete(ctx, &req.TestDemoDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/gen/testtree/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/genin"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
TestTree = cTestTree{}
|
||||
)
|
||||
|
||||
type cTestTree struct{}
|
||||
|
||||
// List 查看测试树表列表
|
||||
func (c *cTestTree) TestTreeList(ctx context.Context, req *v1.TestTreeListReq) (res *v1.TestTreeListRes, err error) {
|
||||
list, totalCount, err := service.GenTestTree().List(ctx, &req.TestTreeListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*genin.TestTreeListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TestTreeListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出测试树表列表
|
||||
func (c *cTestTree) TestTreeExport(ctx context.Context, req *v1.TestTreeExportReq) (res *v1.TestTreeExportRes, err error) {
|
||||
err = service.GenTestTree().Export(ctx, &req.TestTreeListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新测试树表
|
||||
func (c *cTestTree) TestTreeEdit(ctx context.Context, req *v1.TestTreeEditReq) (res *v1.TestTreeEditRes, err error) {
|
||||
err = service.GenTestTree().Edit(ctx, &req.TestTreeEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定测试树表信息
|
||||
func (c *cTestTree) TestTreeView(ctx context.Context, req *v1.TestTreeViewReq) (res *v1.TestTreeViewRes, err error) {
|
||||
data, err := service.GenTestTree().View(ctx, &req.TestTreeViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TestTreeViewRes)
|
||||
res.TestTreeViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除测试树表
|
||||
func (c *cTestTree) TestTreeDelete(ctx context.Context, req *v1.TestTreeDeleteReq) (res *v1.TestTreeDeleteRes, err error) {
|
||||
err = service.GenTestTree().Delete(ctx, &req.TestTreeDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取测试树表关系树选项
|
||||
func (c *cTestTree) TestTreeTreeOption(ctx context.Context, req *v1.TestTreeTreeOptionReq) (res *v1.TestTreeTreeOptionRes, err error) {
|
||||
data, err := service.GenTestTree().TreeOption(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(data) > 0 {
|
||||
res = (*v1.TestTreeTreeOptionRes)(&data)
|
||||
} else {
|
||||
temp := make(v1.TestTreeTreeOptionRes, 0)
|
||||
res = &temp
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package gen_codes
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package gen_codes
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/api/gen_codes"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() gen_codes.IGenCodesV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package gen_codes
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/gen_codes/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysGenTableList(ctx context.Context, req *v1.SysGenTableListReq) (res *v1.SysGenTableListRes, err error) {
|
||||
items, total, err := service.SysGenTable().List(ctx, req.SysGenTableListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysGenTableView(ctx context.Context, req *v1.SysGenTableViewReq) (res *v1.SysGenTableViewRes, err error) {
|
||||
item, err := service.SysGenTable().View(ctx, req.SysGenTableViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableViewRes{
|
||||
SysGenTableViewModel: item,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysGenTableAdd(ctx context.Context, req *v1.SysGenTableAddReq) (res *v1.SysGenTableAddRes, err error) {
|
||||
output, err := service.SysGenTable().Add(ctx, req.SysGenTableAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableAddRes{
|
||||
SysGenTableAddModel: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableDelete(ctx context.Context, req *v1.SysGenTableDeleteReq) (res *v1.SysGenTableDeleteRes, err error) {
|
||||
output, err := service.SysGenTable().Delete(ctx, req.SysGenTableDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableDeleteRes{
|
||||
SysGenTableDeleteModel: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableSelects(ctx context.Context, req *v1.SysGenTableSelectsReq) (res *v1.SysGenTableSelectsRes, err error) {
|
||||
output, err := service.SysGenTable().Selects(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableSelectsRes{
|
||||
SelectsModel: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableTableSelect(ctx context.Context, req *v1.SysGenTableTableSelectReq) (res *v1.SysGenTableTableSelectRes, err error) {
|
||||
output, err := service.SysGenTable().TableSelect(ctx, req.GenCodesTableSelectParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableTableSelectRes{
|
||||
Items: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableColumnSelect(ctx context.Context, req *v1.SysGenTableColumnSelectReq) (res *v1.SysGenTableColumnSelectRes, err error) {
|
||||
output, err := service.SysGenTable().ColumnSelect(ctx, req.GenCodesColumnSelectParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableColumnSelectRes{
|
||||
Items: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTablePreview(ctx context.Context, req *v1.SysGenTablePreviewReq) (res *v1.SysGenTablePreviewRes, err error) {
|
||||
output, err := service.SysGenTable().Preview(ctx, req.GenCodesPreviewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTablePreviewRes{
|
||||
GenCodesPreviewModel: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableBuild(ctx context.Context, req *v1.SysGenTableBuildReq) (res *v1.SysGenTableBuildRes, err error) {
|
||||
output, err := service.SysGenTable().Build(ctx, req.GenCodesBuildParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableBuildRes{
|
||||
GenCodesBuildModel: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableColumnList(ctx context.Context, req *v1.SysGenTableColumnListReq) (res *v1.SysGenTableColumnListRes, err error) {
|
||||
output, err := service.SysGenTable().ColumnList(ctx, req.GenCodesColumnListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableColumnListRes{
|
||||
Items: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) SysGenTableEdit(ctx context.Context, req *v1.SysGenTableEditReq) (res *v1.SysGenTableEditRes, err error) {
|
||||
output, err := service.SysGenTable().Edit(ctx, req.SysGenTableEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysGenTableEditRes{
|
||||
SysGenTableEditModel: output,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package info
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package info
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/api/info"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() info.IInfoV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package info
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/info/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Info(ctx context.Context, req *v1.InfoReq) (res *v1.InfoRes, err error) {
|
||||
info := service.Info().GetInfo()
|
||||
return &v1.InfoRes{
|
||||
InfoModel: info,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package monitor
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/api/monitor"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() monitor.IMonitorV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/monitor/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/utility"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) RedisInfo(ctx context.Context, req *v1.RedisInfoReq) (res *v1.RedisInfoRes, err error) {
|
||||
info, err := g.Redis().Do(ctx, "INFO")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
infoMap := make(map[string]string)
|
||||
for _, line := range strings.Split(info.String(), "\n") {
|
||||
if strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
parts := strings.Split(line, ":")
|
||||
if len(parts) == 2 {
|
||||
infoMap[parts[0]] = parts[1]
|
||||
}
|
||||
}
|
||||
dbSize := gconv.Int(infoMap["db0"])
|
||||
|
||||
info, err = g.Redis().Do(ctx, "INFO", "COMMANDSTATS")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commandStats := make([]*v1.CommandStats, 0)
|
||||
for _, line := range strings.Split(info.String(), "\n") {
|
||||
if strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
parts := strings.Split(line, ":")
|
||||
if len(parts) == 2 {
|
||||
if strings.HasPrefix(parts[0], "cmdstat_") {
|
||||
commandStats = append(commandStats, &v1.CommandStats{
|
||||
Name: strings.TrimPrefix(parts[0], "cmdstat_"),
|
||||
Value: utility.GetBetweenStr(parts[1], "calls=", ",usec"),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &v1.RedisInfoRes{
|
||||
Info: infoMap,
|
||||
DBSize: dbSize,
|
||||
CommandStats: commandStats,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
// List 查看用户通知公告表列表
|
||||
func (c *ControllerV1) SysNoticeUserList(ctx context.Context, req *v1.SysNoticeUserListReq) (res *v1.SysNoticeUserListRes, err error) {
|
||||
list, totalCount, err := service.SysNoticeUser().List(ctx, &req.SysNoticeUserListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.SysNoticeUserListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.SysNoticeUserListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出用户通知公告表列表
|
||||
func (c *ControllerV1) SysNoticeUserExport(ctx context.Context, req *v1.SysNoticeUserExportReq) (res *v1.SysNoticeUserExportRes, err error) {
|
||||
err = service.SysNoticeUser().Export(ctx, &req.SysNoticeUserListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新用户通知公告表
|
||||
func (c *ControllerV1) SysNoticeUserEdit(ctx context.Context, req *v1.SysNoticeUserEditReq) (res *v1.SysNoticeUserEditRes, err error) {
|
||||
err = service.SysNoticeUser().Edit(ctx, &req.SysNoticeUserEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定用户通知公告表信息
|
||||
func (c *ControllerV1) SysNoticeUserView(ctx context.Context, req *v1.SysNoticeUserViewReq) (res *v1.SysNoticeUserViewRes, err error) {
|
||||
data, err := service.SysNoticeUser().View(ctx, &req.SysNoticeUserViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.SysNoticeUserViewRes)
|
||||
res.SysNoticeUserViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除用户通知公告表
|
||||
func (c *ControllerV1) SysNoticeUserDelete(ctx context.Context, req *v1.SysNoticeUserDeleteReq) (res *v1.SysNoticeUserDeleteRes, err error) {
|
||||
err = service.SysNoticeUser().Delete(ctx, &req.SysNoticeUserDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新用户通知公告表状态
|
||||
func (c *ControllerV1) SysNoticeUserStatus(ctx context.Context, req *v1.SysNoticeUserStatusReq) (res *v1.SysNoticeUserStatusRes, err error) {
|
||||
err = service.SysNoticeUser().Status(ctx, &req.SysNoticeUserStatusParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Read 已读
|
||||
func (c *ControllerV1) SysNoticeUserRead(ctx context.Context, req *v1.SysNoticeUserReadReq) (res *v1.SysNoticeUserReadRes, err error) {
|
||||
err = service.SysNoticeUser().Read(ctx, &req.SysNoticeUserReadParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package system
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/api/system"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() system.ISystemV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/consts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/contexts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/event"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/mcache"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error) {
|
||||
userOut, token, err := service.SysAuth().Login(ctx, &model.LoginParams{
|
||||
CaptchaID: req.CaptchaID,
|
||||
CaptchaValue: req.CaptchaValue,
|
||||
Username: req.Username,
|
||||
Password: req.Password,
|
||||
TenantId: req.TenantId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.LoginRes{
|
||||
ID: userOut.ID,
|
||||
Username: userOut.Username,
|
||||
NickName: userOut.NickName,
|
||||
Avatar: userOut.Avatar,
|
||||
AccessToken: token,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) RefreshToken(ctx context.Context, req *v1.RefreshTokenReq) (res *v1.RefreshTokenRes, err error) {
|
||||
return nil, gerror.NewCode(gcode.CodeNotImplemented)
|
||||
}
|
||||
func (c *ControllerV1) Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error) {
|
||||
token, _ := service.SysAuth().GetAccessToken(ctx)
|
||||
service.SysUserOnline().DeleteByToken(ctx, token)
|
||||
event.EventsInstance().Emit(ctx, consts.EventKeyUserLogout, contexts.GetUserId(ctx))
|
||||
return &v1.LogoutRes{
|
||||
Data: "退出成功",
|
||||
Status: 200,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) GetAccessCodes(ctx context.Context, req *v1.GetAccessCodesReq) (res *v1.GetAccessCodesRes, err error) {
|
||||
if req.IsCache {
|
||||
accessCodes, _, err := mcache.GetUserAccessCodeList(ctx, contexts.GetUserId(ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.GetAccessCodesRes{
|
||||
Data: accessCodes,
|
||||
}
|
||||
} else {
|
||||
accessCodes, roleDataAccessCodes, err := service.SysAuth().GetUserAccessCodeList(ctx, contexts.GetUserId(ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mcache.SetUserAccessCodeList(ctx, contexts.GetUserId(ctx), accessCodes)
|
||||
mcache.SetUserRoleDataAccessCodeList(ctx, contexts.GetUserId(ctx), roleDataAccessCodes)
|
||||
res = &v1.GetAccessCodesRes{
|
||||
Data: accessCodes,
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c *ControllerV1) TenantList(ctx context.Context, req *v1.TenantListReq) (res *v1.TenantListRes, err error) {
|
||||
tenantList, _, err := service.SysTenant().List(ctx, &model.SysTenantListParam{
|
||||
Status: consts.SysDeptStatusNormal,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tenantEnabled := false
|
||||
if len(tenantList) > 1 {
|
||||
tenantEnabled = true
|
||||
}
|
||||
voList := make([]v1.TenantListData, 0)
|
||||
for _, tenant := range tenantList {
|
||||
voList = append(voList, v1.TenantListData{
|
||||
CompanyName: tenant.CompanyName,
|
||||
Domain: tenant.Domain,
|
||||
TenantId: tenant.TenantId,
|
||||
})
|
||||
}
|
||||
return &v1.TenantListRes{
|
||||
TenantEnabled: tenantEnabled,
|
||||
VoList: voList,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) GetCaptcha(ctx context.Context, req *v1.GetCaptchaReq) (res *v1.GetCaptchaRes, err error) {
|
||||
key, image, err := service.SysCaptcha().GenerateCaptcha(ctx)
|
||||
res = &v1.GetCaptchaRes{
|
||||
CaptchaID: key,
|
||||
CaptchaImage: image,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysClientList(ctx context.Context, req *v1.SysClientListReq) (res *v1.SysClientListRes, err error) {
|
||||
items, total, err := service.SysClient().List(ctx, &req.SysClientListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysClientListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysClientView(ctx context.Context, req *v1.SysClientViewReq) (res *v1.SysClientViewRes, err error) {
|
||||
info, err := service.SysClient().View(ctx, req.SysClientViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysClientViewRes{
|
||||
SysClientViewModel: info,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysClientAdd(ctx context.Context, req *v1.SysClientAddReq) (res *v1.SysClientAddRes, err error) {
|
||||
output, err := service.SysClient().Add(ctx, req.SysClientAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysClientAddRes{
|
||||
SysClientAddModel: output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysClientEdit(ctx context.Context, req *v1.SysClientEditReq) (res *v1.SysClientEditRes, err error) {
|
||||
output, err := service.SysClient().Edit(ctx, req.SysClientEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysClientEditRes{
|
||||
SysClientEditModel: output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysClientDelete(ctx context.Context, req *v1.SysClientDeleteReq) (res *v1.SysClientDeleteRes, err error) {
|
||||
output, err := service.SysClient().Delete(ctx, req.SysClientDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysClientDeleteRes{
|
||||
SysClientDeleteModel: output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysClientStatus(ctx context.Context, req *v1.SysClientStatusReq) (res *v1.SysClientStatusRes, err error) {
|
||||
output, err := service.SysClient().Status(ctx, req.SysClientStatusParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysClientStatusRes{
|
||||
SysClientStatusModel: output,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) GetConfigList(ctx context.Context, req *v1.GetConfigListReq) (res *v1.GetConfigListRes, err error) {
|
||||
|
||||
items, total, err := service.SysConfig().List(ctx, &req.SysConfigListParam)
|
||||
res = &v1.GetConfigListRes{
|
||||
Data: items,
|
||||
PageResult: response.PageResult{
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) AddConfig(ctx context.Context, req *v1.AddConfigReq) (res *v1.AddConfigRes, err error) {
|
||||
output, err := service.SysConfig().Add(ctx, &req.SysConfigAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.AddConfigRes{
|
||||
SysConfigAddModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) EditConfig(ctx context.Context, req *v1.EditConfigReq) (res *v1.EditConfigRes, err error) {
|
||||
output, err := service.SysConfig().Edit(ctx, &req.SysConfigEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.EditConfigRes{
|
||||
SysConfigEditModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) DeleteConfig(ctx context.Context, req *v1.DeleteConfigReq) (res *v1.DeleteConfigRes, err error) {
|
||||
output, err := service.SysConfig().Delete(ctx, &req.SysConfigDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.DeleteConfigRes{
|
||||
SysConfigDeleteModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) GetConfigById(ctx context.Context, req *v1.GetConfigByIdReq) (res *v1.GetConfigByIdRes, err error) {
|
||||
output, err := service.SysConfig().View(ctx, &req.SysConfigViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.GetConfigByIdRes{
|
||||
SysConfigViewModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) DeptList(ctx context.Context, req *v1.DeptListReq) (res *v1.DeptListRes, err error) {
|
||||
items, total, err := service.SysDept().GetDeptList(ctx, req.SysDeptListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeptListRes{
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
Data: items,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) DeptTree(ctx context.Context, req *v1.DeptTreeReq) (res *v1.DeptTreeRes, err error) {
|
||||
items, err := service.SysDept().GetDeptTree(ctx, req.SysDeptTreeParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeptTreeRes{
|
||||
Data: items,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) DeptAdd(ctx context.Context, req *v1.DeptAddReq) (res *v1.DeptAddRes, err error) {
|
||||
deptId, err := service.SysDept().AddDept(ctx, &req.SysDeptAddModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeptAddRes{
|
||||
DeptId: deptId,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) DeptEdit(ctx context.Context, req *v1.DeptEditReq) (res *v1.DeptEditRes, err error) {
|
||||
deptId, err := service.SysDept().EditDept(ctx, &req.SysDeptEditModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeptEditRes{
|
||||
DeptId: deptId,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) DeptDelete(ctx context.Context, req *v1.DeptDeleteReq) (res *v1.DeptDeleteRes, err error) {
|
||||
deptId, err := service.SysDept().DeleteDept(ctx, &req.SysDeptDeleteModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeptDeleteRes{
|
||||
DeptId: deptId,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) DeptView(ctx context.Context, req *v1.DeptViewReq) (res *v1.DeptViewRes, err error) {
|
||||
dept, err := service.SysDept().GetDeptById(ctx, req.SysDeptViewModel.DeptId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeptViewRes{
|
||||
SysDeptViewModel: *dept,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysDictTypeList(ctx context.Context, req *v1.SysDictTypeListReq) (res *v1.SysDictTypeListRes, err error) {
|
||||
items, total, err := service.SysDictType().List(ctx, &req.SysDictTypeListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictTypeListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysDictDataList(ctx context.Context, req *v1.SysDictDataListReq) (res *v1.SysDictDataListRes, err error) {
|
||||
items, total, err := service.SysDictData().List(ctx, &req.SysDictDataListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
typeData, err := service.SysDictType().View(ctx, &model.SysDictTypeViewParam{
|
||||
DictId: req.SysDictDataListParam.DictId,
|
||||
DictType: req.SysDictDataListParam.DictType,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysDictDataListRes{
|
||||
Items: items,
|
||||
Type: typeData,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictTypeAdd(ctx context.Context, req *v1.SysDictTypeAddReq) (res *v1.SysDictTypeAddRes, err error) {
|
||||
output, err := service.SysDictType().Add(ctx, &req.SysDictTypeAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictTypeAddRes{
|
||||
SysDictTypeAddModel: *output,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictTypeEdit(ctx context.Context, req *v1.SysDictTypeEditReq) (res *v1.SysDictTypeEditRes, err error) {
|
||||
output, err := service.SysDictType().Edit(ctx, &req.SysDictTypeEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictTypeEditRes{
|
||||
SysDictTypeEditModel: *output,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictTypeDelete(ctx context.Context, req *v1.SysDictTypeDeleteReq) (res *v1.SysDictTypeDeleteRes, err error) {
|
||||
output, err := service.SysDictType().Delete(ctx, &req.SysDictTypeDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictTypeDeleteRes{
|
||||
SysDictTypeDeleteModel: *output,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictTypeView(ctx context.Context, req *v1.SysDictTypeViewReq) (res *v1.SysDictTypeViewRes, err error) {
|
||||
output, err := service.SysDictType().View(ctx, &req.SysDictTypeViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictTypeViewRes{
|
||||
SysDictTypeViewModel: *output,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictDataAdd(ctx context.Context, req *v1.SysDictDataAddReq) (res *v1.SysDictDataAddRes, err error) {
|
||||
output, err := service.SysDictData().Add(ctx, &req.SysDictDataAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictDataAddRes{
|
||||
SysDictDataAddModel: *output,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictDataEdit(ctx context.Context, req *v1.SysDictDataEditReq) (res *v1.SysDictDataEditRes, err error) {
|
||||
output, err := service.SysDictData().Edit(ctx, &req.SysDictDataEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictDataEditRes{
|
||||
SysDictDataEditModel: *output,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictDataDelete(ctx context.Context, req *v1.SysDictDataDeleteReq) (res *v1.SysDictDataDeleteRes, err error) {
|
||||
_, err = service.SysDictData().Delete(ctx, &req.SysDictDataDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictDataDeleteRes{
|
||||
SysDictDataDeleteModel: model.SysDictDataDeleteModel{
|
||||
DictCodes: req.SysDictDataDeleteParam.DictCodes,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysDictDataView(ctx context.Context, req *v1.SysDictDataViewReq) (res *v1.SysDictDataViewRes, err error) {
|
||||
output, err := service.SysDictData().View(ctx, &req.SysDictDataViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysDictDataViewRes{
|
||||
SysDictDataViewModel: *output,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysJobList(ctx context.Context, req *v1.SysJobListReq) (res *v1.SysJobListRes, err error) {
|
||||
data, total, err := service.SysJob().List(ctx, &req.SysJobListParam, &req.PageInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysJobListRes{
|
||||
Data: data,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
|
||||
}
|
||||
func (c *ControllerV1) SysJobView(ctx context.Context, req *v1.SysJobViewReq) (res *v1.SysJobViewRes, err error) {
|
||||
data, err := service.SysJob().View(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobViewRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
|
||||
}
|
||||
func (c *ControllerV1) SysJobAdd(ctx context.Context, req *v1.SysJobAddReq) (res *v1.SysJobAddRes, err error) {
|
||||
lastInserId, err := service.SysJob().Add(ctx, &req.SysJobAddModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data, err := service.SysJob().View(ctx, lastInserId)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobAddRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
|
||||
}
|
||||
func (c *ControllerV1) SysJobUpdate(ctx context.Context, req *v1.SysJobUpdateReq) (res *v1.SysJobUpdateRes, err error) {
|
||||
effectedRow, err := service.SysJob().Update(ctx, &req.SysJobUpdateModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if effectedRow == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "要更新的数据不存在")
|
||||
}
|
||||
|
||||
data, err := service.SysJob().View(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobUpdateRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysJobUpdateStatus(ctx context.Context, req *v1.SysJobUpdateStatusReq) (res *v1.SysJobUpdateStatusRes, err error) {
|
||||
effectedRow, err := service.SysJob().UpdateStatus(ctx, &req.SysJobUpdateStatusModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if effectedRow == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "要更新的数据不存在")
|
||||
}
|
||||
|
||||
data, err := service.SysJob().View(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobUpdateStatusRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysJobDelete(ctx context.Context, req *v1.SysJobDeleteReq) (res *v1.SysJobDeleteRes, err error) {
|
||||
if len(req.JobIds) == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeMissingParameter, "参数不能为空")
|
||||
}
|
||||
|
||||
_, err = service.SysJob().Delete(ctx, &model.SysJobDeleteModel{JobIds: req.JobIds})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysJobDeleteRes{
|
||||
JobIds: req.JobIds,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysJobExec(ctx context.Context, req *v1.SysJobExecReq) (res *v1.SysJobExecRes, err error) {
|
||||
err = service.SysJob().Exec(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysJobExecRes{
|
||||
JobId: req.JobId,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) ListLogininfor(ctx context.Context, req *v1.ListLogininforReq) (res *v1.ListLogininforRes, err error) {
|
||||
items, total, err := service.SysLogininfor().List(ctx, &req.SysLogininforListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.ListLogininforRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) DeleteLogininfor(ctx context.Context, req *v1.DeleteLogininforReq) (res *v1.DeleteLogininforRes, err error) {
|
||||
out, err := service.SysLogininfor().Delete(ctx, &req.SysLogininforDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeleteLogininforRes{
|
||||
SysLogininforDeleteModel: *out,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) MenuAll(ctx context.Context, req *v1.MenuAllReq) (res *v1.MenuAllRes, err error) {
|
||||
data, err := service.SysMenu().GetUserMenuTree(ctx)
|
||||
return &data, err
|
||||
}
|
||||
func (c *ControllerV1) MenuList(ctx context.Context, req *v1.MenuListReq) (res *v1.MenuListRes, err error) {
|
||||
data, total, err := service.SysMenu().GetTenantMenu(ctx, &req.SysMenuListParam)
|
||||
return &v1.MenuListRes{
|
||||
Data: data,
|
||||
Total: total,
|
||||
}, err
|
||||
}
|
||||
func (c *ControllerV1) MenuView(ctx context.Context, req *v1.MenuViewReq) (res *v1.MenuViewRes, err error) {
|
||||
data, err := service.SysMenu().GetSysMenuView(ctx, req.MenuId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MenuViewRes{
|
||||
SysMenuViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) MenuAdd(ctx context.Context, req *v1.MenuAddReq) (res *v1.MenuAddRes, err error) {
|
||||
data, err := service.SysMenu().AddSysMenu(ctx, &req.SysMenuAddModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MenuAddRes{
|
||||
SysMenuViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) MenuUpdate(ctx context.Context, req *v1.MenuUpdateReq) (res *v1.MenuUpdateRes, err error) {
|
||||
data, err := service.SysMenu().UpdateSysMenu(ctx, &req.SysMenuUpdateModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MenuUpdateRes{
|
||||
SysMenuViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) MenuDelete(ctx context.Context, req *v1.MenuDeleteReq) (res *v1.MenuDeleteRes, err error) {
|
||||
err = service.SysMenu().DeleteSysMenu(ctx, req.MenuId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MenuDeleteRes{}, nil
|
||||
}
|
||||
func (c *ControllerV1) MenuTree(ctx context.Context, req *v1.MenuTreeReq) (res *v1.MenuTreeRes, err error) {
|
||||
return nil, gerror.NewCode(gcode.CodeNotImplemented)
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysNoticeList(ctx context.Context, req *v1.SysNoticeListReq) (res *v1.SysNoticeListRes, err error) {
|
||||
g.Log().Infof(ctx, "SystemControl.SysNoticeList %+v", req)
|
||||
items, total, err := service.SysNotice().List(ctx, req.SysNoticeListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysNoticeListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Total: total,
|
||||
Page: req.PageInfo.Page,
|
||||
PageSize: req.PageInfo.PageSize,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysNoticeAdd(ctx context.Context, req *v1.SysNoticeAddReq) (res *v1.SysNoticeAddRes, err error) {
|
||||
err = service.SysNotice().Add(ctx, req.SysNoticeAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysNoticeEdit(ctx context.Context, req *v1.SysNoticeEditReq) (res *v1.SysNoticeEditRes, err error) {
|
||||
err = service.SysNotice().Edit(ctx, req.SysNoticeEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysNoticeDelete(ctx context.Context, req *v1.SysNoticeDeleteReq) (res *v1.SysNoticeDeleteRes, err error) {
|
||||
err = service.SysNotice().Delete(ctx, req.SysNoticeDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysNoticeView(ctx context.Context, req *v1.SysNoticeViewReq) (res *v1.SysNoticeViewRes, err error) {
|
||||
data, err := service.SysNotice().View(ctx, req.SysNoticeViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysNoticeViewRes{
|
||||
SysNoticeViewModel: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysUserOnlineList(ctx context.Context, req *v1.SysUserOnlineListReq) (res *v1.SysUserOnlineListRes, err error) {
|
||||
items, total, err := service.SysUserOnline().List(ctx, &req.SysUserOnlineListParam, &req.PageInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysUserOnlineListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysUserOnlineDelete(ctx context.Context, req *v1.SysUserOnlineDeleteReq) (res *v1.SysUserOnlineDeleteRes, err error) {
|
||||
if len(req.Ids) == 0 {
|
||||
return nil, errors.New("ids不能为空")
|
||||
}
|
||||
err = service.SysUserOnline().Delete(ctx, req.Ids)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysUserOnlineDeleteRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) GetOperLogList(ctx context.Context, req *v1.GetOperLogListReq) (res *v1.GetOperLogListRes, err error) {
|
||||
items, total, err := service.SysOperLog().GetOperLogList(ctx, &req.SysOperLogListParam, &req.PageInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.GetOperLogListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysOssList(ctx context.Context, req *v1.SysOssListReq) (res *v1.SysOssListRes, err error) {
|
||||
items, total, err := service.SysOss().List(ctx, &req.SysOssListParam, &req.PageInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysOssListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysOssView(ctx context.Context, req *v1.SysOssViewReq) (res *v1.SysOssViewRes, err error) {
|
||||
info, err := service.SysOss().View(ctx, req.SysOssViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysOssViewRes{
|
||||
SysOssViewModel: info,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysOssDelete(ctx context.Context, req *v1.SysOssDeleteReq) (res *v1.SysOssDeleteRes, err error) {
|
||||
_, err = service.SysOss().Delete(ctx, req.SysOssDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysOssDeleteRes{}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysOssConfigList(ctx context.Context, req *v1.SysOssConfigListReq) (res *v1.SysOssConfigListRes, err error) {
|
||||
items, total, err := service.SysOssConfig().List(ctx, req.SysOssConfigListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysOssConfigListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysOssConfigView(ctx context.Context, req *v1.SysOssConfigViewReq) (res *v1.SysOssConfigViewRes, err error) {
|
||||
item, err := service.SysOssConfig().View(ctx, req.SysOssConfigViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysOssConfigViewRes{
|
||||
SysOssConfigViewModel: item,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysOssConfigAdd(ctx context.Context, req *v1.SysOssConfigAddReq) (res *v1.SysOssConfigAddRes, err error) {
|
||||
item, err := service.SysOssConfig().Add(ctx, req.SysOssConfigAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysOssConfigAddRes{
|
||||
SysOssConfigAddModel: item,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysOssConfigEdit(ctx context.Context, req *v1.SysOssConfigEditReq) (res *v1.SysOssConfigEditRes, err error) {
|
||||
item, err := service.SysOssConfig().Edit(ctx, req.SysOssConfigEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysOssConfigEditRes{
|
||||
SysOssConfigEditModel: item,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysOssConfigDelete(ctx context.Context, req *v1.SysOssConfigDeleteReq) (res *v1.SysOssConfigDeleteRes, err error) {
|
||||
item, err := service.SysOssConfig().Delete(ctx, req.SysOssConfigDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysOssConfigDeleteRes{
|
||||
SysOssConfigDeleteModel: item,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) PostList(ctx context.Context, req *v1.PostListReq) (res *v1.PostListRes, err error) {
|
||||
items, total, err := service.SysPost().List(ctx, req.SysPostListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PostListRes{
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
Data: items,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) PostAdd(ctx context.Context, req *v1.PostAddReq) (res *v1.PostAddRes, err error) {
|
||||
post, err := service.SysPost().Add(ctx, req.SysPostAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PostAddRes{
|
||||
SysPostAddModel: post,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) PostEdit(ctx context.Context, req *v1.PostEditReq) (res *v1.PostEditRes, err error) {
|
||||
post, err := service.SysPost().Edit(ctx, req.SysPostEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PostEditRes{
|
||||
SysPostEditModel: post,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) PostDelete(ctx context.Context, req *v1.PostDeleteReq) (res *v1.PostDeleteRes, err error) {
|
||||
post, err := service.SysPost().Delete(ctx, req.SysPostDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PostDeleteRes{
|
||||
SysPostDeleteModel: post,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) PostView(ctx context.Context, req *v1.PostViewReq) (res *v1.PostViewRes, err error) {
|
||||
post, err := service.SysPost().View(ctx, req.SysPostViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PostViewRes{
|
||||
SysPostViewModel: post,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) PostExport(ctx context.Context, req *v1.PostExportReq) (res *v1.PostExportRes, err error) {
|
||||
_, err = service.SysPost().Export(ctx, req.SysPostExportParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.PostExportRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
// 获取登录二维码
|
||||
func (c *ControllerV1) QrcodeLogin(ctx context.Context, req *v1.QrcodeLoginReq) (res *v1.QrcodeLoginRes, err error) {
|
||||
qrcodeLoginModel, err := service.SysQrcode().GetQrcodeLogin(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeLoginRes{
|
||||
QrcodeLoginModel: *qrcodeLoginModel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 获取登录二维码扫码结果
|
||||
func (c *ControllerV1) QrcodeLoginStatus(ctx context.Context, req *v1.QrcodeLoginStatusReq) (res *v1.QrcodeLoginStatusRes, err error) {
|
||||
qrcodeLoginModel, err := service.SysQrcode().GetQrcodeLoginStatus(ctx, req.TempUserId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeLoginStatusRes{
|
||||
QrcodeLoginModel: *qrcodeLoginModel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 获取绑定二维码
|
||||
func (c *ControllerV1) QrcodeBind(ctx context.Context, req *v1.QrcodeBindReq) (res *v1.QrcodeBindRes, err error) {
|
||||
qrcodeBindModel, err := service.SysQrcode().GetQrcodeBind(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeBindRes{
|
||||
QrcodeCacheModel: *qrcodeBindModel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 获取绑定二维码扫码结果
|
||||
func (c *ControllerV1) QrcodeBindStatus(ctx context.Context, req *v1.QrcodeBindStatusReq) (res *v1.QrcodeBindStatusRes, err error) {
|
||||
qrcodeBindStatusModel, err := service.SysQrcode().GetQrcodeBindStatus(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeBindStatusRes{
|
||||
QrcodeBindStatusModel: *qrcodeBindStatusModel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 扫码成功回调
|
||||
func (c *ControllerV1) QrcodeScanCallback(ctx context.Context, req *v1.QrcodeScanCallbackReq) (res *v1.QrcodeScanCallbackRes, err error) {
|
||||
err = service.SysQrcode().QrcodeScanCallback(ctx, &req.QrcodeScanCallbackParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeScanCallbackRes{}, nil
|
||||
}
|
||||
|
||||
// 注册并关联OpenId
|
||||
func (c *ControllerV1) QrcodeRegisterAndBindOpenId(ctx context.Context, req *v1.QrcodeRegisterAndBindOpenIdReq) (res *v1.QrcodeRegisterAndBindOpenIdRes, err error) {
|
||||
qrcodeLoginAndBindOpenIdModel, err := service.SysQrcode().QrcodeRegisterAndBindOpenId(ctx, &req.QrcodeRegisterAndBindOpenIdParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeRegisterAndBindOpenIdRes{
|
||||
QrcodeLoginAndBindOpenIdModel: *qrcodeLoginAndBindOpenIdModel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 登录并关联OpenId
|
||||
func (c *ControllerV1) QrcodeLoginAndBindOpenId(ctx context.Context, req *v1.QrcodeLoginAndBindOpenIdReq) (res *v1.QrcodeLoginAndBindOpenIdRes, err error) {
|
||||
qrcodeLoginAndBindOpenIdModel, err := service.SysQrcode().QrcodeLoginAndBindOpenId(ctx, &req.QrcodeLoginAndBindOpenIdParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeLoginAndBindOpenIdRes{
|
||||
QrcodeLoginAndBindOpenIdModel: *qrcodeLoginAndBindOpenIdModel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 扫码后选择用户登录
|
||||
func (c *ControllerV1) QrcodeLoginSelectUser(ctx context.Context, req *v1.QrcodeLoginSelectUserReq) (res *v1.QrcodeLoginSelectUserRes, err error) {
|
||||
qrcodeLoginAndBindOpenIdModel, err := service.SysQrcode().QrcodeLoginSelectUserId(ctx, &req.QrcodeLoginSelectUserIdParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.QrcodeLoginSelectUserRes{
|
||||
QrcodeLoginAndBindOpenIdModel: *qrcodeLoginAndBindOpenIdModel,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) {
|
||||
data, total, err := service.SysRole().List(ctx, &req.SysRoleListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RoleListRes{
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
Data: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) RoleAdd(ctx context.Context, req *v1.RoleAddReq) (res *v1.RoleAddRes, err error) {
|
||||
role, err := service.SysRole().Add(ctx, &req.SysRoleAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RoleAddRes{
|
||||
SysRoleAddModel: *role,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) RoleEdit(ctx context.Context, req *v1.RoleEditReq) (res *v1.RoleEditRes, err error) {
|
||||
role, err := service.SysRole().Edit(ctx, &req.SysRoleEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RoleEditRes{
|
||||
SysRoleEditModel: *role,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) {
|
||||
role, err := service.SysRole().Delete(ctx, &req.SysRoleDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RoleDeleteRes{
|
||||
SysRoleDeleteModel: *role,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error) {
|
||||
record, err := service.SysRole().View(ctx, &req.SysRoleViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RoleViewRes{
|
||||
SysRoleViewModel: *record,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) RoleDataScopeEdit(ctx context.Context, req *v1.RoleDataScopeEditReq) (res *v1.RoleDataScopeEditRes, err error) {
|
||||
err = service.SysRole().EditRoleDataScope(ctx, &req.SysRoleDataScopeEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RoleDataScopeEditRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysSocialList(ctx context.Context, req *v1.SysSocialListReq) (res *v1.SysSocialListRes, err error) {
|
||||
items, total, err := service.SysSocial().List(ctx, &req.SysSocialListParam, &req.PageInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysSocialListRes{
|
||||
Items: items,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// 删除绑定关系
|
||||
func (c *ControllerV1) SysSocialDelete(ctx context.Context, req *v1.SysSocialDeleteReq) (res *v1.SysSocialDeleteRes, err error) {
|
||||
err = service.SysSocial().Delete(ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysSocialDeleteRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysTenantList(ctx context.Context, req *v1.SysTenantListReq) (res *v1.SysTenantListRes, err error) {
|
||||
items, total, err := service.SysTenant().List(ctx, req.SysTenantListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysTenantListRes{
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
Items: items,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysTenantPackageList(ctx context.Context, req *v1.SysTenantPackageListReq) (res *v1.SysTenantPackageListRes, err error) {
|
||||
items, total, err := service.SysTenantPackage().List(ctx, &req.SysTenantPackageListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.SysTenantPackageListRes{
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
Items: items,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) SysTenantAdd(ctx context.Context, req *v1.SysTenantAddReq) (res *v1.SysTenantAddRes, err error) {
|
||||
data, err := service.SysTenant().Add(ctx, req.SysTenantAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantAddRes{
|
||||
SysTenantAddModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantEdit(ctx context.Context, req *v1.SysTenantEditReq) (res *v1.SysTenantEditRes, err error) {
|
||||
data, err := service.SysTenant().Edit(ctx, req.SysTenantEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantEditRes{
|
||||
SysTenantEditModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantDelete(ctx context.Context, req *v1.SysTenantDeleteReq) (res *v1.SysTenantDeleteRes, err error) {
|
||||
data, err := service.SysTenant().Delete(ctx, req.SysTenantDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantDeleteRes{
|
||||
SysTenantDeleteModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantStatus(ctx context.Context, req *v1.SysTenantStatusReq) (res *v1.SysTenantStatusRes, err error) {
|
||||
data, err := service.SysTenant().Status(ctx, req.SysTenantStatusParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantStatusRes{
|
||||
SysTenantStatusModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantView(ctx context.Context, req *v1.SysTenantViewReq) (res *v1.SysTenantViewRes, err error) {
|
||||
data, err := service.SysTenant().View(ctx, req.SysTenantViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantViewRes{
|
||||
SysTenantViewModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantPackageView(ctx context.Context, req *v1.SysTenantPackageViewReq) (res *v1.SysTenantPackageViewRes, err error) {
|
||||
data, err := service.SysTenantPackage().View(ctx, req.SysTenantPackageViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantPackageViewRes{
|
||||
SysTenantPackageViewModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantPackageStatus(ctx context.Context, req *v1.SysTenantPackageStatusReq) (res *v1.SysTenantPackageStatusRes, err error) {
|
||||
data, err := service.SysTenantPackage().Status(ctx, req.SysTenantPackageStatusParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantPackageStatusRes{
|
||||
SysTenantPackageStatusModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantPackageAdd(ctx context.Context, req *v1.SysTenantPackageAddReq) (res *v1.SysTenantPackageAddRes, err error) {
|
||||
data, err := service.SysTenantPackage().Add(ctx, req.SysTenantPackageAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantPackageAddRes{
|
||||
SysTenantPackageAddModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantPackageEdit(ctx context.Context, req *v1.SysTenantPackageEditReq) (res *v1.SysTenantPackageEditRes, err error) {
|
||||
data, err := service.SysTenantPackage().Edit(ctx, req.SysTenantPackageEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantPackageEditRes{
|
||||
SysTenantPackageEditModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantPackageDelete(ctx context.Context, req *v1.SysTenantPackageDeleteReq) (res *v1.SysTenantPackageDeleteRes, err error) {
|
||||
data, err := service.SysTenantPackage().Delete(ctx, req.SysTenantPackageDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantPackageDeleteRes{
|
||||
SysTenantPackageDeleteModel: data,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) SysTenantSyncMenu(ctx context.Context, req *v1.SysTenantSyncMenuReq) (res *v1.SysTenantSyncMenuRes, err error) {
|
||||
err = service.SysTenant().SyncTenantMenu(ctx, req.TenantId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysTenantSyncMenuRes{
|
||||
SysTenantSyncMenuModel: &model.SysTenantSyncMenuModel{},
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/contexts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/request"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) UserInfo(ctx context.Context, req *v1.UserInfoReq) (res *v1.UserInfoRes, err error) {
|
||||
// 获取token
|
||||
userId := contexts.GetUserId(ctx)
|
||||
if userId == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeSecurityReason)
|
||||
}
|
||||
// 获取用户信息
|
||||
user, err := service.SysUser().GetUserById(ctx, userId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
menus, err := service.SysMenu().GetUserMenuTree(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
homePath := ""
|
||||
firstMenu := "404"
|
||||
if len(menus) > 0 {
|
||||
for _, menu := range menus {
|
||||
firstMenu = menu.Path
|
||||
if len(menu.Children) == 0 {
|
||||
break
|
||||
}
|
||||
for _, menu2 := range menu.Children {
|
||||
firstMenu = firstMenu + "/" + menu2.Path
|
||||
if len(menu2.Children) == 0 {
|
||||
break
|
||||
}
|
||||
for _, menu3 := range menu2.Children {
|
||||
firstMenu = firstMenu + "/" + menu3.Path
|
||||
if len(menu3.Children) == 0 {
|
||||
break
|
||||
}
|
||||
for _, menu4 := range menu3.Children {
|
||||
firstMenu = firstMenu + "/" + menu4.Path
|
||||
if len(menu4.Children) == 0 {
|
||||
break
|
||||
}
|
||||
for _, menu5 := range menu4.Children {
|
||||
firstMenu = firstMenu + "/" + menu5.Path
|
||||
if len(menu5.Children) == 0 {
|
||||
break
|
||||
}
|
||||
for _, menu6 := range menu5.Children {
|
||||
firstMenu = firstMenu + "/" + menu6.Path
|
||||
if len(menu6.Children) == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
g.Log().Debugf(ctx, "firstMenu: %s", firstMenu)
|
||||
if homePath == "" {
|
||||
homePath = "/" + firstMenu
|
||||
}
|
||||
|
||||
return &v1.UserInfoRes{
|
||||
UserInfo: v1.UserInfo{
|
||||
Id: user.UserId,
|
||||
Username: user.UserName,
|
||||
Nickname: user.NickName,
|
||||
Avatar: user.Avatar,
|
||||
Email: user.Email,
|
||||
HomePath: homePath,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error) {
|
||||
// 获取用户列表
|
||||
users, total, err := service.SysUser().List(ctx, &req.PageInfo, &req.UserListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UserListRes{
|
||||
Data: users,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) AddUser(ctx context.Context, req *v1.AddUserReq) (res *v1.AddUserRes, err error) {
|
||||
data, err := service.SysUser().AddUser(ctx, &req.SysUserAddModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.AddUserRes{
|
||||
Data: data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) UserProfile(ctx context.Context, req *v1.UserProfileReq) (res *v1.UserProfileRes, err error) {
|
||||
user, err := service.SysUser().Profile(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UserProfileRes{
|
||||
User: user,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) UpdateCurrentUser(ctx context.Context, req *v1.UpdateCurrentUserReq) (res *v1.UpdateCurrentUserRes, err error) {
|
||||
user, err := service.SysUser().UpdateCurrentUser(ctx, &req.UpdateCurrentUserModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UpdateCurrentUserRes{
|
||||
UserInfo: v1.UserInfo{
|
||||
Id: user.UserId,
|
||||
Username: user.UserName,
|
||||
Nickname: user.NickName,
|
||||
Avatar: user.Avatar,
|
||||
Email: user.Email,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) UpdateCurrentUserPassword(ctx context.Context, req *v1.UpdateCurrentUserPasswordReq) (res *v1.UpdateCurrentUserPasswordRes, err error) {
|
||||
err = service.SysUser().UpdateCurrentUserPassword(ctx, &req.UpdateCurrentUserPasswordModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UpdateCurrentUserPasswordRes{}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) UpdateUser(ctx context.Context, req *v1.UpdateUserReq) (res *v1.UpdateUserRes, err error) {
|
||||
err = service.SysUser().UpdateUser(ctx, &req.SysUserUpdateModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := service.SysUser().GetUserById(ctx, req.UserId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UpdateUserRes{
|
||||
SysUserViewModel: *user,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) DeleteUser(ctx context.Context, req *v1.DeleteUserReq) (res *v1.DeleteUserRes, err error) {
|
||||
if req.UserId != 0 {
|
||||
err = service.SysUser().DeleteUser(ctx, []int64{req.UserId})
|
||||
} else {
|
||||
err = service.SysUser().DeleteUser(ctx, req.UserIds)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DeleteUserRes{}, nil
|
||||
}
|
||||
func (c *ControllerV1) GetUser(ctx context.Context, req *v1.GetUserReq) (res *v1.GetUserRes, err error) {
|
||||
// 如果调用方传入 userId == 0,则不返回错误,直接返回空的用户视图结构
|
||||
if req.UserId == 0 {
|
||||
return &v1.GetUserRes{
|
||||
SysUserViewModel: model.SysUserViewModel{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
user, err := service.SysUser().GetUserById(ctx, req.UserId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.GetUserRes{
|
||||
SysUserViewModel: *user,
|
||||
}, nil
|
||||
}
|
||||
func (c *ControllerV1) ResetPassword(ctx context.Context, req *v1.ResetPasswordReq) (res *v1.ResetPasswordRes, err error) {
|
||||
err = service.SysUser().ResetPassword(ctx, req.UserId, req.Password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.ResetPasswordRes{}, nil
|
||||
}
|
||||
func (c *ControllerV1) GetUserListByDeptId(ctx context.Context, req *v1.GetUserListByDeptIdReq) (res *v1.GetUserListByDeptIdRes, err error) {
|
||||
users, total, err := service.SysUser().List(ctx, &request.PageInfo{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
}, &model.UserListParam{
|
||||
DeptId: req.DeptId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
miniUsers := make([]*model.SysUserMiniModel, 0)
|
||||
gconv.Structs(users, &miniUsers)
|
||||
return &v1.GetUserListByDeptIdRes{
|
||||
Items: miniUsers,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UserRegister 用户注册
|
||||
func (c *ControllerV1) UserRegister(ctx context.Context, req *v1.UserRegisterReq) (res *v1.UserRegisterRes, err error) {
|
||||
err = service.SysUser().Register(ctx, &req.SysUserRegisterModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UserRegisterRes{}, nil
|
||||
}
|
||||
|
||||
// UserStatus 更新用户状态
|
||||
func (c *ControllerV1) UserStatus(ctx context.Context, req *v1.UserStatusReq) (res *v1.UserStatusRes, err error) {
|
||||
err = service.SysUser().Status(ctx, &req.SysUserStatusParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.UserStatusRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao/internal"
|
||||
)
|
||||
|
||||
// batchDetailDao is the data access object for the table batch_detail.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type batchDetailDao struct {
|
||||
*internal.BatchDetailDao
|
||||
}
|
||||
|
||||
var (
|
||||
// BatchDetail is a globally accessible object for table batch_detail operations.
|
||||
BatchDetail = batchDetailDao{internal.NewBatchDetailDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao/internal"
|
||||
)
|
||||
|
||||
// batchMainDao is the data access object for the table batch_main.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type batchMainDao struct {
|
||||
*internal.BatchMainDao
|
||||
}
|
||||
|
||||
var (
|
||||
// BatchMain is a globally accessible object for table batch_main operations.
|
||||
BatchMain = batchMainDao{internal.NewBatchMainDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao/internal"
|
||||
)
|
||||
|
||||
// cardChannelAssocDao is the data access object for the table card_channel_assoc.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type cardChannelAssocDao struct {
|
||||
*internal.CardChannelAssocDao
|
||||
}
|
||||
|
||||
var (
|
||||
// CardChannelAssoc is a globally accessible object for table card_channel_assoc operations.
|
||||
CardChannelAssoc = cardChannelAssocDao{internal.NewCardChannelAssocDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao/internal"
|
||||
)
|
||||
|
||||
// genTableDao is the data access object for the table gen_table.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type genTableDao struct {
|
||||
*internal.GenTableDao
|
||||
}
|
||||
|
||||
var (
|
||||
// GenTable is a globally accessible object for table gen_table operations.
|
||||
GenTable = genTableDao{internal.NewGenTableDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao/internal"
|
||||
)
|
||||
|
||||
// genTableColumnDao is the data access object for the table gen_table_column.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type genTableColumnDao struct {
|
||||
*internal.GenTableColumnDao
|
||||
}
|
||||
|
||||
var (
|
||||
// GenTableColumn is a globally accessible object for table gen_table_column operations.
|
||||
GenTableColumn = genTableColumnDao{internal.NewGenTableColumnDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,109 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// BatchDetailDao is the data access object for the table batch_detail.
|
||||
type BatchDetailDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns BatchDetailColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// BatchDetailColumns defines and stores column names for the table batch_detail.
|
||||
type BatchDetailColumns struct {
|
||||
Id string // 主键ID
|
||||
BatchNo string // 批次编号
|
||||
BatchType string // 批次类型 枚举(与主表一致)
|
||||
DetailStatus string // 明细异步处理状态 0-待处理 1-处理中 2-成功 3-失败
|
||||
BlankOutStatus string // 作废状态 0-是 1-否
|
||||
RowNo string // 行号
|
||||
ItemId string // 项ID:卡ICCID/设备编码
|
||||
ErrorCode string // 异常编码
|
||||
ErrorReason string // 异常原因
|
||||
Snapshot string // 信息快照
|
||||
TenantId string // 租户ID
|
||||
CreatedDept string // 创建部门ID
|
||||
CreatedBy string // 创建者ID
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者ID
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// batchDetailColumns holds the columns for the table batch_detail.
|
||||
var batchDetailColumns = BatchDetailColumns{
|
||||
Id: "id",
|
||||
BatchNo: "batch_no",
|
||||
BatchType: "batch_type",
|
||||
DetailStatus: "detail_status",
|
||||
BlankOutStatus: "blank_out_status",
|
||||
RowNo: "row_no",
|
||||
ItemId: "item_id",
|
||||
ErrorCode: "error_code",
|
||||
ErrorReason: "error_reason",
|
||||
Snapshot: "snapshot",
|
||||
TenantId: "tenant_id",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewBatchDetailDao creates and returns a new DAO object for table data access.
|
||||
func NewBatchDetailDao(handlers ...gdb.ModelHandler) *BatchDetailDao {
|
||||
return &BatchDetailDao{
|
||||
group: "default",
|
||||
table: "batch_detail",
|
||||
columns: batchDetailColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *BatchDetailDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *BatchDetailDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *BatchDetailDao) Columns() BatchDetailColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *BatchDetailDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *BatchDetailDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *BatchDetailDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// BatchMainDao is the data access object for the table batch_main.
|
||||
type BatchMainDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns BatchMainColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// BatchMainColumns defines and stores column names for the table batch_main.
|
||||
type BatchMainColumns struct {
|
||||
Id string // 主键ID
|
||||
BatchNo string // 批次编号
|
||||
OrderSn string // 订单编号
|
||||
BatchType string // 批次类型 枚举
|
||||
BatchStatus string // 批次状态 枚举
|
||||
BatchAsyncStatus string // 异步处理状态 0=已创建 1=待处理 2=处理中 3=成功 4=失败 5=部分成功
|
||||
SourceType string // 来源方式 枚举
|
||||
SourceBatchNo string // 来源批次编号
|
||||
SourceOssId string // 源文件OSS ID
|
||||
ResultOssId string // 结果文件OSS ID
|
||||
IsCrossDept string // 是否跨级操作机构 0-否 1-是
|
||||
TargetDeptId string // 目标机构编号
|
||||
DeptId string // 机构编号
|
||||
TotalCount string // 总数量
|
||||
ValidCount string // 有效数量
|
||||
SuccessCount string // 成功数量
|
||||
FailCount string // 失败数量
|
||||
RunResult string // 运行结果:0-待运行 1-运行中 2-成功 3-失败
|
||||
FailReason string // 失败原因
|
||||
BatchInfo string // 批次信息:入库/出库展示字段
|
||||
Remark string // 备注扩展字段
|
||||
StartTime string // 开始时间
|
||||
EndTime string // 结束时间
|
||||
TenantId string // 租户ID
|
||||
CreatedDept string // 创建部门ID
|
||||
CreatedBy string // 创建者ID
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者ID
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// batchMainColumns holds the columns for the table batch_main.
|
||||
var batchMainColumns = BatchMainColumns{
|
||||
Id: "id",
|
||||
BatchNo: "batch_no",
|
||||
OrderSn: "order_sn",
|
||||
BatchType: "batch_type",
|
||||
BatchStatus: "batch_status",
|
||||
BatchAsyncStatus: "batch_async_status",
|
||||
SourceType: "source_type",
|
||||
SourceBatchNo: "source_batch_no",
|
||||
SourceOssId: "source_oss_id",
|
||||
ResultOssId: "result_oss_id",
|
||||
IsCrossDept: "is_cross_dept",
|
||||
TargetDeptId: "target_dept_id",
|
||||
DeptId: "dept_id",
|
||||
TotalCount: "total_count",
|
||||
ValidCount: "valid_count",
|
||||
SuccessCount: "success_count",
|
||||
FailCount: "fail_count",
|
||||
RunResult: "run_result",
|
||||
FailReason: "fail_reason",
|
||||
BatchInfo: "batch_info",
|
||||
Remark: "remark",
|
||||
StartTime: "start_time",
|
||||
EndTime: "end_time",
|
||||
TenantId: "tenant_id",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewBatchMainDao creates and returns a new DAO object for table data access.
|
||||
func NewBatchMainDao(handlers ...gdb.ModelHandler) *BatchMainDao {
|
||||
return &BatchMainDao{
|
||||
group: "default",
|
||||
table: "batch_main",
|
||||
columns: batchMainColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *BatchMainDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *BatchMainDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *BatchMainDao) Columns() BatchMainColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *BatchMainDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *BatchMainDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *BatchMainDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CardChannelAssocDao is the data access object for the table card_channel_assoc.
|
||||
type CardChannelAssocDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns CardChannelAssocColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// CardChannelAssocColumns defines and stores column names for the table card_channel_assoc.
|
||||
type CardChannelAssocColumns struct {
|
||||
Id string // 主键
|
||||
ChannelId string // 通道ID
|
||||
MatchType string // 匹配类型: 1单卡 2号段
|
||||
Iccid string // 单卡ICCID
|
||||
IccidStart string // 号段起始ICCID
|
||||
IccidEnd string // 号段结束ICCID
|
||||
Status string // 状态: 1启用 0停用
|
||||
Remark string // 备注
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// cardChannelAssocColumns holds the columns for the table card_channel_assoc.
|
||||
var cardChannelAssocColumns = CardChannelAssocColumns{
|
||||
Id: "id",
|
||||
ChannelId: "channel_id",
|
||||
MatchType: "match_type",
|
||||
Iccid: "iccid",
|
||||
IccidStart: "iccid_start",
|
||||
IccidEnd: "iccid_end",
|
||||
Status: "status",
|
||||
Remark: "remark",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewCardChannelAssocDao creates and returns a new DAO object for table data access.
|
||||
func NewCardChannelAssocDao(handlers ...gdb.ModelHandler) *CardChannelAssocDao {
|
||||
return &CardChannelAssocDao{
|
||||
group: "default",
|
||||
table: "card_channel_assoc",
|
||||
columns: cardChannelAssocColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *CardChannelAssocDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *CardChannelAssocDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *CardChannelAssocDao) Columns() CardChannelAssocColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *CardChannelAssocDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *CardChannelAssocDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *CardChannelAssocDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// GenTableDao is the data access object for the table gen_table.
|
||||
type GenTableDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns GenTableColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// GenTableColumns defines and stores column names for the table gen_table.
|
||||
type GenTableColumns struct {
|
||||
TableId string // 编号
|
||||
DataName string // 数据源名称
|
||||
TableName string // 表名称
|
||||
TableComment string // 表描述
|
||||
SubTableName string // 关联子表的表名
|
||||
SubTableFkName string // 子表关联的外键名
|
||||
ClassName string // 实体类名称
|
||||
TplCategory string // 使用的模板(crud单表操作 tree树表操作)
|
||||
PackageName string // 生成包路径
|
||||
ModuleName string // 生成模块名
|
||||
BusinessName string // 生成业务名
|
||||
FunctionName string // 生成功能名
|
||||
FunctionAuthor string // 生成功能作者
|
||||
GenType string // 生成代码方式(0zip压缩包 1自定义路径)
|
||||
GenPath string // 生成路径(不填默认项目路径)
|
||||
Options string // 其它生成选项
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// genTableColumns holds the columns for the table gen_table.
|
||||
var genTableColumns = GenTableColumns{
|
||||
TableId: "table_id",
|
||||
DataName: "data_name",
|
||||
TableName: "table_name",
|
||||
TableComment: "table_comment",
|
||||
SubTableName: "sub_table_name",
|
||||
SubTableFkName: "sub_table_fk_name",
|
||||
ClassName: "class_name",
|
||||
TplCategory: "tpl_category",
|
||||
PackageName: "package_name",
|
||||
ModuleName: "module_name",
|
||||
BusinessName: "business_name",
|
||||
FunctionName: "function_name",
|
||||
FunctionAuthor: "function_author",
|
||||
GenType: "gen_type",
|
||||
GenPath: "gen_path",
|
||||
Options: "options",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewGenTableDao creates and returns a new DAO object for table data access.
|
||||
func NewGenTableDao(handlers ...gdb.ModelHandler) *GenTableDao {
|
||||
return &GenTableDao{
|
||||
group: "default",
|
||||
table: "gen_table",
|
||||
columns: genTableColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *GenTableDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *GenTableDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *GenTableDao) Columns() GenTableColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *GenTableDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *GenTableDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *GenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// GenTableColumnDao is the data access object for the table gen_table_column.
|
||||
type GenTableColumnDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns GenTableColumnColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// GenTableColumnColumns defines and stores column names for the table gen_table_column.
|
||||
type GenTableColumnColumns struct {
|
||||
ColumnId string // 编号
|
||||
TableId string // 归属表编号
|
||||
ColumnName string // 列名称
|
||||
ColumnComment string // 列描述
|
||||
ColumnType string // 列类型
|
||||
JavaType string // JAVA类型
|
||||
JavaField string // JAVA字段名
|
||||
IsPk string // 是否主键(1是)
|
||||
IsIncrement string // 是否自增(1是)
|
||||
IsRequired string // 是否必填(1是)
|
||||
IsInsert string // 是否为插入字段(1是)
|
||||
IsEdit string // 是否编辑字段(1是)
|
||||
IsList string // 是否列表字段(1是)
|
||||
IsQuery string // 是否查询字段(1是)
|
||||
QueryType string // 查询方式(等于、不等于、大于、小于、范围)
|
||||
HtmlType string // 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
|
||||
DictType string // 字典类型
|
||||
Sort string // 排序
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// genTableColumnColumns holds the columns for the table gen_table_column.
|
||||
var genTableColumnColumns = GenTableColumnColumns{
|
||||
ColumnId: "column_id",
|
||||
TableId: "table_id",
|
||||
ColumnName: "column_name",
|
||||
ColumnComment: "column_comment",
|
||||
ColumnType: "column_type",
|
||||
JavaType: "java_type",
|
||||
JavaField: "java_field",
|
||||
IsPk: "is_pk",
|
||||
IsIncrement: "is_increment",
|
||||
IsRequired: "is_required",
|
||||
IsInsert: "is_insert",
|
||||
IsEdit: "is_edit",
|
||||
IsList: "is_list",
|
||||
IsQuery: "is_query",
|
||||
QueryType: "query_type",
|
||||
HtmlType: "html_type",
|
||||
DictType: "dict_type",
|
||||
Sort: "sort",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewGenTableColumnDao creates and returns a new DAO object for table data access.
|
||||
func NewGenTableColumnDao(handlers ...gdb.ModelHandler) *GenTableColumnDao {
|
||||
return &GenTableColumnDao{
|
||||
group: "default",
|
||||
table: "gen_table_column",
|
||||
columns: genTableColumnColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *GenTableColumnDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *GenTableColumnDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *GenTableColumnDao) Columns() GenTableColumnColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *GenTableColumnDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *GenTableColumnDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *GenTableColumnDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysClientDao is the data access object for the table sys_client.
|
||||
type SysClientDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysClientColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysClientColumns defines and stores column names for the table sys_client.
|
||||
type SysClientColumns struct {
|
||||
Id string // id
|
||||
ClientId string // 客户端id
|
||||
ClientKey string // 客户端key
|
||||
ClientSecret string // 客户端秘钥
|
||||
GrantType string // 授权类型
|
||||
DeviceType string // 设备类型
|
||||
ActiveTimeout string // token活跃超时时间
|
||||
Timeout string // token固定超时
|
||||
Status string // 状态(0正常 1停用)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedBy string // 删除人
|
||||
DeletedAt string // 删除时间
|
||||
}
|
||||
|
||||
// sysClientColumns holds the columns for the table sys_client.
|
||||
var sysClientColumns = SysClientColumns{
|
||||
Id: "id",
|
||||
ClientId: "client_id",
|
||||
ClientKey: "client_key",
|
||||
ClientSecret: "client_secret",
|
||||
GrantType: "grant_type",
|
||||
DeviceType: "device_type",
|
||||
ActiveTimeout: "active_timeout",
|
||||
Timeout: "timeout",
|
||||
Status: "status",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedBy: "deleted_by",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewSysClientDao creates and returns a new DAO object for table data access.
|
||||
func NewSysClientDao(handlers ...gdb.ModelHandler) *SysClientDao {
|
||||
return &SysClientDao{
|
||||
group: "default",
|
||||
table: "sys_client",
|
||||
columns: sysClientColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysClientDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysClientDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysClientDao) Columns() SysClientColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysClientDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysClientDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysClientDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysConfigDao is the data access object for the table sys_config.
|
||||
type SysConfigDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysConfigColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysConfigColumns defines and stores column names for the table sys_config.
|
||||
type SysConfigColumns struct {
|
||||
ConfigId string // 参数主键
|
||||
TenantId string // 租户编号
|
||||
ConfigName string // 参数名称
|
||||
ConfigKey string // 参数键名
|
||||
ConfigValue string // 参数键值
|
||||
ConfigType string // 系统内置(Y是 N否)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysConfigColumns holds the columns for the table sys_config.
|
||||
var sysConfigColumns = SysConfigColumns{
|
||||
ConfigId: "config_id",
|
||||
TenantId: "tenant_id",
|
||||
ConfigName: "config_name",
|
||||
ConfigKey: "config_key",
|
||||
ConfigValue: "config_value",
|
||||
ConfigType: "config_type",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysConfigDao creates and returns a new DAO object for table data access.
|
||||
func NewSysConfigDao(handlers ...gdb.ModelHandler) *SysConfigDao {
|
||||
return &SysConfigDao{
|
||||
group: "default",
|
||||
table: "sys_config",
|
||||
columns: sysConfigColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysConfigDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysConfigDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysConfigDao) Columns() SysConfigColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysConfigDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysDeptDao is the data access object for the table sys_dept.
|
||||
type SysDeptDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysDeptColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysDeptColumns defines and stores column names for the table sys_dept.
|
||||
type SysDeptColumns struct {
|
||||
DeptId string // 部门id
|
||||
TenantId string // 租户编号
|
||||
ParentId string // 父部门id
|
||||
Ancestors string // 祖级列表
|
||||
DeptKey string // 机构编号
|
||||
DeptName string // 部门名称
|
||||
DeptType string // 部门类型(0:部门 1:公司)
|
||||
DeptCategory string // 部门类别编码
|
||||
OrderNum string // 显示顺序
|
||||
Leader string // 负责人
|
||||
Phone string // 联系电话
|
||||
Email string // 邮箱
|
||||
Status string // 部门状态(0正常 1停用)
|
||||
CreditCode string // 统一社会信用代码
|
||||
AreaCode string // 行政区域代码
|
||||
Address string // 地址
|
||||
DeptRole string // 机构默认角色ID
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedBy string // 删除人
|
||||
DeletedAt string // 删除时间
|
||||
}
|
||||
|
||||
// sysDeptColumns holds the columns for the table sys_dept.
|
||||
var sysDeptColumns = SysDeptColumns{
|
||||
DeptId: "dept_id",
|
||||
TenantId: "tenant_id",
|
||||
ParentId: "parent_id",
|
||||
Ancestors: "ancestors",
|
||||
DeptKey: "dept_key",
|
||||
DeptName: "dept_name",
|
||||
DeptType: "dept_type",
|
||||
DeptCategory: "dept_category",
|
||||
OrderNum: "order_num",
|
||||
Leader: "leader",
|
||||
Phone: "phone",
|
||||
Email: "email",
|
||||
Status: "status",
|
||||
CreditCode: "credit_code",
|
||||
AreaCode: "area_code",
|
||||
Address: "address",
|
||||
DeptRole: "dept_role",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedBy: "deleted_by",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewSysDeptDao creates and returns a new DAO object for table data access.
|
||||
func NewSysDeptDao(handlers ...gdb.ModelHandler) *SysDeptDao {
|
||||
return &SysDeptDao{
|
||||
group: "default",
|
||||
table: "sys_dept",
|
||||
columns: sysDeptColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysDeptDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysDeptDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysDeptDao) Columns() SysDeptColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysDeptDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysDeptDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysDictDataDao is the data access object for the table sys_dict_data.
|
||||
type SysDictDataDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysDictDataColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysDictDataColumns defines and stores column names for the table sys_dict_data.
|
||||
type SysDictDataColumns struct {
|
||||
DictCode string // 字典编码
|
||||
TenantId string // 租户编号
|
||||
DictSort string // 字典排序
|
||||
DictLabel string // 字典标签
|
||||
DictValue string // 字典键值
|
||||
DictType string // 字典类型
|
||||
CssClass string // 样式属性(其他样式扩展)
|
||||
ListClass string // 表格回显样式
|
||||
IsDefault string // 是否默认(Y是 N否)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysDictDataColumns holds the columns for the table sys_dict_data.
|
||||
var sysDictDataColumns = SysDictDataColumns{
|
||||
DictCode: "dict_code",
|
||||
TenantId: "tenant_id",
|
||||
DictSort: "dict_sort",
|
||||
DictLabel: "dict_label",
|
||||
DictValue: "dict_value",
|
||||
DictType: "dict_type",
|
||||
CssClass: "css_class",
|
||||
ListClass: "list_class",
|
||||
IsDefault: "is_default",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysDictDataDao creates and returns a new DAO object for table data access.
|
||||
func NewSysDictDataDao(handlers ...gdb.ModelHandler) *SysDictDataDao {
|
||||
return &SysDictDataDao{
|
||||
group: "default",
|
||||
table: "sys_dict_data",
|
||||
columns: sysDictDataColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysDictDataDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysDictDataDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysDictDataDao) Columns() SysDictDataColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysDictDataDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysDictDataDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysDictTypeDao is the data access object for the table sys_dict_type.
|
||||
type SysDictTypeDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysDictTypeColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysDictTypeColumns defines and stores column names for the table sys_dict_type.
|
||||
type SysDictTypeColumns struct {
|
||||
DictId string // 字典主键
|
||||
TenantId string // 租户编号
|
||||
DictName string // 字典名称
|
||||
DictType string // 字典类型
|
||||
IsSys string // 是否系统(0是 1否)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysDictTypeColumns holds the columns for the table sys_dict_type.
|
||||
var sysDictTypeColumns = SysDictTypeColumns{
|
||||
DictId: "dict_id",
|
||||
TenantId: "tenant_id",
|
||||
DictName: "dict_name",
|
||||
DictType: "dict_type",
|
||||
IsSys: "is_sys",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysDictTypeDao creates and returns a new DAO object for table data access.
|
||||
func NewSysDictTypeDao(handlers ...gdb.ModelHandler) *SysDictTypeDao {
|
||||
return &SysDictTypeDao{
|
||||
group: "default",
|
||||
table: "sys_dict_type",
|
||||
columns: sysDictTypeColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysDictTypeDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysDictTypeDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysDictTypeDao) Columns() SysDictTypeColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysDictTypeDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysDictTypeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysGenTableDao is the data access object for the table sys_gen_table.
|
||||
type SysGenTableDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysGenTableColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysGenTableColumns defines and stores column names for the table sys_gen_table.
|
||||
type SysGenTableColumns struct {
|
||||
TableId string // 生成ID
|
||||
GenType string // 生成类型
|
||||
GenTemplate string // 生成模板
|
||||
VarName string // 实体命名
|
||||
Options string // 配置选项
|
||||
DbName string // 数据库名称
|
||||
TableName string // 主表名称
|
||||
TableComment string // 主表注释
|
||||
DaoName string // 主表dao模型
|
||||
MasterColumns string // 主表字段
|
||||
AddonName string // 插件名称
|
||||
Status string // 生成状态(0成功 1未开始)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysGenTableColumns holds the columns for the table sys_gen_table.
|
||||
var sysGenTableColumns = SysGenTableColumns{
|
||||
TableId: "table_id",
|
||||
GenType: "gen_type",
|
||||
GenTemplate: "gen_template",
|
||||
VarName: "var_name",
|
||||
Options: "options",
|
||||
DbName: "db_name",
|
||||
TableName: "table_name",
|
||||
TableComment: "table_comment",
|
||||
DaoName: "dao_name",
|
||||
MasterColumns: "master_columns",
|
||||
AddonName: "addon_name",
|
||||
Status: "status",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysGenTableDao creates and returns a new DAO object for table data access.
|
||||
func NewSysGenTableDao(handlers ...gdb.ModelHandler) *SysGenTableDao {
|
||||
return &SysGenTableDao{
|
||||
group: "default",
|
||||
table: "sys_gen_table",
|
||||
columns: sysGenTableColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysGenTableDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysGenTableDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysGenTableDao) Columns() SysGenTableColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysGenTableDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysGenTableDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysGenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysJobDao is the data access object for the table sys_job.
|
||||
type SysJobDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysJobColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysJobColumns defines and stores column names for the table sys_job.
|
||||
type SysJobColumns struct {
|
||||
JobId string // 任务ID
|
||||
JobName string // 任务名称
|
||||
JobParams string // 参数
|
||||
JobGroup string // 任务组名
|
||||
InvokeTarget string // 调用目标字符串
|
||||
CronExpression string // cron执行表达式
|
||||
MisfirePolicy string // 计划执行策略(1多次执行 2执行一次)
|
||||
Concurrent string // 是否并发执行(0允许 1禁止)
|
||||
Status string // 状态(0正常 1暂停)
|
||||
Remark string // 备注信息
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedBy string // 删除人
|
||||
DeletedAt string // 删除时间
|
||||
}
|
||||
|
||||
// sysJobColumns holds the columns for the table sys_job.
|
||||
var sysJobColumns = SysJobColumns{
|
||||
JobId: "job_id",
|
||||
JobName: "job_name",
|
||||
JobParams: "job_params",
|
||||
JobGroup: "job_group",
|
||||
InvokeTarget: "invoke_target",
|
||||
CronExpression: "cron_expression",
|
||||
MisfirePolicy: "misfire_policy",
|
||||
Concurrent: "concurrent",
|
||||
Status: "status",
|
||||
Remark: "remark",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedBy: "deleted_by",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewSysJobDao creates and returns a new DAO object for table data access.
|
||||
func NewSysJobDao(handlers ...gdb.ModelHandler) *SysJobDao {
|
||||
return &SysJobDao{
|
||||
group: "default",
|
||||
table: "sys_job",
|
||||
columns: sysJobColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysJobDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysJobDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysJobDao) Columns() SysJobColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysJobDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysJobDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysJobDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysLogininforDao is the data access object for the table sys_logininfor.
|
||||
type SysLogininforDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysLogininforColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysLogininforColumns defines and stores column names for the table sys_logininfor.
|
||||
type SysLogininforColumns struct {
|
||||
InfoId string // 访问ID
|
||||
TenantId string // 租户编号
|
||||
UserName string // 用户账号
|
||||
ClientKey string // 客户端
|
||||
DeviceType string // 设备类型
|
||||
Ipaddr string // 登录IP地址
|
||||
LoginLocation string // 登录地点
|
||||
Browser string // 浏览器类型
|
||||
Os string // 操作系统
|
||||
Status string // 登录状态(0成功 1失败)
|
||||
Msg string // 提示消息
|
||||
LoginTime string // 访问时间
|
||||
}
|
||||
|
||||
// sysLogininforColumns holds the columns for the table sys_logininfor.
|
||||
var sysLogininforColumns = SysLogininforColumns{
|
||||
InfoId: "info_id",
|
||||
TenantId: "tenant_id",
|
||||
UserName: "user_name",
|
||||
ClientKey: "client_key",
|
||||
DeviceType: "device_type",
|
||||
Ipaddr: "ipaddr",
|
||||
LoginLocation: "login_location",
|
||||
Browser: "browser",
|
||||
Os: "os",
|
||||
Status: "status",
|
||||
Msg: "msg",
|
||||
LoginTime: "login_time",
|
||||
}
|
||||
|
||||
// NewSysLogininforDao creates and returns a new DAO object for table data access.
|
||||
func NewSysLogininforDao(handlers ...gdb.ModelHandler) *SysLogininforDao {
|
||||
return &SysLogininforDao{
|
||||
group: "default",
|
||||
table: "sys_logininfor",
|
||||
columns: sysLogininforColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysLogininforDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysLogininforDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysLogininforDao) Columns() SysLogininforColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysLogininforDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysLogininforDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysLogininforDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysMenuDao is the data access object for the table sys_menu.
|
||||
type SysMenuDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysMenuColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysMenuColumns defines and stores column names for the table sys_menu.
|
||||
type SysMenuColumns struct {
|
||||
MenuId string // 菜单ID
|
||||
MenuName string // 菜单名称
|
||||
ParentId string // 父菜单ID
|
||||
Level string // 关系树等级
|
||||
Tree string // 关系树
|
||||
OrderNum string // 显示顺序
|
||||
Path string // 路由地址
|
||||
Component string // 组件路径
|
||||
QueryParam string // 路由参数
|
||||
IsFrame string // 是否为外链(0是 1否)
|
||||
IsCache string // 是否缓存(0缓存 1不缓存)
|
||||
MenuType string // 菜单类型(M目录 C菜单 F按钮)
|
||||
Visible string // 显示状态(0显示 1隐藏)
|
||||
Status string // 菜单状态(0正常 1停用)
|
||||
Perms string // 权限标识
|
||||
Icon string // 菜单图标
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysMenuColumns holds the columns for the table sys_menu.
|
||||
var sysMenuColumns = SysMenuColumns{
|
||||
MenuId: "menu_id",
|
||||
MenuName: "menu_name",
|
||||
ParentId: "parent_id",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
OrderNum: "order_num",
|
||||
Path: "path",
|
||||
Component: "component",
|
||||
QueryParam: "query_param",
|
||||
IsFrame: "is_frame",
|
||||
IsCache: "is_cache",
|
||||
MenuType: "menu_type",
|
||||
Visible: "visible",
|
||||
Status: "status",
|
||||
Perms: "perms",
|
||||
Icon: "icon",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysMenuDao creates and returns a new DAO object for table data access.
|
||||
func NewSysMenuDao(handlers ...gdb.ModelHandler) *SysMenuDao {
|
||||
return &SysMenuDao{
|
||||
group: "default",
|
||||
table: "sys_menu",
|
||||
columns: sysMenuColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysMenuDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysMenuDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysMenuDao) Columns() SysMenuColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysMenuDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysMenuDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysNoticeDao is the data access object for the table sys_notice.
|
||||
type SysNoticeDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysNoticeColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysNoticeColumns defines and stores column names for the table sys_notice.
|
||||
type SysNoticeColumns struct {
|
||||
NoticeId string // 公告ID
|
||||
TenantId string // 租户编号
|
||||
NoticeTitle string // 公告标题
|
||||
NoticeType string // 公告类型(1通知 2公告)
|
||||
NoticeContent string // 公告内容
|
||||
Status string // 公告状态(0正常 1关闭)
|
||||
NoticeRange string // 通知范围(1全员 2指定机构 3指定用户)
|
||||
DeptIds string // 通知机构ID列表JSON
|
||||
UserIds string // 通知用户ID列表JSON
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysNoticeColumns holds the columns for the table sys_notice.
|
||||
var sysNoticeColumns = SysNoticeColumns{
|
||||
NoticeId: "notice_id",
|
||||
TenantId: "tenant_id",
|
||||
NoticeTitle: "notice_title",
|
||||
NoticeType: "notice_type",
|
||||
NoticeContent: "notice_content",
|
||||
Status: "status",
|
||||
NoticeRange: "notice_range",
|
||||
DeptIds: "dept_ids",
|
||||
UserIds: "user_ids",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysNoticeDao creates and returns a new DAO object for table data access.
|
||||
func NewSysNoticeDao(handlers ...gdb.ModelHandler) *SysNoticeDao {
|
||||
return &SysNoticeDao{
|
||||
group: "default",
|
||||
table: "sys_notice",
|
||||
columns: sysNoticeColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysNoticeDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysNoticeDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysNoticeDao) Columns() SysNoticeColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysNoticeDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysNoticeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysNoticeUserDao is the data access object for the table sys_notice_user.
|
||||
type SysNoticeUserDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysNoticeUserColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysNoticeUserColumns defines and stores column names for the table sys_notice_user.
|
||||
type SysNoticeUserColumns struct {
|
||||
Id string // ID
|
||||
NoticeId string // 公告ID
|
||||
TenantId string // 租户编号
|
||||
NoticeTitle string // 公告标题
|
||||
NoticeType string // 公告类型(1通知 2公告)
|
||||
NoticeContent string // 公告内容
|
||||
Status string // 公告状态(0正常 1关闭)
|
||||
UserId string // 用户ID
|
||||
IsRead string // 是否已读(0未读 1已读)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysNoticeUserColumns holds the columns for the table sys_notice_user.
|
||||
var sysNoticeUserColumns = SysNoticeUserColumns{
|
||||
Id: "id",
|
||||
NoticeId: "notice_id",
|
||||
TenantId: "tenant_id",
|
||||
NoticeTitle: "notice_title",
|
||||
NoticeType: "notice_type",
|
||||
NoticeContent: "notice_content",
|
||||
Status: "status",
|
||||
UserId: "user_id",
|
||||
IsRead: "is_read",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysNoticeUserDao creates and returns a new DAO object for table data access.
|
||||
func NewSysNoticeUserDao(handlers ...gdb.ModelHandler) *SysNoticeUserDao {
|
||||
return &SysNoticeUserDao{
|
||||
group: "default",
|
||||
table: "sys_notice_user",
|
||||
columns: sysNoticeUserColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysNoticeUserDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysNoticeUserDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysNoticeUserDao) Columns() SysNoticeUserColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysNoticeUserDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysNoticeUserDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysNoticeUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysOperLogDao is the data access object for the table sys_oper_log.
|
||||
type SysOperLogDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysOperLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysOperLogColumns defines and stores column names for the table sys_oper_log.
|
||||
type SysOperLogColumns struct {
|
||||
OperId string // 日志主键
|
||||
TenantId string // 租户编号
|
||||
Title string // 模块标题
|
||||
BusinessType string // 业务类型(0其它 1新增 2修改 3删除)
|
||||
Method string // 方法名称
|
||||
RequestMethod string // 请求方式
|
||||
OperatorType string // 操作类别(0其它 1后台用户 2手机端用户)
|
||||
OperName string // 操作人员
|
||||
DeptName string // 部门名称
|
||||
OperUrl string // 请求URL
|
||||
OperIp string // 主机地址
|
||||
OperLocation string // 操作地点
|
||||
OperParam string // 请求参数
|
||||
JsonResult string // 返回参数
|
||||
Status string // 操作状态(0正常 1异常)
|
||||
ErrorMsg string // 错误消息
|
||||
OperTime string // 操作时间
|
||||
CostTime string // 消耗时间
|
||||
}
|
||||
|
||||
// sysOperLogColumns holds the columns for the table sys_oper_log.
|
||||
var sysOperLogColumns = SysOperLogColumns{
|
||||
OperId: "oper_id",
|
||||
TenantId: "tenant_id",
|
||||
Title: "title",
|
||||
BusinessType: "business_type",
|
||||
Method: "method",
|
||||
RequestMethod: "request_method",
|
||||
OperatorType: "operator_type",
|
||||
OperName: "oper_name",
|
||||
DeptName: "dept_name",
|
||||
OperUrl: "oper_url",
|
||||
OperIp: "oper_ip",
|
||||
OperLocation: "oper_location",
|
||||
OperParam: "oper_param",
|
||||
JsonResult: "json_result",
|
||||
Status: "status",
|
||||
ErrorMsg: "error_msg",
|
||||
OperTime: "oper_time",
|
||||
CostTime: "cost_time",
|
||||
}
|
||||
|
||||
// NewSysOperLogDao creates and returns a new DAO object for table data access.
|
||||
func NewSysOperLogDao(handlers ...gdb.ModelHandler) *SysOperLogDao {
|
||||
return &SysOperLogDao{
|
||||
group: "default",
|
||||
table: "sys_oper_log",
|
||||
columns: sysOperLogColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysOperLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysOperLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysOperLogDao) Columns() SysOperLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysOperLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysOperLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysOperLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysOssDao is the data access object for the table sys_oss.
|
||||
type SysOssDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysOssColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysOssColumns defines and stores column names for the table sys_oss.
|
||||
type SysOssColumns struct {
|
||||
OssId string // 对象存储主键
|
||||
TenantId string // 租户编号
|
||||
FileName string // 文件名
|
||||
OriginalName string // 原名
|
||||
FileSuffix string // 文件后缀名
|
||||
Path string // 存储路径
|
||||
Url string // URL地址
|
||||
CreatedDept string // 创建部门
|
||||
CreatedAt string // 创建时间
|
||||
CreatedBy string // 创建者
|
||||
UpdatedAt string // 更新时间
|
||||
UpdatedBy string // 更新者
|
||||
Service string // 服务商
|
||||
Md5 string // 文件MD5
|
||||
FileSize string // 文件大小
|
||||
FileCrc16 string // 文件Crc16
|
||||
FileSum string // 文件校验和
|
||||
}
|
||||
|
||||
// sysOssColumns holds the columns for the table sys_oss.
|
||||
var sysOssColumns = SysOssColumns{
|
||||
OssId: "oss_id",
|
||||
TenantId: "tenant_id",
|
||||
FileName: "file_name",
|
||||
OriginalName: "original_name",
|
||||
FileSuffix: "file_suffix",
|
||||
Path: "path",
|
||||
Url: "url",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedAt: "created_at",
|
||||
CreatedBy: "created_by",
|
||||
UpdatedAt: "updated_at",
|
||||
UpdatedBy: "updated_by",
|
||||
Service: "service",
|
||||
Md5: "md5",
|
||||
FileSize: "file_size",
|
||||
FileCrc16: "file_crc16",
|
||||
FileSum: "file_sum",
|
||||
}
|
||||
|
||||
// NewSysOssDao creates and returns a new DAO object for table data access.
|
||||
func NewSysOssDao(handlers ...gdb.ModelHandler) *SysOssDao {
|
||||
return &SysOssDao{
|
||||
group: "default",
|
||||
table: "sys_oss",
|
||||
columns: sysOssColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysOssDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysOssDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysOssDao) Columns() SysOssColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysOssDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysOssDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysOssDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysOssConfigDao is the data access object for the table sys_oss_config.
|
||||
type SysOssConfigDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysOssConfigColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysOssConfigColumns defines and stores column names for the table sys_oss_config.
|
||||
type SysOssConfigColumns struct {
|
||||
OssConfigId string // 主键
|
||||
TenantId string // 租户编号
|
||||
ConfigKey string // 配置key
|
||||
AccessKey string // accessKey
|
||||
SecretKey string // 秘钥
|
||||
BucketName string // 桶名称
|
||||
Prefix string // 前缀
|
||||
Endpoint string // 访问站点
|
||||
Domain string // 自定义域名
|
||||
IsHttps string // 是否https(Y=是,N=否)
|
||||
Region string // 域
|
||||
AccessPolicy string // 桶权限类型(0=private 1=public 2=custom)
|
||||
Status string // 是否默认(0=是,1=否)
|
||||
Ext1 string // 扩展字段
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysOssConfigColumns holds the columns for the table sys_oss_config.
|
||||
var sysOssConfigColumns = SysOssConfigColumns{
|
||||
OssConfigId: "oss_config_id",
|
||||
TenantId: "tenant_id",
|
||||
ConfigKey: "config_key",
|
||||
AccessKey: "access_key",
|
||||
SecretKey: "secret_key",
|
||||
BucketName: "bucket_name",
|
||||
Prefix: "prefix",
|
||||
Endpoint: "endpoint",
|
||||
Domain: "domain",
|
||||
IsHttps: "is_https",
|
||||
Region: "region",
|
||||
AccessPolicy: "access_policy",
|
||||
Status: "status",
|
||||
Ext1: "ext1",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysOssConfigDao creates and returns a new DAO object for table data access.
|
||||
func NewSysOssConfigDao(handlers ...gdb.ModelHandler) *SysOssConfigDao {
|
||||
return &SysOssConfigDao{
|
||||
group: "default",
|
||||
table: "sys_oss_config",
|
||||
columns: sysOssConfigColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysOssConfigDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysOssConfigDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysOssConfigDao) Columns() SysOssConfigColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysOssConfigDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysOssConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysOssConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysPostDao is the data access object for the table sys_post.
|
||||
type SysPostDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysPostColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysPostColumns defines and stores column names for the table sys_post.
|
||||
type SysPostColumns struct {
|
||||
PostId string // 岗位ID
|
||||
TenantId string // 租户编号
|
||||
DeptId string // 部门id
|
||||
PostCode string // 岗位编码
|
||||
PostCategory string // 岗位类别编码
|
||||
PostName string // 岗位名称
|
||||
PostSort string // 显示顺序
|
||||
Status string // 状态(0正常 1停用)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedBy string // 删除人
|
||||
DeletedAt string // 删除时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysPostColumns holds the columns for the table sys_post.
|
||||
var sysPostColumns = SysPostColumns{
|
||||
PostId: "post_id",
|
||||
TenantId: "tenant_id",
|
||||
DeptId: "dept_id",
|
||||
PostCode: "post_code",
|
||||
PostCategory: "post_category",
|
||||
PostName: "post_name",
|
||||
PostSort: "post_sort",
|
||||
Status: "status",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedBy: "deleted_by",
|
||||
DeletedAt: "deleted_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysPostDao creates and returns a new DAO object for table data access.
|
||||
func NewSysPostDao(handlers ...gdb.ModelHandler) *SysPostDao {
|
||||
return &SysPostDao{
|
||||
group: "default",
|
||||
table: "sys_post",
|
||||
columns: sysPostColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysPostDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysPostDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysPostDao) Columns() SysPostColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysPostDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysPostDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysRoleDao is the data access object for the table sys_role.
|
||||
type SysRoleDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysRoleColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysRoleColumns defines and stores column names for the table sys_role.
|
||||
type SysRoleColumns struct {
|
||||
RoleId string // 角色ID
|
||||
TenantId string // 租户编号
|
||||
DeptId string // 部门机构id
|
||||
RoleName string // 角色名称
|
||||
RoleKey string // 角色权限字符串
|
||||
RoleSort string // 显示顺序
|
||||
DataScope string // 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:仅本人数据权限 7:本组织及下一级数据权限
|
||||
MenuCheckStrictly string // 菜单树选择项是否关联显示
|
||||
DeptCheckStrictly string // 部门树选择项是否关联显示
|
||||
Status string // 角色状态(0正常 1停用)
|
||||
IsPass string // 是否传递数据权限(0:传递 1:不传递)
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedBy string // 删除人
|
||||
DeletedAt string // 删除时间
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// sysRoleColumns holds the columns for the table sys_role.
|
||||
var sysRoleColumns = SysRoleColumns{
|
||||
RoleId: "role_id",
|
||||
TenantId: "tenant_id",
|
||||
DeptId: "dept_id",
|
||||
RoleName: "role_name",
|
||||
RoleKey: "role_key",
|
||||
RoleSort: "role_sort",
|
||||
DataScope: "data_scope",
|
||||
MenuCheckStrictly: "menu_check_strictly",
|
||||
DeptCheckStrictly: "dept_check_strictly",
|
||||
Status: "status",
|
||||
IsPass: "is_pass",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedBy: "deleted_by",
|
||||
DeletedAt: "deleted_at",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// NewSysRoleDao creates and returns a new DAO object for table data access.
|
||||
func NewSysRoleDao(handlers ...gdb.ModelHandler) *SysRoleDao {
|
||||
return &SysRoleDao{
|
||||
group: "default",
|
||||
table: "sys_role",
|
||||
columns: sysRoleColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysRoleDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysRoleDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysRoleDao) Columns() SysRoleColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysRoleDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysRoleDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysRoleDeptDao is the data access object for the table sys_role_dept.
|
||||
type SysRoleDeptDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysRoleDeptColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysRoleDeptColumns defines and stores column names for the table sys_role_dept.
|
||||
type SysRoleDeptColumns struct {
|
||||
TenantId string // 租户编号
|
||||
RoleId string // 角色ID
|
||||
DeptId string // 部门ID
|
||||
}
|
||||
|
||||
// sysRoleDeptColumns holds the columns for the table sys_role_dept.
|
||||
var sysRoleDeptColumns = SysRoleDeptColumns{
|
||||
TenantId: "tenant_id",
|
||||
RoleId: "role_id",
|
||||
DeptId: "dept_id",
|
||||
}
|
||||
|
||||
// NewSysRoleDeptDao creates and returns a new DAO object for table data access.
|
||||
func NewSysRoleDeptDao(handlers ...gdb.ModelHandler) *SysRoleDeptDao {
|
||||
return &SysRoleDeptDao{
|
||||
group: "default",
|
||||
table: "sys_role_dept",
|
||||
columns: sysRoleDeptColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysRoleDeptDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysRoleDeptDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysRoleDeptDao) Columns() SysRoleDeptColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysRoleDeptDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysRoleDeptDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysRoleDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysRoleMenuDao is the data access object for the table sys_role_menu.
|
||||
type SysRoleMenuDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysRoleMenuColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysRoleMenuColumns defines and stores column names for the table sys_role_menu.
|
||||
type SysRoleMenuColumns struct {
|
||||
TenantId string // 租户编号
|
||||
RoleId string // 角色ID
|
||||
MenuId string // 菜单ID
|
||||
DataScope string // 数据范围(0按角色数据权限 1全部数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限)
|
||||
}
|
||||
|
||||
// sysRoleMenuColumns holds the columns for the table sys_role_menu.
|
||||
var sysRoleMenuColumns = SysRoleMenuColumns{
|
||||
TenantId: "tenant_id",
|
||||
RoleId: "role_id",
|
||||
MenuId: "menu_id",
|
||||
DataScope: "data_scope",
|
||||
}
|
||||
|
||||
// NewSysRoleMenuDao creates and returns a new DAO object for table data access.
|
||||
func NewSysRoleMenuDao(handlers ...gdb.ModelHandler) *SysRoleMenuDao {
|
||||
return &SysRoleMenuDao{
|
||||
group: "default",
|
||||
table: "sys_role_menu",
|
||||
columns: sysRoleMenuColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysRoleMenuDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysRoleMenuDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysRoleMenuDao) Columns() SysRoleMenuColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysRoleMenuDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysRoleMenuDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysSocialDao is the data access object for the table sys_social.
|
||||
type SysSocialDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns SysSocialColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SysSocialColumns defines and stores column names for the table sys_social.
|
||||
type SysSocialColumns struct {
|
||||
Id string // 主键
|
||||
UserId string // 用户ID
|
||||
TenantId string // 租户id
|
||||
AuthId string // 平台+平台唯一id
|
||||
Source string // 用户来源
|
||||
OpenId string // 平台编号唯一id
|
||||
UserName string // 登录账号
|
||||
NickName string // 用户昵称
|
||||
Email string // 用户邮箱
|
||||
Avatar string // 头像地址
|
||||
AccessToken string // 用户的授权令牌
|
||||
ExpireIn string // 用户的授权令牌的有效期,部分平台可能没有
|
||||
RefreshToken string // 刷新令牌,部分平台可能没有
|
||||
AccessCode string // 平台的授权信息,部分平台可能没有
|
||||
UnionId string // 用户的 unionid
|
||||
Scope string // 授予的权限,部分平台可能没有
|
||||
TokenType string // 个别平台的授权信息,部分平台可能没有
|
||||
IdToken string // id token,部分平台可能没有
|
||||
MacAlgorithm string // 小米平台用户的附带属性,部分平台可能没有
|
||||
MacKey string // 小米平台用户的附带属性,部分平台可能没有
|
||||
Code string // 用户的授权code,部分平台可能没有
|
||||
OauthToken string // Twitter平台用户的附带属性,部分平台可能没有
|
||||
OauthTokenSecret string // Twitter平台用户的附带属性,部分平台可能没有
|
||||
CreatedDept string // 创建部门
|
||||
CreatedBy string // 创建者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedBy string // 更新者
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedBy string // 删除人
|
||||
DeletedAt string // 删除时间
|
||||
}
|
||||
|
||||
// sysSocialColumns holds the columns for the table sys_social.
|
||||
var sysSocialColumns = SysSocialColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
TenantId: "tenant_id",
|
||||
AuthId: "auth_id",
|
||||
Source: "source",
|
||||
OpenId: "open_id",
|
||||
UserName: "user_name",
|
||||
NickName: "nick_name",
|
||||
Email: "email",
|
||||
Avatar: "avatar",
|
||||
AccessToken: "access_token",
|
||||
ExpireIn: "expire_in",
|
||||
RefreshToken: "refresh_token",
|
||||
AccessCode: "access_code",
|
||||
UnionId: "union_id",
|
||||
Scope: "scope",
|
||||
TokenType: "token_type",
|
||||
IdToken: "id_token",
|
||||
MacAlgorithm: "mac_algorithm",
|
||||
MacKey: "mac_key",
|
||||
Code: "code",
|
||||
OauthToken: "oauth_token",
|
||||
OauthTokenSecret: "oauth_token_secret",
|
||||
CreatedDept: "created_dept",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedBy: "deleted_by",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewSysSocialDao creates and returns a new DAO object for table data access.
|
||||
func NewSysSocialDao(handlers ...gdb.ModelHandler) *SysSocialDao {
|
||||
return &SysSocialDao{
|
||||
group: "default",
|
||||
table: "sys_social",
|
||||
columns: sysSocialColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SysSocialDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SysSocialDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SysSocialDao) Columns() SysSocialColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SysSocialDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *SysSocialDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysSocialDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user