添加后台用户表直接分离
This commit is contained in:
24
model/gmodel/fs_backend_user_gen.go
Normal file
24
model/gmodel/fs_backend_user_gen.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_backend_user 管理员表
|
||||
type FsBackendUser struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
Username *string `gorm:"unique_key;default:'';" json:"username"` // 用户名
|
||||
AuthKey *string `gorm:"default:'';" json:"auth_key"` // jwt token
|
||||
PasswordHash *string `gorm:"default:'';" json:"password_hash"` // 加密密码
|
||||
PasswordResetToken *string `gorm:"default:'';" json:"password_reset_token"` //
|
||||
Email *string `gorm:"unique_key;default:'';" json:"email"` // 邮箱
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态
|
||||
Icon *string `gorm:"default:'';" json:"icon"` //
|
||||
DepartmentId *int64 `gorm:"default:0;" json:"department_id"` // 部门id
|
||||
Permission *string `gorm:"default:'';" json:"permission"` // 权限设置
|
||||
CreatedAt *int64 `gorm:"default:0;" json:"created_at"` // 创建时间
|
||||
UpdatedAt *int64 `gorm:"default:0;" json:"updated_at"` // 更新时间
|
||||
}
|
||||
type FsBackendUserModel struct{ db *gorm.DB }
|
||||
|
||||
func NewFsBackendUserModel(db *gorm.DB) *FsBackendUserModel { return &FsBackendUserModel{db} }
|
||||
15
model/gmodel/fs_backend_user_logic.go
Normal file
15
model/gmodel/fs_backend_user_logic.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package gmodel
|
||||
|
||||
import "context"
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (u *FsBackendUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp FsBackendUser, err error) {
|
||||
err = u.db.WithContext(ctx).Model(&resp).Where("`email` = ?", emailname).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (u *FsBackendUserModel) FindUserById(ctx context.Context, Id int64) (resp FsBackendUser, err error) {
|
||||
err = u.db.WithContext(ctx).Model(&resp).Where("`id` = ? and status != ?", Id, 0).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
@@ -9,6 +9,7 @@ type AllModelsGen struct {
|
||||
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
|
||||
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
|
||||
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
|
||||
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
|
||||
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
|
||||
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
|
||||
FsCard *FsCardModel // fs_card 卡号表
|
||||
@@ -16,16 +17,12 @@ type AllModelsGen struct {
|
||||
FsCart *FsCartModel // fs_cart 购物车
|
||||
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
|
||||
FsCloud *FsCloudModel // fs_cloud 云仓表
|
||||
FsCloudDeliverEveryTmp *FsCloudDeliverEveryTmpModel // fs_cloud_deliver_every_tmp
|
||||
FsCloudDeliverTmp *FsCloudDeliverTmpModel // fs_cloud_deliver_tmp
|
||||
FsCloudPickUp *FsCloudPickUpModel // fs_cloud_pick_up 云仓提货单
|
||||
FsCloudPickUpDetail *FsCloudPickUpDetailModel // fs_cloud_pick_up_detail 云仓提货单-详情
|
||||
FsCloudReceive *FsCloudReceiveModel // fs_cloud_receive 云仓接收工厂总单
|
||||
FsCloudReceiveEvery *FsCloudReceiveEveryModel // fs_cloud_receive_every
|
||||
FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表
|
||||
FsCloudUserApplyBack *FsCloudUserApplyBackModel // fs_cloud_user_apply_back 该表废弃
|
||||
FsContact *FsContactModel // fs_contact 该表暂未使用
|
||||
FsContactService *FsContactServiceModel // fs_contact_service
|
||||
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
|
||||
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
|
||||
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
|
||||
@@ -36,7 +33,6 @@ type AllModelsGen struct {
|
||||
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
|
||||
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
|
||||
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
|
||||
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
|
||||
FsFaq *FsFaqModel // fs_faq 常见问题
|
||||
FsFont *FsFontModel // fs_font 字体配置
|
||||
FsGerent *FsGerentModel // fs_gerent 管理员表
|
||||
@@ -54,12 +50,10 @@ type AllModelsGen struct {
|
||||
FsProduct *FsProductModel // fs_product 产品表
|
||||
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
|
||||
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
|
||||
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
|
||||
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
|
||||
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
|
||||
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
|
||||
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
|
||||
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
|
||||
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
|
||||
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
|
||||
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
|
||||
@@ -68,7 +62,6 @@ type AllModelsGen struct {
|
||||
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
|
||||
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型-模板表
|
||||
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
|
||||
FsQrcode *FsQrcodeModel // fs_qrcode
|
||||
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
|
||||
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
|
||||
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
|
||||
@@ -76,13 +69,11 @@ type AllModelsGen struct {
|
||||
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
|
||||
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
|
||||
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
|
||||
FsRefundReason *FsRefundReasonModel // fs_refund_reason
|
||||
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
|
||||
FsTags *FsTagsModel // fs_tags 产品分类表
|
||||
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
|
||||
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
|
||||
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
|
||||
FsTrade *FsTradeModel // fs_trade
|
||||
FsUser *FsUserModel // fs_user 用户表
|
||||
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
|
||||
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
|
||||
@@ -97,6 +88,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsAuthItem: NewFsAuthItemModel(gdb),
|
||||
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
|
||||
FsAuthRule: NewFsAuthRuleModel(gdb),
|
||||
FsBackendUser: NewFsBackendUserModel(gdb),
|
||||
FsCanteenProduct: NewFsCanteenProductModel(gdb),
|
||||
FsCanteenType: NewFsCanteenTypeModel(gdb),
|
||||
FsCard: NewFsCardModel(gdb),
|
||||
@@ -104,16 +96,12 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsCart: NewFsCartModel(gdb),
|
||||
FsChangeCode: NewFsChangeCodeModel(gdb),
|
||||
FsCloud: NewFsCloudModel(gdb),
|
||||
FsCloudDeliverEveryTmp: NewFsCloudDeliverEveryTmpModel(gdb),
|
||||
FsCloudDeliverTmp: NewFsCloudDeliverTmpModel(gdb),
|
||||
FsCloudPickUp: NewFsCloudPickUpModel(gdb),
|
||||
FsCloudPickUpDetail: NewFsCloudPickUpDetailModel(gdb),
|
||||
FsCloudReceive: NewFsCloudReceiveModel(gdb),
|
||||
FsCloudReceiveEvery: NewFsCloudReceiveEveryModel(gdb),
|
||||
FsCloudRenderLog: NewFsCloudRenderLogModel(gdb),
|
||||
FsCloudUserApplyBack: NewFsCloudUserApplyBackModel(gdb),
|
||||
FsContact: NewFsContactModel(gdb),
|
||||
FsContactService: NewFsContactServiceModel(gdb),
|
||||
FsCoupon: NewFsCouponModel(gdb),
|
||||
FsDeliver: NewFsDeliverModel(gdb),
|
||||
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
|
||||
@@ -124,7 +112,6 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
|
||||
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
|
||||
FsFactoryProduct: NewFsFactoryProductModel(gdb),
|
||||
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
|
||||
FsFaq: NewFsFaqModel(gdb),
|
||||
FsFont: NewFsFontModel(gdb),
|
||||
FsGerent: NewFsGerentModel(gdb),
|
||||
@@ -142,12 +129,10 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsProduct: NewFsProductModel(gdb),
|
||||
FsProductCopy1: NewFsProductCopy1Model(gdb),
|
||||
FsProductDesign: NewFsProductDesignModel(gdb),
|
||||
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
|
||||
FsProductModel3d: NewFsProductModel3dModel(gdb),
|
||||
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
|
||||
FsProductOption: NewFsProductOptionModel(gdb),
|
||||
FsProductPrice: NewFsProductPriceModel(gdb),
|
||||
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
|
||||
FsProductScene: NewFsProductSceneModel(gdb),
|
||||
FsProductSize: NewFsProductSizeModel(gdb),
|
||||
FsProductTemplate: NewFsProductTemplateModel(gdb),
|
||||
@@ -156,7 +141,6 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
|
||||
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
|
||||
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
|
||||
FsQrcode: NewFsQrcodeModel(gdb),
|
||||
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
|
||||
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
|
||||
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
|
||||
@@ -164,13 +148,11 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsQuotationProduct: NewFsQuotationProductModel(gdb),
|
||||
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
|
||||
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
|
||||
FsRefundReason: NewFsRefundReasonModel(gdb),
|
||||
FsStandardLogo: NewFsStandardLogoModel(gdb),
|
||||
FsTags: NewFsTagsModel(gdb),
|
||||
FsToolLogs: NewFsToolLogsModel(gdb),
|
||||
FsToolTemplate: NewFsToolTemplateModel(gdb),
|
||||
FsToolUser: NewFsToolUserModel(gdb),
|
||||
FsTrade: NewFsTradeModel(gdb),
|
||||
FsUser: NewFsUserModel(gdb),
|
||||
FsUserDesign: NewFsUserDesignModel(gdb),
|
||||
FsUserStock: NewFsUserStockModel(gdb),
|
||||
|
||||
Reference in New Issue
Block a user