Explorar el Código

初始化工程

chengqian hace 9 meses
padre
commit
ccb371da0e
Se han modificado 53 ficheros con 269 adiciones y 270 borrados
  1. 4 4
      server/api/v1/example/exa_file_upload_download.go
  2. 4 4
      server/api/v1/system/sys_api.go
  3. 5 5
      server/api/v1/system/sys_authority.go
  4. 5 5
      server/api/v1/system/sys_dictionary.go
  5. 5 5
      server/api/v1/system/sys_dictionary_detail.go
  6. 2 2
      server/api/v1/system/sys_jwt_blacklist.go
  7. 4 4
      server/api/v1/system/sys_menu.go
  8. 4 4
      server/api/v1/system/sys_operation_record.go
  9. 9 9
      server/api/v1/system/sys_user.go
  10. 2 2
      server/config.yaml
  11. 1 1
      server/core/server.go
  12. 1 1
      server/dao/exa_file_upload_download.go
  13. 1 1
      server/dao/sys_api.go
  14. 1 1
      server/dao/sys_authority.go
  15. 1 1
      server/dao/sys_authority_btn.go
  16. 1 1
      server/dao/sys_authority_menu.go
  17. 1 1
      server/dao/sys_base_menu.go
  18. 1 1
      server/dao/sys_dictionary.go
  19. 1 1
      server/dao/sys_dictionary_detail.go
  20. 1 1
      server/dao/sys_jwt_blacklist.go
  21. 1 1
      server/dao/sys_menu_btn.go
  22. 1 1
      server/dao/sys_operation_record.go
  23. 2 2
      server/dao/sys_user.go
  24. 1 1
      server/dao/sys_user_authority.go
  25. 14 13
      server/initialize/gorm.go
  26. 2 2
      server/middleware/email.go
  27. 2 2
      server/middleware/jwt.go
  28. 2 2
      server/middleware/operation.go
  29. 2 2
      server/model/example/response/exa_file_upload_download.go
  30. 2 2
      server/model/system/request/sys_api.go
  31. 2 2
      server/model/system/request/sys_dictionary_detail.go
  32. 6 6
      server/model/system/request/sys_menu.go
  33. 2 2
      server/model/system/request/sys_operation_record.go
  34. 10 10
      server/model/system/request/sys_user.go
  35. 3 3
      server/model/system/response/sys_api.go
  36. 4 4
      server/model/system/response/sys_authority.go
  37. 4 4
      server/model/system/response/sys_menu.go
  38. 5 5
      server/model/system/response/sys_user.go
  39. 5 5
      server/plugin/plugin-tool/utils/check.go
  40. 10 10
      server/service/example/exa_file_upload_download.go
  41. 3 3
      server/service/system/jwt_black_list.go
  42. 16 16
      server/service/system/sys_api.go
  43. 17 17
      server/service/system/sys_authority.go
  44. 4 4
      server/service/system/sys_authority_btn.go
  45. 10 10
      server/service/system/sys_base_menu.go
  46. 14 14
      server/service/system/sys_dictionary.go
  47. 14 14
      server/service/system/sys_dictionary_detail.go
  48. 27 27
      server/service/system/sys_menu.go
  49. 6 6
      server/service/system/sys_operation_record.go
  50. 21 21
      server/service/system/sys_user.go
  51. BIN
      server/uploads/file/202cb962ac59075b964b07152d234b70_20240617153252.jpg
  52. 1 1
      web/src/core/config.js
  53. 2 4
      web/src/view/login/index.vue

+ 4 - 4
server/api/v1/example/exa_file_upload_download.go

