style: linker
This commit is contained in:
@@ -6,8 +6,7 @@ import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/autocode/request"
|
||||
)
|
||||
|
||||
type AutoCodeExampleService struct {
|
||||
}
|
||||
type AutoCodeExampleService struct{}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: CreateAutoCodeExample
|
||||
@@ -16,7 +15,6 @@ type AutoCodeExampleService struct {
|
||||
//@return: err error
|
||||
|
||||
func (autoCodeExampleService *AutoCodeExampleService) CreateAutoCodeExample(autoCodeExample autocode.AutoCodeExample) (err error) {
|
||||
|
||||
err = global.GVA_DB.Create(&autoCodeExample).Error
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FileUploadAndDownloadService struct {
|
||||
}
|
||||
type FileUploadAndDownloadService struct{}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: FindOrCreateFile
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
systemService "github.com/flipped-aurora/gin-vue-admin/server/service/system"
|
||||
)
|
||||
|
||||
type CustomerService struct {
|
||||
}
|
||||
type CustomerService struct{}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: CreateExaCustomer
|
||||
|
||||
@@ -10,8 +10,7 @@ import (
|
||||
"github.com/xuri/excelize/v2"
|
||||
)
|
||||
|
||||
type ExcelService struct {
|
||||
}
|
||||
type ExcelService struct{}
|
||||
|
||||
func (exa *ExcelService) ParseInfoList2Excel(infoList []system.SysBaseMenu, filePath string) error {
|
||||
excel := excelize.NewFile()
|
||||
|
||||
@@ -2,15 +2,15 @@ package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go.uber.org/zap"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
)
|
||||
|
||||
type JwtService struct {
|
||||
}
|
||||
type JwtService struct{}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: JsonInBlacklist
|
||||
@@ -36,9 +36,9 @@ func (jwtService *JwtService) JsonInBlacklist(jwtList system.JwtBlacklist) (err
|
||||
func (jwtService *JwtService) IsBlacklist(jwt string) bool {
|
||||
_, ok := global.BlackCache.Get(jwt)
|
||||
return ok
|
||||
//err := global.GVA_DB.Where("jwt = ?", jwt).First(&system.JwtBlacklist{}).Error
|
||||
//isNotFound := errors.Is(err, gorm.ErrRecordNotFound)
|
||||
//return !isNotFound
|
||||
// err := global.GVA_DB.Where("jwt = ?", jwt).First(&system.JwtBlacklist{}).Error
|
||||
// isNotFound := errors.Is(err, gorm.ErrRecordNotFound)
|
||||
// return !isNotFound
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
|
||||
@@ -16,8 +16,7 @@ import (
|
||||
//@param: api model.SysApi
|
||||
//@return: err error
|
||||
|
||||
type ApiService struct {
|
||||
}
|
||||
type ApiService struct{}
|
||||
|
||||
var ApiServiceApp = new(ApiService)
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ import (
|
||||
//@param: auth model.SysAuthority
|
||||
//@return: err error, authority model.SysAuthority
|
||||
|
||||
type AuthorityService struct {
|
||||
}
|
||||
type AuthorityService struct{}
|
||||
|
||||
var AuthorityServiceApp = new(AuthorityService)
|
||||
|
||||
@@ -100,7 +99,7 @@ func (authorityService *AuthorityService) DeleteAuthority(auth *system.SysAuthor
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
//err = db.Association("SysBaseMenus").Delete(&auth)
|
||||
// err = db.Association("SysBaseMenus").Delete(&auth)
|
||||
} else {
|
||||
err = db.Error
|
||||
if err != nil {
|
||||
|
||||
@@ -76,8 +76,7 @@ type tplData struct {
|
||||
autoMoveFilePath string
|
||||
}
|
||||
|
||||
type AutoCodeService struct {
|
||||
}
|
||||
type AutoCodeService struct{}
|
||||
|
||||
var AutoCodeServiceApp = new(AutoCodeService)
|
||||
|
||||
@@ -108,7 +107,7 @@ func (autoCodeService *AutoCodeService) PreviewTemp(autoCode system.AutoCodeStru
|
||||
if ext = filepath.Ext(value.autoCodePath); ext == ".txt" {
|
||||
continue
|
||||
}
|
||||
f, err := os.OpenFile(value.autoCodePath, os.O_CREATE|os.O_WRONLY, 0755)
|
||||
f, err := os.OpenFile(value.autoCodePath, os.O_CREATE|os.O_WRONLY, 0o755)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -116,7 +115,7 @@ func (autoCodeService *AutoCodeService) PreviewTemp(autoCode system.AutoCodeStru
|
||||
return nil, err
|
||||
}
|
||||
_ = f.Close()
|
||||
f, err = os.OpenFile(value.autoCodePath, os.O_CREATE|os.O_RDONLY, 0755)
|
||||
f, err = os.OpenFile(value.autoCodePath, os.O_CREATE|os.O_RDONLY, 0o755)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -155,7 +154,7 @@ func makeDictTypes(autoCode *system.AutoCodeStruct) {
|
||||
}
|
||||
}
|
||||
|
||||
for k, _ := range DictTypeM {
|
||||
for k := range DictTypeM {
|
||||
autoCode.DictTypes = append(autoCode.DictTypes, k)
|
||||
}
|
||||
}
|
||||
@@ -184,7 +183,7 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
|
||||
|
||||
// 生成文件
|
||||
for _, value := range dataList {
|
||||
f, err := os.OpenFile(value.autoCodePath, os.O_CREATE|os.O_WRONLY, 0755)
|
||||
f, err := os.OpenFile(value.autoCodePath, os.O_CREATE|os.O_WRONLY, 0o755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -274,7 +273,6 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
|
||||
return system.AutoMoveErr
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
@@ -363,7 +361,7 @@ func (autoCodeService *AutoCodeService) addAutoMoveFile(data *tplData) {
|
||||
//@return: err error
|
||||
|
||||
func (autoCodeService *AutoCodeService) AutoCreateApi(a *system.AutoCodeStruct) (ids []uint, err error) {
|
||||
var apiList = []system.SysApi{
|
||||
apiList := []system.SysApi{
|
||||
{
|
||||
Path: "/" + a.Abbreviation + "/" + "create" + a.StructName,
|
||||
Description: "新增" + a.Description,
|
||||
@@ -402,7 +400,6 @@ func (autoCodeService *AutoCodeService) AutoCreateApi(a *system.AutoCodeStruct)
|
||||
},
|
||||
}
|
||||
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
for _, v := range apiList {
|
||||
var api system.SysApi
|
||||
if errors.Is(tx.Where("path = ? AND method = ?", v.Path, v.Method).First(&api).Error, gorm.ErrRecordNotFound) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var AutoCodePgsql = new(autoCodePgsql)
|
||||
|
||||
@@ -3,11 +3,12 @@ package system
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
@@ -79,7 +80,6 @@ func (autoCodeHistoryService *AutoCodeHistoryService) RollBack(info *request.Get
|
||||
// 删除表
|
||||
if err = AutoCodeServiceApp.DropTable(name.TableName); err != nil {
|
||||
global.GVA_LOG.Error("ClearTag DropTable:", zap.Error(err))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type BaseMenuService struct {
|
||||
}
|
||||
type BaseMenuService struct{}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: DeleteBaseMenu
|
||||
|
||||
@@ -18,8 +18,7 @@ import (
|
||||
//@param: authorityId string, casbinInfos []request.CasbinInfo
|
||||
//@return: error
|
||||
|
||||
type CasbinService struct {
|
||||
}
|
||||
type CasbinService struct{}
|
||||
|
||||
var CasbinServiceApp = new(CasbinService)
|
||||
|
||||
@@ -85,7 +84,6 @@ func (casbinService *CasbinService) ClearCasbin(v int, p ...string) bool {
|
||||
e := casbinService.Casbin()
|
||||
success, _ := e.RemoveFilteredPolicy(v, p...)
|
||||
return success
|
||||
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
|
||||
@@ -15,8 +15,7 @@ import (
|
||||
//@param: sysDictionary model.SysDictionary
|
||||
//@return: err error
|
||||
|
||||
type DictionaryService struct {
|
||||
}
|
||||
type DictionaryService struct{}
|
||||
|
||||
func (dictionaryService *DictionaryService) CreateSysDictionary(sysDictionary system.SysDictionary) (err error) {
|
||||
if (!errors.Is(global.GVA_DB.First(&system.SysDictionary{}, "type = ?", sysDictionary.Type).Error, gorm.ErrRecordNotFound)) {
|
||||
|
||||
@@ -12,8 +12,7 @@ import (
|
||||
//@param: sysDictionaryDetail model.SysDictionaryDetail
|
||||
//@return: err error
|
||||
|
||||
type DictionaryDetailService struct {
|
||||
}
|
||||
type DictionaryDetailService struct{}
|
||||
|
||||
func (dictionaryDetailService *DictionaryDetailService) CreateSysDictionaryDetail(sysDictionaryDetail system.SysDictionaryDetail) (err error) {
|
||||
err = global.GVA_DB.Create(&sysDictionaryDetail).Error
|
||||
|
||||
@@ -3,6 +3,7 @@ package system
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
adapter "github.com/casbin/gorm-adapter/v3"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
|
||||
@@ -49,7 +50,6 @@ func (initDBService *InitDBService) initTables() error {
|
||||
example.ExaFileChunk{},
|
||||
example.ExaFileUploadAndDownload{},
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// createDatabase 创建数据库(mysql)
|
||||
|
||||
@@ -2,6 +2,8 @@ package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/config"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
@@ -12,7 +14,6 @@ import (
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// writeMysqlConfig mysql回写配置
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/config"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
@@ -11,7 +13,6 @@ import (
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// writePgsqlConfig pgsql 回写配置
|
||||
|
||||
@@ -16,8 +16,7 @@ import (
|
||||
//@param: authorityId string
|
||||
//@return: err error, treeMap map[string][]model.SysMenu
|
||||
|
||||
type MenuService struct {
|
||||
}
|
||||
type MenuService struct{}
|
||||
|
||||
var MenuServiceApp = new(MenuService)
|
||||
|
||||
@@ -153,7 +152,7 @@ func (menuService *MenuService) AddMenuAuthority(menus []system.SysBaseMenu, aut
|
||||
|
||||
func (menuService *MenuService) GetMenuAuthority(info *request.GetAuthorityId) (err error, menus []system.SysMenu) {
|
||||
err = global.GVA_DB.Where("authority_id = ? ", info.AuthorityId).Order("sort").Find(&menus).Error
|
||||
//sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC"
|
||||
//err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error
|
||||
// sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC"
|
||||
// err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error
|
||||
return err, menus
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@ import (
|
||||
//@param: sysOperationRecord model.SysOperationRecord
|
||||
//@return: err error
|
||||
|
||||
type OperationRecordService struct {
|
||||
}
|
||||
type OperationRecordService struct{}
|
||||
|
||||
func (operationRecordService *OperationRecordService) CreateSysOperationRecord(sysOperationRecord system.SysOperationRecord) (err error) {
|
||||
err = global.GVA_DB.Create(&sysOperationRecord).Error
|
||||
|
||||
@@ -13,8 +13,7 @@ import (
|
||||
//@description: 读取配置文件
|
||||
//@return: err error, conf config.Server
|
||||
|
||||
type SystemConfigService struct {
|
||||
}
|
||||
type SystemConfigService struct{}
|
||||
|
||||
func (systemConfigService *SystemConfigService) GetSystemConfig() (err error, conf config.Server) {
|
||||
return nil, global.GVA_CONFIG
|
||||
|
||||
@@ -18,8 +18,7 @@ import (
|
||||
//@param: u model.SysUser
|
||||
//@return: err error, userInter model.SysUser
|
||||
|
||||
type UserService struct {
|
||||
}
|
||||
type UserService struct{}
|
||||
|
||||
func (userService *UserService) Register(u system.SysUser) (err error, userInter system.SysUser) {
|
||||
var user system.SysUser
|
||||
|
||||
Reference in New Issue
Block a user