@@ -3,7 +3,7 @@ package example
 import (
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
-	"server/dao"
+	"server/dao/example"
 	"server/global"
 	"server/model/common/request"
 	"server/model/common/response"
@@ -22,7 +22,7 @@ type FileUploadAndDownloadApi struct{}
 // @Success   200   {object}  response.Response{data=exampleRes.ExaFileResponse,msg=string}  "上传文件示例,返回包括文件详情"
 // @Router    /fileUploadAndDownload/upload [post]
 func (b *FileUploadAndDownloadApi) UploadFile(c *gin.Context) {
-	var file dao.ExaFileUploadAndDownload
+	var file example.ExaFileUploadAndDownload
 	noSave := c.DefaultQuery("noSave", "0")
 	_, header, err := c.Request.FormFile("file")
 	if err != nil {
@@ -41,7 +41,7 @@ func (b *FileUploadAndDownloadApi) UploadFile(c *gin.Context) {
 
 // EditFileName 编辑文件名或者备注
 func (b *FileUploadAndDownloadApi) EditFileName(c *gin.Context) {
-	var file dao.ExaFileUploadAndDownload
+	var file example.ExaFileUploadAndDownload
 	err := c.ShouldBindJSON(&file)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -65,7 +65,7 @@ func (b *FileUploadAndDownloadApi) EditFileName(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}     "删除文件"
 // @Router    /fileUploadAndDownload/deleteFile [post]
 func (b *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) {
-	var file dao.ExaFileUploadAndDownload
+	var file example.ExaFileUploadAndDownload
 	err := c.ShouldBindJSON(&file)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 4 - 4
server/api/v1/system/sys_api.go

@@ -1,7 +1,7 @@
 package system
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/request"
 	"server/model/common/response"
@@ -25,7 +25,7 @@ type SystemApiApi struct{}
 // @Success   200   {object}  response.Response{msg=string}  "创建基础api"
 // @Router    /api/createApi [post]
 func (s *SystemApiApi) CreateApi(c *gin.Context) {
-	var api dao.SysApi
+	var api system.SysApi
 	err := c.ShouldBindJSON(&api)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -55,7 +55,7 @@ func (s *SystemApiApi) CreateApi(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "删除api"
 // @Router    /api/deleteApi [post]
 func (s *SystemApiApi) DeleteApi(c *gin.Context) {
-	var api dao.SysApi
+	var api system.SysApi
 	err := c.ShouldBindJSON(&api)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -150,7 +150,7 @@ func (s *SystemApiApi) GetApiById(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "修改基础api"
 // @Router    /api/updateApi [post]
 func (s *SystemApiApi) UpdateApi(c *gin.Context) {
-	var api dao.SysApi
+	var api system.SysApi
 	err := c.ShouldBindJSON(&api)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 5 - 5
server/api/v1/system/sys_authority.go

@@ -1,7 +1,7 @@
 package system
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/request"
 	"server/model/common/response"
@@ -24,7 +24,7 @@ type AuthorityApi struct{}
 // @Success   200   {object}  response.Response{data=systemRes.SysAuthorityResponse,msg=string}  "创建角色,返回包括系统角色详情"
 // @Router    /authority/createAuthority [post]
 func (a *AuthorityApi) CreateAuthority(c *gin.Context) {
-	var authority, authBack dao.SysAuthority
+	var authority, authBack system.SysAuthority
 	var err error
 
 	if err = c.ShouldBindJSON(&authority); err != nil {
@@ -61,7 +61,7 @@ func (a *AuthorityApi) CreateAuthority(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "删除角色"
 // @Router    /authority/deleteAuthority [post]
 func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
-	var authority dao.SysAuthority
+	var authority system.SysAuthority
 	var err error
 	if err = c.ShouldBindJSON(&authority); err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -91,7 +91,7 @@ func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
 // @Success   200   {object}  response.Response{data=systemRes.SysAuthorityResponse,msg=string}  "更新角色信息,返回包括系统角色详情"
 // @Router    /authority/updateAuthority [post]
 func (a *AuthorityApi) UpdateAuthority(c *gin.Context) {
-	var auth dao.SysAuthority
+	var auth system.SysAuthority
 	err := c.ShouldBindJSON(&auth)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -156,7 +156,7 @@ func (a *AuthorityApi) GetAuthorityList(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "设置角色资源权限"
 // @Router    /authority/setDataAuthority [post]
 func (a *AuthorityApi) SetDataAuthority(c *gin.Context) {
-	var auth dao.SysAuthority
+	var auth system.SysAuthority
 	err := c.ShouldBindJSON(&auth)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 5 - 5
server/api/v1/system/sys_dictionary.go

@@ -3,7 +3,7 @@ package system
 import (
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/response"
 )
@@ -20,7 +20,7 @@ type DictionaryApi struct{}
 // @Success   200   {object}  response.Response{msg=string}  "创建SysDictionary"
 // @Router    /sysDictionary/createSysDictionary [post]
 func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) {
-	var dictionary dao.SysDictionary
+	var dictionary system.SysDictionary
 	err := c.ShouldBindJSON(&dictionary)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -45,7 +45,7 @@ func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "删除SysDictionary"
 // @Router    /sysDictionary/deleteSysDictionary [delete]
 func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) {
-	var dictionary dao.SysDictionary
+	var dictionary system.SysDictionary
 	err := c.ShouldBindJSON(&dictionary)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -70,7 +70,7 @@ func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "更新SysDictionary"
 // @Router    /sysDictionary/updateSysDictionary [put]
 func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) {
-	var dictionary dao.SysDictionary
+	var dictionary system.SysDictionary
 	err := c.ShouldBindJSON(&dictionary)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -95,7 +95,7 @@ func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) {
 // @Success   200   {object}  response.Response{data=map[string]interface{},msg=string}  "用id查询SysDictionary"
 // @Router    /sysDictionary/findSysDictionary [get]
 func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
-	var dictionary dao.SysDictionary
+	var dictionary system.SysDictionary
 	err := c.ShouldBindQuery(&dictionary)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 5 - 5
server/api/v1/system/sys_dictionary_detail.go

@@ -3,7 +3,7 @@ package system
 import (
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/response"
 	"server/model/system/request"
@@ -22,7 +22,7 @@ type DictionaryDetailApi struct{}
 // @Success   200   {object}  response.Response{msg=string}  "创建SysDictionaryDetail"
 // @Router    /sysDictionaryDetail/createSysDictionaryDetail [post]
 func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) {
-	var detail dao.SysDictionaryDetail
+	var detail system.SysDictionaryDetail
 	err := c.ShouldBindJSON(&detail)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -47,7 +47,7 @@ func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "删除SysDictionaryDetail"
 // @Router    /sysDictionaryDetail/deleteSysDictionaryDetail [delete]
 func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) {
-	var detail dao.SysDictionaryDetail
+	var detail system.SysDictionaryDetail
 	err := c.ShouldBindJSON(&detail)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -72,7 +72,7 @@ func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "更新SysDictionaryDetail"
 // @Router    /sysDictionaryDetail/updateSysDictionaryDetail [put]
 func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) {
-	var detail dao.SysDictionaryDetail
+	var detail system.SysDictionaryDetail
 	err := c.ShouldBindJSON(&detail)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -97,7 +97,7 @@ func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) {
 // @Success   200   {object}  response.Response{data=map[string]interface{},msg=string}  "用id查询SysDictionaryDetail"
 // @Router    /sysDictionaryDetail/findSysDictionaryDetail [get]
 func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) {
-	var detail dao.SysDictionaryDetail
+	var detail system.SysDictionaryDetail
 	err := c.ShouldBindQuery(&detail)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 2 - 2
server/api/v1/system/sys_jwt_blacklist.go

@@ -3,7 +3,7 @@ package system
 import (
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/response"
 	"server/utils"
@@ -21,7 +21,7 @@ type JwtApi struct{}
 // @Router    /jwt/jsonInBlacklist [post]
 func (j *JwtApi) JsonInBlacklist(c *gin.Context) {
 	token := utils.GetToken(c)
-	jwt := dao.JwtBlacklist{Jwt: token}
+	jwt := system.JwtBlacklist{Jwt: token}
 	err := jwtService.JsonInBlacklist(jwt)
 	if err != nil {
 		global.GVA_LOG.Error("jwt作废失败!", zap.Error(err))

+ 4 - 4
server/api/v1/system/sys_menu.go

@@ -1,7 +1,7 @@
 package system
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/request"
 	"server/model/common/response"
@@ -31,7 +31,7 @@ func (a *AuthorityMenuApi) GetMenu(c *gin.Context) {
 		return
 	}
 	if menus == nil {
-		menus = []dao.SysMenu{}
+		menus = []system.SysMenu{}
 	}
 	response.OkWithDetailed(systemRes.SysMenusResponse{Menus: menus}, "获取成功", c)
 }
@@ -122,7 +122,7 @@ func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "新增菜单"
 // @Router    /menu/addBaseMenu [post]
 func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) {
-	var menu dao.SysBaseMenu
+	var menu system.SysBaseMenu
 	err := c.ShouldBindJSON(&menu)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -187,7 +187,7 @@ func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "更新菜单"
 // @Router    /menu/updateBaseMenu [post]
 func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) {
-	var menu dao.SysBaseMenu
+	var menu system.SysBaseMenu
 	err := c.ShouldBindJSON(&menu)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 4 - 4
server/api/v1/system/sys_operation_record.go

@@ -3,7 +3,7 @@ package system
 import (
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/request"
 	"server/model/common/response"
@@ -23,7 +23,7 @@ type OperationRecordApi struct{}
 // @Success   200   {object}  response.Response{msg=string}  "创建SysOperationRecord"
 // @Router    /sysOperationRecord/createSysOperationRecord [post]
 func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) {
-	var sysOperationRecord dao.SysOperationRecord
+	var sysOperationRecord system.SysOperationRecord
 	err := c.ShouldBindJSON(&sysOperationRecord)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -48,7 +48,7 @@ func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "删除SysOperationRecord"
 // @Router    /sysOperationRecord/deleteSysOperationRecord [delete]
 func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) {
-	var sysOperationRecord dao.SysOperationRecord
+	var sysOperationRecord system.SysOperationRecord
 	err := c.ShouldBindJSON(&sysOperationRecord)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -98,7 +98,7 @@ func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) {
 // @Success   200   {object}  response.Response{data=map[string]interface{},msg=string}  "用id查询SysOperationRecord"
 // @Router    /sysOperationRecord/findSysOperationRecord [get]
 func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) {
-	var sysOperationRecord dao.SysOperationRecord
+	var sysOperationRecord system.SysOperationRecord
 	err := c.ShouldBindQuery(&sysOperationRecord)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 9 - 9
server/api/v1/system/sys_user.go

@@ -1,7 +1,7 @@
 package system
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"strconv"
 	"time"
 
@@ -62,7 +62,7 @@ func (b *BaseApi) Login(c *gin.Context) {
 	l.Password = rsa.Encryption(l.Password)
 
 	if !oc || (l.CaptchaId != "" && l.Captcha != "" && store.Verify(l.CaptchaId, l.Captcha, true)) {
-		u := &dao.SysUser{Username: l.Username, Password: l.Password}
+		u := &system.SysUser{Username: l.Username, Password: l.Password}
 		user, err := userService.Login(u)
 		if err != nil {
 			global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err))
@@ -87,7 +87,7 @@ func (b *BaseApi) Login(c *gin.Context) {
 }
 
 // TokenNext 登录以后签发jwt
-func (b *BaseApi) TokenNext(c *gin.Context, user dao.SysUser) {
+func (b *BaseApi) TokenNext(c *gin.Context, user system.SysUser) {
 	j := &utils.JWT{SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey)} // 唯一签名
 	claims := j.CreateClaims(systemReq.BaseClaims{
 		UUID:        user.UUID,
@@ -128,7 +128,7 @@ func (b *BaseApi) TokenNext(c *gin.Context, user dao.SysUser) {
 		global.GVA_LOG.Error("设置登录状态失败!", zap.Error(err))
 		response.FailWithMessage("设置登录状态失败", c)
 	} else {
-		var blackJWT dao.JwtBlacklist
+		var blackJWT system.JwtBlacklist
 		blackJWT.Jwt = jwtStr
 		if err := jwtService.JsonInBlacklist(blackJWT); err != nil {
 			response.FailWithMessage("jwt作废失败", c)
@@ -167,7 +167,7 @@ func (b *BaseApi) Register(c *gin.Context) {
 		return
 	}
 
-	user := &dao.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Enable: r.Enable, Phone: r.Phone, Email: r.Email}
+	user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Enable: r.Enable, Phone: r.Phone, Email: r.Email}
 	userReturn, err := userService.Register(*user)
 	if err != nil {
 		global.GVA_LOG.Error("注册失败!", zap.Error(err))
@@ -198,7 +198,7 @@ func (b *BaseApi) ChangePassword(c *gin.Context) {
 		return
 	}
 	uid := utils.GetUserID(c)
-	u := &dao.SysUser{GVA_MODEL: global.GVA_MODEL{ID: uid}, Password: req.Password}
+	u := &system.SysUser{GVA_MODEL: global.GVA_MODEL{ID: uid}, Password: req.Password}
 	_, err = userService.ChangePassword(u, req.NewPassword)
 	if err != nil {
 		global.GVA_LOG.Error("修改失败!", zap.Error(err))
@@ -374,7 +374,7 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) {
 			return
 		}
 	}
-	err = userService.SetUserInfo(dao.SysUser{
+	err = userService.SetUserInfo(system.SysUser{
 		GVA_MODEL: global.GVA_MODEL{
 			ID: user.ID,
 		},
@@ -410,7 +410,7 @@ func (b *BaseApi) SetSelfInfo(c *gin.Context) {
 		return
 	}
 	user.ID = utils.GetUserID(c)
-	err = userService.SetSelfInfo(dao.SysUser{
+	err = userService.SetSelfInfo(system.SysUser{
 		GVA_MODEL: global.GVA_MODEL{
 			ID: user.ID,
 		},
@@ -457,7 +457,7 @@ func (b *BaseApi) GetUserInfo(c *gin.Context) {
 // @Success   200   {object}  response.Response{msg=string}  "重置用户密码"
 // @Router    /user/resetPassword [post]
 func (b *BaseApi) ResetPassword(c *gin.Context) {
-	var user dao.SysUser
+	var user system.SysUser
 	err := c.ShouldBindJSON(&user)
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)

+ 2 - 2
server/config.yaml

@@ -123,9 +123,9 @@ mysql:
     prefix: ""
     port: "3306"
     config: charset=utf8mb4&parseTime=True&loc=Local
-    db-name: lc_finance
+    db-name: lc_smart
     username: root
-    password: root
+    password: 123456
     path: 127.0.0.1
     engine: ""
     log-mode: error

+ 1 - 1
server/core/server.go

@@ -35,6 +35,6 @@ func RunWindowsServer() {
 	s := initServer(address, Router)
 
 	global.GVA_LOG.Info("server run success on ", zap.String("address", address))
-	fmt.Println("龙弛")
+	fmt.Println("智慧路口后台管理...")
 	global.GVA_LOG.Error(s.ListenAndServe().Error())
 }

+ 1 - 1
server/dao/exa_file_upload_download.go

@@ -1,4 +1,4 @@
-package dao
+package example
 
 import (
 	"server/global"

+ 1 - 1
server/dao/sys_api.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import (
 	"fmt"

+ 1 - 1
server/dao/sys_authority.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import (
 	"server/global"

+ 1 - 1
server/dao/sys_authority_btn.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import (
 	"gorm.io/gorm"

+ 1 - 1
server/dao/sys_authority_menu.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import "server/global"
 

+ 1 - 1
server/dao/sys_base_menu.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import (
 	"errors"

+ 1 - 1
server/dao/sys_dictionary.go

@@ -1,5 +1,5 @@
 // 自动生成模板SysDictionary
-package dao
+package system
 
 import (
 	"gorm.io/gorm"

+ 1 - 1
server/dao/sys_dictionary_detail.go

@@ -1,5 +1,5 @@
 // 自动生成模板SysDictionaryDetail
-package dao
+package system
 
 import (
 	"server/global"

+ 1 - 1
server/dao/sys_jwt_blacklist.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import (
 	"server/global"

+ 1 - 1
server/dao/sys_menu_btn.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import "server/global"
 

+ 1 - 1
server/dao/sys_operation_record.go

@@ -1,5 +1,5 @@
 // 自动生成模板SysOperationRecord
-package dao
+package system
 
 import (
 	"time"

+ 2 - 2
server/dao/sys_user.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 import (
 	"errors"
@@ -129,7 +129,7 @@ func SetUserAuthorities(id uint, authorityId uint) (err error) {
 
 // SetUserInfo 修改用户信息
 func (u SysUser) SetUserInfo() error {
-	return global.GVA_DB.Model(&SysUser{}).Updates(&u).Error
+	return global.GVA_DB.Model(&SysUser{}).Where("id = ?", u.ID).Updates(&u).Error
 }
 
 // SetUserInfoById 修改用户信息 按id

+ 1 - 1
server/dao/sys_user_authority.go

@@ -1,4 +1,4 @@
-package dao
+package system
 
 // SysUserAuthority 是 sysUser 和 sysAuthority 的连接表
 type SysUserAuthority struct {

+ 14 - 13
server/initialize/gorm.go

@@ -2,7 +2,8 @@ package initialize
 
 import (
 	"os"
-	"server/dao"
+	example2 "server/dao/example"
+	"server/dao/system"
 
 	"go.uber.org/zap"
 	"gorm.io/gorm"
@@ -31,21 +32,21 @@ func RegisterTables() {
 	db := global.GVA_DB
 	err := db.AutoMigrate(
 
-		dao.SysApi{},
-		dao.SysUser{},
-		dao.SysBaseMenu{},
-		dao.JwtBlacklist{},
-		dao.SysAuthority{},
-		dao.SysDictionary{},
-		dao.SysOperationRecord{},
-		dao.SysDictionaryDetail{},
-		dao.SysBaseMenuParameter{},
-		dao.SysBaseMenuBtn{},
-		dao.SysAuthorityBtn{},
+		system.SysApi{},
+		system.SysUser{},
+		system.SysBaseMenu{},
+		system.JwtBlacklist{},
+		system.SysAuthority{},
+		system.SysDictionary{},
+		system.SysOperationRecord{},
+		system.SysDictionaryDetail{},
+		system.SysBaseMenuParameter{},
+		system.SysBaseMenuBtn{},
+		system.SysAuthorityBtn{},
 
 		example.ExaFile{},
 		example.ExaFileChunk{},
-		dao.ExaFileUploadAndDownload{},
+		example2.ExaFileUploadAndDownload{},
 	)
 	if err != nil {
 		global.GVA_LOG.Error("register table failed", zap.Error(err))

+ 2 - 2
server/middleware/email.go

@@ -3,7 +3,7 @@ package middleware
 import (
 	"bytes"
 	"io"
-	"server/dao"
+	"server/dao/system"
 	"strconv"
 	"time"
 
@@ -35,7 +35,7 @@ func ErrorToEmail() gin.HandlerFunc {
 		body, _ := io.ReadAll(c.Request.Body)
 		// 再重新写回请求体body中,ioutil.ReadAll会清空c.Request.Body中的数据
 		c.Request.Body = io.NopCloser(bytes.NewBuffer(body))
-		record := dao.SysOperationRecord{
+		record := system.SysOperationRecord{
 			Ip:     c.ClientIP(),
 			Method: c.Request.Method,
 			Path:   c.Request.URL.Path,

+ 2 - 2
server/middleware/jwt.go

@@ -4,7 +4,7 @@ import (
 	"errors"
 	"github.com/golang-jwt/jwt/v4"
 	"go.uber.org/zap"
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/utils"
 	"strconv"
@@ -71,7 +71,7 @@ func JWTAuth() gin.HandlerFunc {
 				if err != nil {
 					global.GVA_LOG.Error("get redis jwt failed", zap.Error(err))
 				} else { // 当之前的取成功时才进行拉黑操作
-					_ = jwtService.JsonInBlacklist(dao.JwtBlacklist{Jwt: RedisJwtToken})
+					_ = jwtService.JsonInBlacklist(system.JwtBlacklist{Jwt: RedisJwtToken})
 				}
 				// 无论如何都要记录当前的活跃状态
 				_ = jwtService.SetRedisJWT(newToken, newClaims.Username)

+ 2 - 2
server/middleware/operation.go

@@ -6,7 +6,7 @@ import (
 	"io"
 	"net/http"
 	"net/url"
-	"server/dao"
+	"server/dao/system"
 	"strconv"
 	"strings"
 	"sync"
@@ -66,7 +66,7 @@ func OperationRecord() gin.HandlerFunc {
 			}
 			userId = id
 		}
-		record := dao.SysOperationRecord{
+		record := system.SysOperationRecord{
 			Ip:     c.ClientIP(),
 			Method: c.Request.Method,
 			Path:   c.Request.URL.Path,

+ 2 - 2
server/model/example/response/exa_file_upload_download.go

@@ -1,9 +1,9 @@
 package response
 
 import (
-	"server/dao"
+	"server/dao/example"
 )
 
 type ExaFileResponse struct {
-	File dao.ExaFileUploadAndDownload `json:"file"`
+	File example.ExaFileUploadAndDownload `json:"file"`
 }

+ 2 - 2
server/model/system/request/sys_api.go

@@ -1,13 +1,13 @@
 package request
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/model/common/request"
 )
 
 // api分页条件查询及排序结构体
 type SearchApiParams struct {
-	dao.SysApi
+	system.SysApi
 	request.PageInfo
 	OrderKey string `json:"orderKey"` // 排序
 	Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true

+ 2 - 2
server/model/system/request/sys_dictionary_detail.go

@@ -1,11 +1,11 @@
 package request
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/model/common/request"
 )
 
 type SysDictionaryDetailSearch struct {
-	dao.SysDictionaryDetail
+	system.SysDictionaryDetail
 	request.PageInfo
 }

+ 6 - 6
server/model/system/request/sys_menu.go

@@ -1,25 +1,25 @@
 package request
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 )
 
 // Add menu authority info structure
 type AddMenuAuthorityInfo struct {
-	Menus       []dao.SysBaseMenu `json:"menus"`
-	AuthorityId uint              `json:"authorityId"` // 角色ID
+	Menus       []system.SysBaseMenu `json:"menus"`
+	AuthorityId uint                 `json:"authorityId"` // 角色ID
 }
 
-func DefaultMenu() []dao.SysBaseMenu {
-	return []dao.SysBaseMenu{{
+func DefaultMenu() []system.SysBaseMenu {
+	return []system.SysBaseMenu{{
 		GVA_MODEL: global.GVA_MODEL{ID: 1},
 		ParentId:  0,
 		Path:      "dashboard",
 		Name:      "dashboard",
 		Component: "view/dashboard/index.vue",
 		Sort:      1,
-		Meta: dao.Meta{
+		Meta: system.Meta{
 			Title: "仪表盘",
 			Icon:  "setting",
 		},

+ 2 - 2
server/model/system/request/sys_operation_record.go

@@ -1,11 +1,11 @@
 package request
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/model/common/request"
 )
 
 type SysOperationRecordSearch struct {
-	dao.SysOperationRecord
+	system.SysOperationRecord
 	request.PageInfo
 }

+ 10 - 10
server/model/system/request/sys_user.go

@@ -1,7 +1,7 @@
 package request
 
 import (
-	"server/dao"
+	"server/dao/system"
 )
 
 // Register User register structure
@@ -43,13 +43,13 @@ type SetUserAuthorities struct {
 }
 
 type ChangeUserInfo struct {
-	ID           uint               `gorm:"primarykey"`                                                                           // 主键ID
-	NickName     string             `json:"nickName" gorm:"default:系统用户;comment:用户昵称"`                                            // 用户昵称
-	Phone        string             `json:"phone"  gorm:"comment:用户手机号"`                                                          // 用户手机号
-	AuthorityIds uint               `json:"authorityIds" gorm:"-"`                                                                // 角色ID
-	Email        string             `json:"email"  gorm:"comment:用户邮箱"`                                                           // 用户邮箱
-	HeaderImg    string             `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
-	SideMode     string             `json:"sideMode"  gorm:"comment:用户侧边主题"`                                                      // 用户侧边主题
-	Enable       int                `json:"enable" gorm:"comment:冻结用户"`                                                           //冻结用户
-	Authorities  []dao.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
+	ID           uint                  `gorm:"primarykey"`                                                                           // 主键ID
+	NickName     string                `json:"nickName" gorm:"default:系统用户;comment:用户昵称"`                                            // 用户昵称
+	Phone        string                `json:"phone"  gorm:"comment:用户手机号"`                                                          // 用户手机号
+	AuthorityIds uint                  `json:"authorityIds" gorm:"-"`                                                                // 角色ID
+	Email        string                `json:"email"  gorm:"comment:用户邮箱"`                                                           // 用户邮箱
+	HeaderImg    string                `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
+	SideMode     string                `json:"sideMode"  gorm:"comment:用户侧边主题"`                                                      // 用户侧边主题
+	Enable       int                   `json:"enable" gorm:"comment:冻结用户"`                                                           //冻结用户
+	Authorities  []system.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
 }

+ 3 - 3
server/model/system/response/sys_api.go

@@ -1,13 +1,13 @@
 package response
 
 import (
-	"server/dao"
+	"server/dao/system"
 )
 
 type SysAPIResponse struct {
-	Api dao.SysApi `json:"api"`
+	Api system.SysApi `json:"api"`
 }
 
 type SysAPIListResponse struct {
-	Apis []dao.SysApi `json:"apis"`
+	Apis []system.SysApi `json:"apis"`
 }

+ 4 - 4
server/model/system/response/sys_authority.go

@@ -1,14 +1,14 @@
 package response
 
 import (
-	"server/dao"
+	"server/dao/system"
 )
 
 type SysAuthorityResponse struct {
-	Authority dao.SysAuthority `json:"authority"`
+	Authority system.SysAuthority `json:"authority"`
 }
 
 type SysAuthorityCopyResponse struct {
-	Authority      dao.SysAuthority `json:"authority"`
-	OldAuthorityId uint             `json:"oldAuthorityId"` // 旧角色ID
+	Authority      system.SysAuthority `json:"authority"`
+	OldAuthorityId uint                `json:"oldAuthorityId"` // 旧角色ID
 }

+ 4 - 4
server/model/system/response/sys_menu.go

@@ -1,17 +1,17 @@
 package response
 
 import (
-	"server/dao"
+	"server/dao/system"
 )
 
 type SysMenusResponse struct {
-	Menus []dao.SysMenu `json:"menus"`
+	Menus []system.SysMenu `json:"menus"`
 }
 
 type SysBaseMenusResponse struct {
-	Menus []dao.SysBaseMenu `json:"menus"`
+	Menus []system.SysBaseMenu `json:"menus"`
 }
 
 type SysBaseMenuResponse struct {
-	Menu dao.SysBaseMenu `json:"menu"`
+	Menu system.SysBaseMenu `json:"menu"`
 }

+ 5 - 5
server/model/system/response/sys_user.go

@@ -1,15 +1,15 @@
 package response
 
 import (
-	"server/dao"
+	"server/dao/system"
 )
 
 type SysUserResponse struct {
-	User dao.SysUser `json:"user"`
+	User system.SysUser `json:"user"`
 }
 
 type LoginResponse struct {
-	User      dao.SysUser `json:"user"`
-	Token     string      `json:"token"`
-	ExpiresAt int64       `json:"expiresAt"`
+	User      system.SysUser `json:"user"`
+	Token     string         `json:"token"`
+	ExpiresAt int64          `json:"expiresAt"`
 }

+ 5 - 5
server/plugin/plugin-tool/utils/check.go

@@ -2,18 +2,18 @@ package utils
 
 import (
 	"fmt"
-	"server/dao"
+	"server/dao/system"
 
 	"server/global"
 )
 
-func RegisterApis(apis ...dao.SysApi) {
+func RegisterApis(apis ...system.SysApi) {
 	var count int64
 	var apiPaths []string
 	for i := range apis {
 		apiPaths = append(apiPaths, apis[i].Path)
 	}
-	global.GVA_DB.Find(&[]dao.SysApi{}, "path in (?)", apiPaths).Count(&count)
+	global.GVA_DB.Find(&[]system.SysApi{}, "path in (?)", apiPaths).Count(&count)
 	if count > 0 {
 		fmt.Println("插件已安装或存在同名路由")
 		return
@@ -24,7 +24,7 @@ func RegisterApis(apis ...dao.SysApi) {
 	}
 }
 
-func RegisterMenus(menus ...dao.SysBaseMenu) {
+func RegisterMenus(menus ...system.SysBaseMenu) {
 	var count int64
 	var menuNames []string
 	parentMenu := menus[0]
@@ -32,7 +32,7 @@ func RegisterMenus(menus ...dao.SysBaseMenu) {
 	for i := range menus {
 		menuNames = append(menuNames, menus[i].Name)
 	}
-	global.GVA_DB.Find(&[]dao.SysBaseMenu{}, "name in (?)", menuNames).Count(&count)
+	global.GVA_DB.Find(&[]system.SysBaseMenu{}, "name in (?)", menuNames).Count(&count)
 	if count > 0 {
 		fmt.Println("插件已安装或存在同名菜单")
 		return

+ 10 - 10
server/service/example/exa_file_upload_download.go

@@ -3,7 +3,7 @@ package example
 import (
 	"errors"
 	"mime/multipart"
-	"server/dao"
+	"server/dao/example"
 	"strings"
 
 	"server/model/common/request"
@@ -16,7 +16,7 @@ import (
 //@param: file model.ExaFileUploadAndDownload
 //@return: error
 
-func (e *FileUploadAndDownloadService) Upload(file dao.ExaFileUploadAndDownload) error {
+func (e *FileUploadAndDownloadService) Upload(file example.ExaFileUploadAndDownload) error {
 	return file.CreateFile()
 }
 
@@ -26,8 +26,8 @@ func (e *FileUploadAndDownloadService) Upload(file dao.ExaFileUploadAndDownload)
 //@param: id uint
 //@return: model.ExaFileUploadAndDownload, error
 
-func (e *FileUploadAndDownloadService) FindFile(id uint) (dao.ExaFileUploadAndDownload, error) {
-	return dao.QueryFileById(id)
+func (e *FileUploadAndDownloadService) FindFile(id uint) (example.ExaFileUploadAndDownload, error) {
+	return example.QueryFileById(id)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -36,8 +36,8 @@ func (e *FileUploadAndDownloadService) FindFile(id uint) (dao.ExaFileUploadAndDo
 //@param: file model.ExaFileUploadAndDownload
 //@return: err error
 
-func (e *FileUploadAndDownloadService) DeleteFile(file dao.ExaFileUploadAndDownload) (err error) {
-	var fileFromDb dao.ExaFileUploadAndDownload
+func (e *FileUploadAndDownloadService) DeleteFile(file example.ExaFileUploadAndDownload) (err error) {
+	var fileFromDb example.ExaFileUploadAndDownload
 	fileFromDb, err = e.FindFile(file.ID)
 	if err != nil {
 		return
@@ -51,7 +51,7 @@ func (e *FileUploadAndDownloadService) DeleteFile(file dao.ExaFileUploadAndDownl
 }
 
 // EditFileName 编辑文件名或者备注
-func (e *FileUploadAndDownloadService) EditFileName(file dao.ExaFileUploadAndDownload) (err error) {
+func (e *FileUploadAndDownloadService) EditFileName(file example.ExaFileUploadAndDownload) (err error) {
 	_, err = file.EditFileName()
 	return
 }
@@ -66,7 +66,7 @@ func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageIn
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	keyword := info.Keyword
-	return dao.GetFileRecordInfoList(limit, offset, keyword)
+	return example.GetFileRecordInfoList(limit, offset, keyword)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -75,7 +75,7 @@ func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageIn
 //@param: header *multipart.FileHeader, noSave string
 //@return: file model.ExaFileUploadAndDownload, err error
 
-func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader, noSave string) (file dao.ExaFileUploadAndDownload, err error) {
+func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader, noSave string) (file example.ExaFileUploadAndDownload, err error) {
 	oss := upload.NewOss()
 	filePath, key, uploadErr := oss.UploadFile(header)
 	if uploadErr != nil {
@@ -83,7 +83,7 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader,
 	}
 	if noSave == "0" {
 		s := strings.Split(header.Filename, ".")
-		f := dao.ExaFileUploadAndDownload{
+		f := example.ExaFileUploadAndDownload{
 			Url:  filePath,
 			Name: header.Filename,
 			Tag:  s[len(s)-1],

+ 3 - 3
server/service/system/jwt_black_list.go

@@ -2,7 +2,7 @@ package system
 
 import (
 	"context"
-	"server/dao"
+	"server/dao/system"
 
 	"go.uber.org/zap"
 
@@ -18,7 +18,7 @@ type JwtService struct{}
 //@param: jwtList model.JwtBlacklist
 //@return: err error
 
-func (jwtService *JwtService) JsonInBlacklist(jwtList dao.JwtBlacklist) (err error) {
+func (jwtService *JwtService) JsonInBlacklist(jwtList system.JwtBlacklist) (err error) {
 	err = jwtList.CreateJwtBlack()
 	if err != nil {
 		return
@@ -71,7 +71,7 @@ func (jwtService *JwtService) SetRedisJWT(jwt string, userName string) (err erro
 
 func LoadAll() {
 	var data []string
-	err := global.GVA_DB.Model(&dao.JwtBlacklist{}).Select("jwt").Find(&data).Error
+	err := global.GVA_DB.Model(&system.JwtBlacklist{}).Select("jwt").Find(&data).Error
 	if err != nil {
 		global.GVA_LOG.Error("加载数据库jwt黑名单失败!", zap.Error(err))
 		return

+ 16 - 16
server/service/system/sys_api.go

@@ -3,7 +3,7 @@ package system
 import (
 	"errors"
 	"gorm.io/gorm"
-	"server/dao"
+	"server/dao/system"
 	"server/global"
 	"server/model/common/request"
 )
@@ -18,9 +18,9 @@ type ApiService struct{}
 
 var ApiServiceApp = new(ApiService)
 
-func (apiService *ApiService) CreateApi(api dao.SysApi) (err error) {
+func (apiService *ApiService) CreateApi(api system.SysApi) (err error) {
 
-	_, err = dao.QueryApiByPathMethod(api.Path, api.Method)
+	_, err = system.QueryApiByPathMethod(api.Path, api.Method)
 
 	if !errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("存在相同api")
@@ -34,8 +34,8 @@ func (apiService *ApiService) CreateApi(api dao.SysApi) (err error) {
 //@param: api model.SysApi
 //@return: err error
 
-func (apiService *ApiService) DeleteApi(api dao.SysApi) (err error) {
-	entity, err := dao.QueryApiById(api.ID)
+func (apiService *ApiService) DeleteApi(api system.SysApi) (err error) {
+	entity, err := system.QueryApiById(api.ID)
 
 	if errors.Is(err, gorm.ErrRecordNotFound) { // api记录不存在
 		return err
@@ -57,7 +57,7 @@ func (apiService *ApiService) DeleteApi(api dao.SysApi) (err error) {
 //@param: api model.SysApi, info request.PageInfo, order string, desc bool
 //@return: list interface{}, total int64, err error
 
-func (apiService *ApiService) GetAPIInfoList(api dao.SysApi, info request.PageInfo, order string, desc bool) (list interface{}, total int64, err error) {
+func (apiService *ApiService) GetAPIInfoList(api system.SysApi, info request.PageInfo, order string, desc bool) (list interface{}, total int64, err error) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 
@@ -69,8 +69,8 @@ func (apiService *ApiService) GetAPIInfoList(api dao.SysApi, info request.PageIn
 //@description: 获取所有的api
 //@return:  apis []model.SysApi, err error
 
-func (apiService *ApiService) GetAllApis() (apis []dao.SysApi, err error) {
-	return dao.GetAllApis()
+func (apiService *ApiService) GetAllApis() (apis []system.SysApi, err error) {
+	return system.GetAllApis()
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -79,8 +79,8 @@ func (apiService *ApiService) GetAllApis() (apis []dao.SysApi, err error) {
 //@param: id float64
 //@return: api model.SysApi, err error
 
-func (apiService *ApiService) GetApiById(id int) (api dao.SysApi, err error) {
-	return dao.QueryApiById(uint(id))
+func (apiService *ApiService) GetApiById(id int) (api system.SysApi, err error) {
+	return system.QueryApiById(uint(id))
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -89,11 +89,11 @@ func (apiService *ApiService) GetApiById(id int) (api dao.SysApi, err error) {
 //@param: api model.SysApi
 //@return: err error
 
-func (apiService *ApiService) UpdateApi(api dao.SysApi) (err error) {
-	oldA, err := dao.QueryApiById(api.ID)
+func (apiService *ApiService) UpdateApi(api system.SysApi) (err error) {
+	oldA, err := system.QueryApiById(api.ID)
 	if oldA.Path != api.Path || oldA.Method != api.Method {
-		var duplicateApi dao.SysApi
-		duplicateApi, err := dao.QueryApiByPathMethod(api.Path, api.Method)
+		var duplicateApi system.SysApi
+		duplicateApi, err := system.QueryApiByPathMethod(api.Path, api.Method)
 		if err != nil {
 			if !errors.Is(err, gorm.ErrRecordNotFound) {
 				return err
@@ -123,12 +123,12 @@ func (apiService *ApiService) UpdateApi(api dao.SysApi) (err error) {
 
 func (apiService *ApiService) DeleteApisByIds(ids request.IdsReq) (err error) {
 	return global.GVA_DB.Transaction(func(tx *gorm.DB) error {
-		var apis []dao.SysApi
+		var apis []system.SysApi
 		err = tx.Find(&apis, "id in ?", ids.Ids).Error
 		if err != nil {
 			return err
 		}
-		err = tx.Delete(&[]dao.SysApi{}, "id in ?", ids.Ids).Error
+		err = tx.Delete(&[]system.SysApi{}, "id in ?", ids.Ids).Error
 		if err != nil {
 			return err
 		}

+ 17 - 17
server/service/system/sys_authority.go

@@ -2,7 +2,7 @@ package system
 
 import (
 	"errors"
-	"server/dao"
+	"server/dao/system"
 	"strconv"
 
 	systemReq "server/model/system/request"
@@ -24,9 +24,9 @@ type AuthorityService struct{}
 
 var AuthorityServiceApp = new(AuthorityService)
 
-func (authorityService *AuthorityService) CreateAuthority(auth dao.SysAuthority) (authority dao.SysAuthority, err error) {
+func (authorityService *AuthorityService) CreateAuthority(auth system.SysAuthority) (authority system.SysAuthority, err error) {
 
-	_, err = dao.QueryAuthorityById(auth.AuthorityId)
+	_, err = system.QueryAuthorityById(auth.AuthorityId)
 
 	if !errors.Is(err, gorm.ErrRecordNotFound) {
 		return auth, ErrRoleExistence
@@ -60,11 +60,11 @@ func (authorityService *AuthorityService) CreateAuthority(auth dao.SysAuthority)
 //@param: auth model.SysAuthority
 //@return: authority system.SysAuthority, err error
 
-func (authorityService *AuthorityService) UpdateAuthority(auth dao.SysAuthority) (authority dao.SysAuthority, err error) {
-	_, err = dao.QueryAuthorityById(auth.AuthorityId)
+func (authorityService *AuthorityService) UpdateAuthority(auth system.SysAuthority) (authority system.SysAuthority, err error) {
+	_, err = system.QueryAuthorityById(auth.AuthorityId)
 	if err != nil {
 		global.GVA_LOG.Debug(err.Error())
-		return dao.SysAuthority{}, errors.New("查询角色数据失败")
+		return system.SysAuthority{}, errors.New("查询角色数据失败")
 	}
 	err = auth.UpdateAuthority()
 	return auth, err
@@ -76,17 +76,17 @@ func (authorityService *AuthorityService) UpdateAuthority(auth dao.SysAuthority)
 //@param: auth *model.SysAuthority
 //@return: err error
 
-func (authorityService *AuthorityService) DeleteAuthority(auth *dao.SysAuthority) error {
+func (authorityService *AuthorityService) DeleteAuthority(auth *system.SysAuthority) error {
 	if errors.Is(global.GVA_DB.Debug().Preload("Users").First(&auth).Error, gorm.ErrRecordNotFound) {
 		return errors.New("该角色不存在")
 	}
 	if len(auth.Users) != 0 {
 		return errors.New("此角色有用户正在使用禁止删除")
 	}
-	if !errors.Is(global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&dao.SysUser{}).Error, gorm.ErrRecordNotFound) {
+	if !errors.Is(global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&system.SysUser{}).Error, gorm.ErrRecordNotFound) {
 		return errors.New("此角色有用户正在使用禁止删除")
 	}
-	if !errors.Is(global.GVA_DB.Where("parent_id = ?", auth.AuthorityId).First(&dao.SysAuthority{}).Error, gorm.ErrRecordNotFound) {
+	if !errors.Is(global.GVA_DB.Where("parent_id = ?", auth.AuthorityId).First(&system.SysAuthority{}).Error, gorm.ErrRecordNotFound) {
 		return errors.New("此角色存在子角色不允许删除")
 	}
 
@@ -108,10 +108,10 @@ func (authorityService *AuthorityService) DeleteAuthority(auth *dao.SysAuthority
 			}
 		}
 
-		if err = tx.Delete(&dao.SysUserAuthority{}, "sys_authority_authority_id = ?", auth.AuthorityId).Error; err != nil {
+		if err = tx.Delete(&system.SysUserAuthority{}, "sys_authority_authority_id = ?", auth.AuthorityId).Error; err != nil {
 			return err
 		}
-		if err = tx.Where("authority_id = ?", auth.AuthorityId).Delete(&[]dao.SysAuthorityBtn{}).Error; err != nil {
+		if err = tx.Where("authority_id = ?", auth.AuthorityId).Delete(&[]system.SysAuthorityBtn{}).Error; err != nil {
 			return err
 		}
 
@@ -135,7 +135,7 @@ func (authorityService *AuthorityService) GetAuthorityInfoList(info request.Page
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 
-	return dao.GetAuthorityInfoList(limit, offset)
+	return system.GetAuthorityInfoList(limit, offset)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -144,7 +144,7 @@ func (authorityService *AuthorityService) GetAuthorityInfoList(info request.Page
 //@param: auth model.SysAuthority
 //@return: sa system.SysAuthority, err error
 
-func (authorityService *AuthorityService) GetAuthorityInfo(auth dao.SysAuthority) (sa dao.SysAuthority, err error) {
+func (authorityService *AuthorityService) GetAuthorityInfo(auth system.SysAuthority) (sa system.SysAuthority, err error) {
 	return auth.GetAuthorityInfo()
 }
 
@@ -154,8 +154,8 @@ func (authorityService *AuthorityService) GetAuthorityInfo(auth dao.SysAuthority
 //@param: auth model.SysAuthority
 //@return: error
 
-func (authorityService *AuthorityService) SetDataAuthority(auth dao.SysAuthority) error {
-	var s dao.SysAuthority
+func (authorityService *AuthorityService) SetDataAuthority(auth system.SysAuthority) error {
+	var s system.SysAuthority
 	global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId)
 	err := global.GVA_DB.Model(&s).Association("DataAuthorityId").Replace(&auth.DataAuthorityId)
 	return err
@@ -167,8 +167,8 @@ func (authorityService *AuthorityService) SetDataAuthority(auth dao.SysAuthority
 //@param: auth *model.SysAuthority
 //@return: error
 
-func (authorityService *AuthorityService) SetMenuAuthority(auth *dao.SysAuthority) error {
-	var s dao.SysAuthority
+func (authorityService *AuthorityService) SetMenuAuthority(auth *system.SysAuthority) error {
+	var s system.SysAuthority
 	global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", auth.AuthorityId)
 	err := global.GVA_DB.Model(&s).Association("SysBaseMenus").Replace(&auth.SysBaseMenus)
 	return err

+ 4 - 4
server/service/system/sys_authority_btn.go

@@ -3,7 +3,7 @@ package system
 import (
 	"errors"
 	"gorm.io/gorm"
-	"server/dao"
+	"server/dao/system"
 	"server/model/system/request"
 	"server/model/system/response"
 )
@@ -11,7 +11,7 @@ import (
 type AuthorityBtnService struct{}
 
 func (a *AuthorityBtnService) GetAuthorityBtn(req request.SysAuthorityBtnReq) (res response.SysAuthorityBtnRes, err error) {
-	authorityBtn, err := dao.QueryAuthorityBtnByAuthorityIdMenuId(req.AuthorityId, req.MenuID)
+	authorityBtn, err := system.QueryAuthorityBtnByAuthorityIdMenuId(req.AuthorityId, req.MenuID)
 	if err != nil {
 		return
 	}
@@ -24,11 +24,11 @@ func (a *AuthorityBtnService) GetAuthorityBtn(req request.SysAuthorityBtnReq) (r
 }
 
 func (a *AuthorityBtnService) SetAuthorityBtn(req request.SysAuthorityBtnReq) (err error) {
-	return dao.SetAuthorityBtn(req.MenuID, req.AuthorityId, req.Selected)
+	return system.SetAuthorityBtn(req.MenuID, req.AuthorityId, req.Selected)
 }
 
 func (a *AuthorityBtnService) CanRemoveAuthorityBtn(ID string) (err error) {
-	_, fErr := dao.QueryAuthorityBtn(ID)
+	_, fErr := system.QueryAuthorityBtn(ID)
 	if errors.Is(fErr, gorm.ErrRecordNotFound) {
 		return nil
 	}

+ 10 - 10
server/service/system/sys_base_menu.go

@@ -2,7 +2,7 @@ package system
 
 import (
 	"errors"
-	"server/dao"
+	"server/dao/system"
 
 	"gorm.io/gorm"
 	"server/global"
@@ -19,30 +19,30 @@ type BaseMenuService struct{}
 var BaseMenuServiceApp = new(BaseMenuService)
 
 func (baseMenuService *BaseMenuService) DeleteBaseMenu(id int) (err error) {
-	err = global.GVA_DB.First(&dao.SysBaseMenu{}, "parent_id = ?", id).Error
+	err = global.GVA_DB.First(&system.SysBaseMenu{}, "parent_id = ?", id).Error
 	if err != nil {
 		return global.GVA_DB.Transaction(func(tx *gorm.DB) error {
 
-			err = tx.Delete(&dao.SysBaseMenu{}, "id = ?", id).Error
+			err = tx.Delete(&system.SysBaseMenu{}, "id = ?", id).Error
 			if err != nil {
 				return err
 			}
 
-			err = tx.Delete(&dao.SysBaseMenuParameter{}, "sys_base_menu_id = ?", id).Error
+			err = tx.Delete(&system.SysBaseMenuParameter{}, "sys_base_menu_id = ?", id).Error
 			if err != nil {
 				return err
 			}
 
-			err = tx.Delete(&dao.SysBaseMenuBtn{}, "sys_base_menu_id = ?", id).Error
+			err = tx.Delete(&system.SysBaseMenuBtn{}, "sys_base_menu_id = ?", id).Error
 			if err != nil {
 				return err
 			}
-			err = tx.Delete(&dao.SysAuthorityBtn{}, "sys_menu_id = ?", id).Error
+			err = tx.Delete(&system.SysAuthorityBtn{}, "sys_menu_id = ?", id).Error
 			if err != nil {
 				return err
 			}
 
-			err = tx.Delete(&dao.SysAuthorityMenu{}, "sys_base_menu_id = ?", id).Error
+			err = tx.Delete(&system.SysAuthorityMenu{}, "sys_base_menu_id = ?", id).Error
 			if err != nil {
 				return err
 			}
@@ -58,7 +58,7 @@ func (baseMenuService *BaseMenuService) DeleteBaseMenu(id int) (err error) {
 //@param: menu model.SysBaseMenu
 //@return: err error
 
-func (baseMenuService *BaseMenuService) UpdateBaseMenu(menu dao.SysBaseMenu) (err error) {
+func (baseMenuService *BaseMenuService) UpdateBaseMenu(menu system.SysBaseMenu) (err error) {
 	return menu.UpdateBaseMenu()
 }
 
@@ -68,6 +68,6 @@ func (baseMenuService *BaseMenuService) UpdateBaseMenu(menu dao.SysBaseMenu) (er
 //@param: id float64
 //@return: menu system.SysBaseMenu, err error
 
-func (baseMenuService *BaseMenuService) GetBaseMenuById(id int) (menu dao.SysBaseMenu, err error) {
-	return dao.QueryBaseMenuAndMenuBtnAndParameterById(id)
+func (baseMenuService *BaseMenuService) GetBaseMenuById(id int) (menu system.SysBaseMenu, err error) {
+	return system.QueryBaseMenuAndMenuBtnAndParameterById(id)
 }

+ 14 - 14
server/service/system/sys_dictionary.go

@@ -2,7 +2,7 @@ package system
 
 import (
 	"errors"
-	"server/dao"
+	"server/dao/system"
 
 	"gorm.io/gorm"
 	"server/global"
@@ -16,8 +16,8 @@ import (
 
 type DictionaryService struct{}
 
-func (dictionaryService *DictionaryService) CreateSysDictionary(sysDictionary dao.SysDictionary) (err error) {
-	_, err = dao.QueryDictionaryByType(sysDictionary.Type)
+func (dictionaryService *DictionaryService) CreateSysDictionary(sysDictionary system.SysDictionary) (err error) {
+	_, err = system.QueryDictionaryByType(sysDictionary.Type)
 	if !errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("存在相同的type,不允许创建")
 	}
@@ -30,8 +30,8 @@ func (dictionaryService *DictionaryService) CreateSysDictionary(sysDictionary da
 //@param: sysDictionary model.SysDictionary
 //@return: err error
 
-func (dictionaryService *DictionaryService) DeleteSysDictionary(sysDictionary dao.SysDictionary) (err error) {
-	_, err = dao.QueryDictionaryAndDetailsById(sysDictionary.ID)
+func (dictionaryService *DictionaryService) DeleteSysDictionary(sysDictionary system.SysDictionary) (err error) {
+	_, err = system.QueryDictionaryAndDetailsById(sysDictionary.ID)
 	if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("请不要搞事")
 	}
@@ -58,22 +58,22 @@ func (dictionaryService *DictionaryService) DeleteSysDictionary(sysDictionary da
 //@param: sysDictionary *model.SysDictionary
 //@return: err error
 
-func (dictionaryService *DictionaryService) UpdateSysDictionary(sysDictionary *dao.SysDictionary) (err error) {
-	var dict dao.SysDictionary
+func (dictionaryService *DictionaryService) UpdateSysDictionary(sysDictionary *system.SysDictionary) (err error) {
+	var dict system.SysDictionary
 
-	_, err = dao.QueryDictionaryAndDetailsById(sysDictionary.ID)
+	_, err = system.QueryDictionaryAndDetailsById(sysDictionary.ID)
 	if err != nil {
 		global.GVA_LOG.Debug(err.Error())
 		return errors.New("查询字典数据失败")
 	}
 	if dict.Type != sysDictionary.Type {
-		_, err = dao.QueryDictionaryByType(sysDictionary.Type)
+		_, err = system.QueryDictionaryByType(sysDictionary.Type)
 		if !errors.Is(err, gorm.ErrRecordNotFound) {
 			return errors.New("存在相同的type,不允许创建")
 		}
 	}
 
-	return dao.SysDictionary{
+	return system.SysDictionary{
 		Name:   sysDictionary.Name,
 		Type:   sysDictionary.Type,
 		Status: sysDictionary.Status,
@@ -87,14 +87,14 @@ func (dictionaryService *DictionaryService) UpdateSysDictionary(sysDictionary *d
 //@param: Type string, Id uint
 //@return: err error, sysDictionary model.SysDictionary
 
-func (dictionaryService *DictionaryService) GetSysDictionary(Type string, Id uint, status *bool) (sysDictionary dao.SysDictionary, err error) {
+func (dictionaryService *DictionaryService) GetSysDictionary(Type string, Id uint, status *bool) (sysDictionary system.SysDictionary, err error) {
 	var flag = false
 	if status == nil {
 		flag = true
 	} else {
 		flag = *status
 	}
-	return dao.GetSysDictionary(Type, Id, flag)
+	return system.GetSysDictionary(Type, Id, flag)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -104,6 +104,6 @@ func (dictionaryService *DictionaryService) GetSysDictionary(Type string, Id uin
 //@param: info request.SysDictionarySearch
 //@return: err error, list interface{}, total int64
 
-func (dictionaryService *DictionaryService) GetSysDictionaryInfoList() (sysDictionaries []dao.SysDictionary, err error) {
-	return dao.GetSysDictionaryInfoList()
+func (dictionaryService *DictionaryService) GetSysDictionaryInfoList() (sysDictionaries []system.SysDictionary, err error) {
+	return system.GetSysDictionaryInfoList()
 }

+ 14 - 14
server/service/system/sys_dictionary_detail.go

@@ -1,7 +1,7 @@
 package system
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/model/system/request"
 )
 
@@ -13,7 +13,7 @@ import (
 
 type DictionaryDetailService struct{}
 
-func (dictionaryDetailService *DictionaryDetailService) CreateSysDictionaryDetail(sysDictionaryDetail dao.SysDictionaryDetail) error {
+func (dictionaryDetailService *DictionaryDetailService) CreateSysDictionaryDetail(sysDictionaryDetail system.SysDictionaryDetail) error {
 	return sysDictionaryDetail.CreateSysDictionaryDetail()
 }
 
@@ -23,7 +23,7 @@ func (dictionaryDetailService *DictionaryDetailService) CreateSysDictionaryDetai
 //@param: sysDictionaryDetail model.SysDictionaryDetail
 //@return: err error
 
-func (dictionaryDetailService *DictionaryDetailService) DeleteSysDictionaryDetail(sysDictionaryDetail dao.SysDictionaryDetail) error {
+func (dictionaryDetailService *DictionaryDetailService) DeleteSysDictionaryDetail(sysDictionaryDetail system.SysDictionaryDetail) error {
 	return sysDictionaryDetail.DeleteSysDictionaryDetail()
 }
 
@@ -33,7 +33,7 @@ func (dictionaryDetailService *DictionaryDetailService) DeleteSysDictionaryDetai
 //@param: sysDictionaryDetail *model.SysDictionaryDetail
 //@return: err error
 
-func (dictionaryDetailService *DictionaryDetailService) UpdateSysDictionaryDetail(sysDictionaryDetail *dao.SysDictionaryDetail) error {
+func (dictionaryDetailService *DictionaryDetailService) UpdateSysDictionaryDetail(sysDictionaryDetail *system.SysDictionaryDetail) error {
 	return sysDictionaryDetail.UpdateSysDictionaryDetail()
 }
 
@@ -43,8 +43,8 @@ func (dictionaryDetailService *DictionaryDetailService) UpdateSysDictionaryDetai
 //@param: id uint
 //@return: sysDictionaryDetail system.SysDictionaryDetail, err error
 
-func (dictionaryDetailService *DictionaryDetailService) GetSysDictionaryDetail(id uint) (dao.SysDictionaryDetail, error) {
-	return dao.GetSysDictionaryDetailById(id)
+func (dictionaryDetailService *DictionaryDetailService) GetSysDictionaryDetail(id uint) (system.SysDictionaryDetail, error) {
+	return system.GetSysDictionaryDetailById(id)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -60,21 +60,21 @@ func (dictionaryDetailService *DictionaryDetailService) GetSysDictionaryDetailIn
 }
 
 // GetDictionaryList 按照字典id获取字典全部内容的方法
-func (dictionaryDetailService *DictionaryDetailService) GetDictionaryList(dictionaryID uint) ([]dao.SysDictionaryDetail, error) {
-	return dao.GetDictionaryListByDictionaryId(dictionaryID)
+func (dictionaryDetailService *DictionaryDetailService) GetDictionaryList(dictionaryID uint) ([]system.SysDictionaryDetail, error) {
+	return system.GetDictionaryListByDictionaryId(dictionaryID)
 }
 
 // GetDictionaryListByType 按照字典type获取字典全部内容的方法
-func (dictionaryDetailService *DictionaryDetailService) GetDictionaryListByType(t string) ([]dao.SysDictionaryDetail, error) {
-	return dao.GetDictionaryListByType(t)
+func (dictionaryDetailService *DictionaryDetailService) GetDictionaryListByType(t string) ([]system.SysDictionaryDetail, error) {
+	return system.GetDictionaryListByType(t)
 }
 
 // GetDictionaryInfoByValue 按照字典id+字典内容value获取单条字典内容
-func (dictionaryDetailService *DictionaryDetailService) GetDictionaryInfoByValue(dictionaryID uint, value uint) (dao.SysDictionaryDetail, error) {
-	return dao.GetDictionaryInfoByValue(dictionaryID, value)
+func (dictionaryDetailService *DictionaryDetailService) GetDictionaryInfoByValue(dictionaryID uint, value uint) (system.SysDictionaryDetail, error) {
+	return system.GetDictionaryInfoByValue(dictionaryID, value)
 }
 
 // GetDictionaryInfoByTypeValue 按照字典type+字典内容value获取单条字典内容
-func (dictionaryDetailService *DictionaryDetailService) GetDictionaryInfoByTypeValue(t string, value uint) (dao.SysDictionaryDetail, error) {
-	return dao.GetDictionaryInfoByTypeValue(t, value)
+func (dictionaryDetailService *DictionaryDetailService) GetDictionaryInfoByTypeValue(t string, value uint) (system.SysDictionaryDetail, error) {
+	return system.GetDictionaryInfoByTypeValue(t, value)
 }

+ 27 - 27
server/service/system/sys_menu.go

@@ -2,7 +2,7 @@ package system
 
 import (
 	"errors"
-	"server/dao"
+	"server/dao/system"
 
 	"gorm.io/gorm"
 	"server/model/common/request"
@@ -18,11 +18,11 @@ type MenuService struct{}
 
 var MenuServiceApp = new(MenuService)
 
-func (menuService *MenuService) getMenuTreeMap(authorityId uint) (treeMap map[uint][]dao.SysMenu, err error) {
-	var allMenus []dao.SysMenu
-	treeMap = make(map[uint][]dao.SysMenu)
+func (menuService *MenuService) getMenuTreeMap(authorityId uint) (treeMap map[uint][]system.SysMenu, err error) {
+	var allMenus []system.SysMenu
+	treeMap = make(map[uint][]system.SysMenu)
 
-	SysAuthorityMenus, err := dao.QueryAuthorityMenuByAuthorityId(authorityId)
+	SysAuthorityMenus, err := system.QueryAuthorityMenuByAuthorityId(authorityId)
 	if err != nil {
 		return
 	}
@@ -33,13 +33,13 @@ func (menuService *MenuService) getMenuTreeMap(authorityId uint) (treeMap map[ui
 		MenuIds = append(MenuIds, SysAuthorityMenus[i].MenuId)
 	}
 
-	baseMenu, err := dao.QueryBaseMenuAndParametersByMenuId(MenuIds)
+	baseMenu, err := system.QueryBaseMenuAndParametersByMenuId(MenuIds)
 	if err != nil {
 		return
 	}
 
 	for i := range baseMenu {
-		allMenus = append(allMenus, dao.SysMenu{
+		allMenus = append(allMenus, system.SysMenu{
 			SysBaseMenu: baseMenu[i],
 			AuthorityId: authorityId,
 			MenuId:      baseMenu[i].ID,
@@ -47,7 +47,7 @@ func (menuService *MenuService) getMenuTreeMap(authorityId uint) (treeMap map[ui
 		})
 	}
 
-	btns, err := dao.QueryAuthorityBtnAndSysBaseMenuBtnById(authorityId)
+	btns, err := system.QueryAuthorityBtnAndSysBaseMenuBtnById(authorityId)
 
 	if err != nil {
 		return
@@ -72,7 +72,7 @@ func (menuService *MenuService) getMenuTreeMap(authorityId uint) (treeMap map[ui
 //@param: authorityId string
 //@return: menus []system.SysMenu, err error
 
-func (menuService *MenuService) GetMenuTree(authorityId uint) (menus []dao.SysMenu, err error) {
+func (menuService *MenuService) GetMenuTree(authorityId uint) (menus []system.SysMenu, err error) {
 	menuTree, err := menuService.getMenuTreeMap(authorityId)
 	menus = menuTree[0]
 	for i := 0; i < len(menus); i++ {
@@ -87,7 +87,7 @@ func (menuService *MenuService) GetMenuTree(authorityId uint) (menus []dao.SysMe
 //@param: menu *model.SysMenu, treeMap map[string][]model.SysMenu
 //@return: err error
 
-func (menuService *MenuService) getChildrenList(menu *dao.SysMenu, treeMap map[uint][]dao.SysMenu) (err error) {
+func (menuService *MenuService) getChildrenList(menu *system.SysMenu, treeMap map[uint][]system.SysMenu) (err error) {
 	menu.Children = treeMap[menu.MenuId]
 	for i := 0; i < len(menu.Children); i++ {
 		err = menuService.getChildrenList(&menu.Children[i], treeMap)
@@ -101,7 +101,7 @@ func (menuService *MenuService) getChildrenList(menu *dao.SysMenu, treeMap map[u
 //@return: list interface{}, total int64,err error
 
 func (menuService *MenuService) GetInfoList() (list interface{}, total int64, err error) {
-	var menuList []dao.SysBaseMenu
+	var menuList []system.SysBaseMenu
 	treeMap, err := menuService.getBaseMenuTreeMap()
 	menuList = treeMap[0]
 	for i := 0; i < len(menuList); i++ {
@@ -116,7 +116,7 @@ func (menuService *MenuService) GetInfoList() (list interface{}, total int64, er
 //@param: menu *model.SysBaseMenu, treeMap map[string][]model.SysBaseMenu
 //@return: err error
 
-func (menuService *MenuService) getBaseChildrenList(menu *dao.SysBaseMenu, treeMap map[uint][]dao.SysBaseMenu) (err error) {
+func (menuService *MenuService) getBaseChildrenList(menu *system.SysBaseMenu, treeMap map[uint][]system.SysBaseMenu) (err error) {
 	menu.Children = treeMap[menu.ID]
 	for i := 0; i < len(menu.Children); i++ {
 		err = menuService.getBaseChildrenList(&menu.Children[i], treeMap)
@@ -130,8 +130,8 @@ func (menuService *MenuService) getBaseChildrenList(menu *dao.SysBaseMenu, treeM
 //@param: menu model.SysBaseMenu
 //@return: error
 
-func (menuService *MenuService) AddBaseMenu(menu dao.SysBaseMenu) error {
-	_, err := dao.QueryBaseMenuByName(menu.Name)
+func (menuService *MenuService) AddBaseMenu(menu system.SysBaseMenu) error {
+	_, err := system.QueryBaseMenuByName(menu.Name)
 	if !errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("存在重复name,请修改name")
 	}
@@ -143,9 +143,9 @@ func (menuService *MenuService) AddBaseMenu(menu dao.SysBaseMenu) error {
 //@description: 获取路由总树map
 //@return: treeMap map[string][]system.SysBaseMenu, err error
 
-func (menuService *MenuService) getBaseMenuTreeMap() (treeMap map[uint][]dao.SysBaseMenu, err error) {
-	treeMap = make(map[uint][]dao.SysBaseMenu)
-	allMenus, err := dao.QueryBaseMenuAndMenuBtnAndParameters()
+func (menuService *MenuService) getBaseMenuTreeMap() (treeMap map[uint][]system.SysBaseMenu, err error) {
+	treeMap = make(map[uint][]system.SysBaseMenu)
+	allMenus, err := system.QueryBaseMenuAndMenuBtnAndParameters()
 	for _, v := range allMenus {
 		treeMap[v.ParentId] = append(treeMap[v.ParentId], v)
 	}
@@ -157,7 +157,7 @@ func (menuService *MenuService) getBaseMenuTreeMap() (treeMap map[uint][]dao.Sys
 //@description: 获取基础路由树
 //@return: menus []system.SysBaseMenu, err error
 
-func (menuService *MenuService) GetBaseMenuTree() (menus []dao.SysBaseMenu, err error) {
+func (menuService *MenuService) GetBaseMenuTree() (menus []system.SysBaseMenu, err error) {
 	treeMap, err := menuService.getBaseMenuTreeMap()
 	menus = treeMap[0]
 	for i := 0; i < len(menus); i++ {
@@ -172,8 +172,8 @@ func (menuService *MenuService) GetBaseMenuTree() (menus []dao.SysBaseMenu, err
 //@param: menus []model.SysBaseMenu, authorityId string
 //@return: err error
 
-func (menuService *MenuService) AddMenuAuthority(menus []dao.SysBaseMenu, authorityId uint) (err error) {
-	var auth dao.SysAuthority
+func (menuService *MenuService) AddMenuAuthority(menus []system.SysBaseMenu, authorityId uint) (err error) {
+	var auth system.SysAuthority
 	auth.AuthorityId = authorityId
 	auth.SysBaseMenus = menus
 	err = AuthorityServiceApp.SetMenuAuthority(&auth)
@@ -186,8 +186,8 @@ func (menuService *MenuService) AddMenuAuthority(menus []dao.SysBaseMenu, author
 //@param: info *request.GetAuthorityId
 //@return: menus []system.SysMenu, err error
 
-func (menuService *MenuService) GetMenuAuthority(info *request.GetAuthorityId) (menus []dao.SysMenu, err error) {
-	SysAuthorityMenus, err := dao.QueryAuthorityMenuByAuthorityId(info.AuthorityId)
+func (menuService *MenuService) GetMenuAuthority(info *request.GetAuthorityId) (menus []system.SysMenu, err error) {
+	SysAuthorityMenus, err := system.QueryAuthorityMenuByAuthorityId(info.AuthorityId)
 	if err != nil {
 		return
 	}
@@ -198,10 +198,10 @@ func (menuService *MenuService) GetMenuAuthority(info *request.GetAuthorityId) (
 		MenuIds = append(MenuIds, SysAuthorityMenus[i].MenuId)
 	}
 
-	baseMenu, err := dao.QueryBaseMenuAndParametersByMenuId(MenuIds)
+	baseMenu, err := system.QueryBaseMenuAndParametersByMenuId(MenuIds)
 
 	for i := range baseMenu {
-		menus = append(menus, dao.SysMenu{
+		menus = append(menus, system.SysMenu{
 			SysBaseMenu: baseMenu[i],
 			AuthorityId: info.AuthorityId,
 			MenuId:      baseMenu[i].ID,
@@ -214,13 +214,13 @@ func (menuService *MenuService) GetMenuAuthority(info *request.GetAuthorityId) (
 // UserAuthorityDefaultRouter 用户角色默认路由检查
 //
 //	Author [SliverHorn](https://github.com/SliverHorn)
-func (menuService *MenuService) UserAuthorityDefaultRouter(user *dao.SysUser) {
-	menuIds, err := dao.QuerySysBaseMenuIdById(user.AuthorityId)
+func (menuService *MenuService) UserAuthorityDefaultRouter(user *system.SysUser) {
+	menuIds, err := system.QuerySysBaseMenuIdById(user.AuthorityId)
 	if err != nil {
 		return
 	}
 
-	_, err = dao.QueryBaseMenuByIdAndDefaultRouter(user.Authority.DefaultRouter, menuIds)
+	_, err = system.QueryBaseMenuByIdAndDefaultRouter(user.Authority.DefaultRouter, menuIds)
 
 	if errors.Is(err, gorm.ErrRecordNotFound) {
 		user.Authority.DefaultRouter = "404"

+ 6 - 6
server/service/system/sys_operation_record.go

@@ -1,7 +1,7 @@
 package system
 
 import (
-	"server/dao"
+	"server/dao/system"
 	"server/model/common/request"
 	systemReq "server/model/system/request"
 )
@@ -14,7 +14,7 @@ import (
 
 type OperationRecordService struct{}
 
-func (operationRecordService *OperationRecordService) CreateSysOperationRecord(sysOperationRecord dao.SysOperationRecord) (err error) {
+func (operationRecordService *OperationRecordService) CreateSysOperationRecord(sysOperationRecord system.SysOperationRecord) (err error) {
 	return sysOperationRecord.CreateSysOperationRecord()
 }
 
@@ -26,7 +26,7 @@ func (operationRecordService *OperationRecordService) CreateSysOperationRecord(s
 //@return: err error
 
 func (operationRecordService *OperationRecordService) DeleteSysOperationRecordByIds(ids request.IdsReq) error {
-	return dao.DeleteSysOperationRecordByIds(ids.Ids)
+	return system.DeleteSysOperationRecordByIds(ids.Ids)
 }
 
 //@author: [granty1](https://github.com/granty1)
@@ -35,7 +35,7 @@ func (operationRecordService *OperationRecordService) DeleteSysOperationRecordBy
 //@param: sysOperationRecord model.SysOperationRecord
 //@return: err error
 
-func (operationRecordService *OperationRecordService) DeleteSysOperationRecord(sysOperationRecord dao.SysOperationRecord) error {
+func (operationRecordService *OperationRecordService) DeleteSysOperationRecord(sysOperationRecord system.SysOperationRecord) error {
 	return sysOperationRecord.DeleteSysOperationRecord()
 }
 
@@ -45,8 +45,8 @@ func (operationRecordService *OperationRecordService) DeleteSysOperationRecord(s
 //@param: id uint
 //@return: sysOperationRecord system.SysOperationRecord, err error
 
-func (operationRecordService *OperationRecordService) GetSysOperationRecord(id uint) (dao.SysOperationRecord, error) {
-	return dao.GetSysOperationRecord(id)
+func (operationRecordService *OperationRecordService) GetSysOperationRecord(id uint) (system.SysOperationRecord, error) {
+	return system.GetSysOperationRecord(id)
 }
 
 //@author: [granty1](https://github.com/granty1)

+ 21 - 21
server/service/system/sys_user.go

@@ -3,7 +3,7 @@ package system
 import (
 	"errors"
 	"fmt"
-	"server/dao"
+	"server/dao/system"
 	"time"
 
 	"github.com/gofrs/uuid/v5"
@@ -21,8 +21,8 @@ import (
 
 type UserService struct{}
 
-func (userService *UserService) Register(u dao.SysUser) (userInter dao.SysUser, err error) {
-	_, err = dao.QueryUserByUserName(u.Username)
+func (userService *UserService) Register(u system.SysUser) (userInter system.SysUser, err error) {
+	_, err = system.QueryUserByUserName(u.Username)
 	if !errors.Is(err, gorm.ErrRecordNotFound) { // 判断用户名是否注册
 		return userInter, errors.New("用户名已注册")
 	}
@@ -40,12 +40,12 @@ func (userService *UserService) Register(u dao.SysUser) (userInter dao.SysUser,
 //@param: u *model.SysUser
 //@return: err error, userInter *model.SysUser
 
-func (userService *UserService) Login(u *dao.SysUser) (userInter *dao.SysUser, err error) {
+func (userService *UserService) Login(u *system.SysUser) (userInter *system.SysUser, err error) {
 	if nil == global.GVA_DB {
 		return nil, fmt.Errorf("db not init")
 	}
 
-	user, err := dao.QueryUserAndAuthorityByUserName(u.Username)
+	user, err := system.QueryUserAndAuthorityByUserName(u.Username)
 
 	if err == nil {
 		if ok := utils.BcryptCheck(u.Password, user.Password); !ok {
@@ -62,8 +62,8 @@ func (userService *UserService) Login(u *dao.SysUser) (userInter *dao.SysUser, e
 //@param: u *model.SysUser, newPassword string
 //@return: userInter *model.SysUser,err error
 
-func (userService *UserService) ChangePassword(u *dao.SysUser, newPassword string) (userInter *dao.SysUser, err error) {
-	user, err := dao.QueryUserByUserId(u.ID)
+func (userService *UserService) ChangePassword(u *system.SysUser, newPassword string) (userInter *system.SysUser, err error) {
+	user, err := system.QueryUserByUserId(u.ID)
 	if err != nil {
 		return nil, err
 	}
@@ -86,7 +86,7 @@ func (userService *UserService) GetUserInfoList(info request.PageInfo) (list int
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 
-	userList, total, err := dao.QueryUserInfoList(limit, offset)
+	userList, total, err := system.QueryUserInfoList(limit, offset)
 
 	return userList, total, err
 }
@@ -98,13 +98,13 @@ func (userService *UserService) GetUserInfoList(info request.PageInfo) (list int
 //@return: err error
 
 func (userService *UserService) SetUserAuthority(id uint, authorityId uint) (err error) {
-	_, assignErr := dao.QueryUserAuthority(id, authorityId)
+	_, assignErr := system.QueryUserAuthority(id, authorityId)
 
 	if errors.Is(assignErr, gorm.ErrRecordNotFound) {
 		return errors.New("该用户无此角色")
 	}
 
-	return dao.UpdateUserAuthority(id, authorityId)
+	return system.UpdateUserAuthority(id, authorityId)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -114,7 +114,7 @@ func (userService *UserService) SetUserAuthority(id uint, authorityId uint) (err
 //@return: err error
 
 func (userService *UserService) SetUserAuthorities(id uint, authorityId uint) (err error) {
-	return dao.SetUserAuthorities(id, authorityId)
+	return system.SetUserAuthorities(id, authorityId)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -124,7 +124,7 @@ func (userService *UserService) SetUserAuthorities(id uint, authorityId uint) (e
 //@return: err error
 
 func (userService *UserService) DeleteUser(id int) (err error) {
-	return dao.DeleteUser(id)
+	return system.DeleteUser(id)
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)
@@ -133,7 +133,7 @@ func (userService *UserService) DeleteUser(id int) (err error) {
 //@param: reqUser model.SysUser
 //@return: err error, user model.SysUser
 
-func (userService *UserService) SetUserInfo(req dao.SysUser) error {
+func (userService *UserService) SetUserInfo(req system.SysUser) error {
 	req.UpdatedAt = time.Now()
 	return req.SetUserInfo()
 }
@@ -144,7 +144,7 @@ func (userService *UserService) SetUserInfo(req dao.SysUser) error {
 //@param: reqUser model.SysUser
 //@return: err error, user model.SysUser
 
-func (userService *UserService) SetSelfInfo(req dao.SysUser) error {
+func (userService *UserService) SetSelfInfo(req system.SysUser) error {
 	return req.SetUserInfoById()
 }
 
@@ -155,8 +155,8 @@ func (userService *UserService) SetSelfInfo(req dao.SysUser) error {
 //@param: uuid uuid.UUID
 //@return: err error, user system.SysUser
 
-func (userService *UserService) GetUserInfo(uuid uuid.UUID) (user dao.SysUser, err error) {
-	reqUser, err := dao.GetUserInfoByUUID(uuid)
+func (userService *UserService) GetUserInfo(uuid uuid.UUID) (user system.SysUser, err error) {
+	reqUser, err := system.GetUserInfoByUUID(uuid)
 	if err != nil {
 		return reqUser, err
 	}
@@ -170,8 +170,8 @@ func (userService *UserService) GetUserInfo(uuid uuid.UUID) (user dao.SysUser, e
 //@param: id int
 //@return: err error, user *model.SysUser
 
-func (userService *UserService) FindUserById(id int) (user *dao.SysUser, err error) {
-	u, err := dao.QueryUserByUserId(uint(id))
+func (userService *UserService) FindUserById(id int) (user *system.SysUser, err error) {
+	u, err := system.QueryUserByUserId(uint(id))
 	return &u, err
 }
 
@@ -181,14 +181,14 @@ func (userService *UserService) FindUserById(id int) (user *dao.SysUser, err err
 //@param: uuid string
 //@return: err error, user *model.SysUser
 
-func (userService *UserService) FindUserByUuid(uuidStr string) (user *dao.SysUser, err error) {
+func (userService *UserService) FindUserByUuid(uuidStr string) (user *system.SysUser, err error) {
 	id, err := uuid.FromString(uuidStr)
 	if err != nil {
 		fmt.Println("Error parsing UUID:", err)
 		return
 	}
 
-	u, err := dao.GetUserInfoByUUID(id)
+	u, err := system.GetUserInfoByUUID(id)
 	if err != nil {
 		return &u, errors.New("用户不存在")
 	}
@@ -203,7 +203,7 @@ func (userService *UserService) FindUserByUuid(uuidStr string) (user *dao.SysUse
 //@return: err error
 
 func (userService *UserService) ResetPassword(ID uint) error {
-	return dao.SysUser{
+	return system.SysUser{
 		GVA_MODEL: global.GVA_MODEL{
 			ID: ID,
 		},

BIN
server/uploads/file/202cb962ac59075b964b07152d234b70_20240617153252.jpg


+ 1 - 1
web/src/core/config.js

@@ -3,7 +3,7 @@
  */
 
 const config = {
-  appName: '龙弛财务',
+  appName: '龙弛智慧路口',
   appLogo: '../../assets/logo.png',
   showViteLogo: true,
   logs: [],

+ 2 - 4
web/src/view/login/index.vue

@@ -20,7 +20,7 @@
               >
             </div>
             <div class="mb-9">
-              <p class="text-center text-4xl font-bold">龙弛财务</p>
+              <p class="text-center text-4xl font-bold">龙弛智慧路口</p>
             </div>
             <el-form
               ref="loginForm"
@@ -147,8 +147,6 @@ const loginFormData = reactive({
   openCaptcha: false,
 })
 
-
-
 const rules = reactive({
   username: [{ validator: checkUsername, trigger: 'blur' }],
   password: [{ validator: checkPassword, trigger: 'blur' }],
@@ -161,7 +159,7 @@ const rules = reactive({
 })
 
 const publicKey = ref()
-//获取公钥
+// 获取公钥
 const queryPublicKey = async() => {
   const req = await routerPublicKey()
   publicKey.value = req.data.publicKey