BaseAutoCode

package
v5.1.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConfig

func CreateConfig(args *ArgsCreateConfig) (id int64, err error)

CreateConfig 创建配置

func CreateNewCode

func CreateNewCode(args *ArgsCreateNewCode, rawParams any) (newCode string, isReplaceData bool)

CreateNewCode 生成新的编码 rawParams 本次计划提交的数据包,如果配置包含自定义规则,将从该数据包中取数据

func DeleteConfig

func DeleteConfig(args *ArgsDeleteConfig) (err error)

DeleteConfig 删除配置

func GetConfigNameByID

func GetConfigNameByID(id int64) (name string)

GetConfigNameByID 获取配置名称

func Init

func Init()

Init 初始化

func UpdateConfig

func UpdateConfig(args *ArgsUpdateConfig) (err error)

UpdateConfig 修改配置

Types

type ArgsCreateConfig

type ArgsCreateConfig struct {
	//名称
	Name string `db:"name" json:"name" check:"name" min:"1" max:"300"`
	//系统模块标识码
	// eq: user_core 用户模块
	ModuleCode string `db:"module_code" json:"moduleCode" check:"code"`
	//模块内分支标识码
	// eq: user_core_core 用户模块的用户表
	BranchCode string `db:"branch_code" json:"branchCode" check:"code"`
	//编码前缀
	// eq: UC 用户中心
	Prefix string `db:"prefix" json:"prefix" check:"code" empty:"true"`
	//是否自动按序号生成
	AutoNumber bool `db:"auto_number" json:"autoNumber" check:"bool"`
	//是否全局强制唯一
	IsGlobalUnique bool `db:"is_global_unique" json:"isGlobalUnique" check:"bool"`
	//模块内是否强制唯一
	IsBranchUnique bool `db:"is_branch_unique" json:"isBranchUnique" check:"bool"`
	//是否记录日志
	// 如果不记录日志,将无法实现上述排重功能
	IsLog bool `db:"is_log" json:"isLog" check:"bool"`
	//是否启用
	IsEnable bool `db:"is_enable" json:"isEnable" check:"bool"`
	//自定义生成规则
	// 对应的字段名用{}包裹,支持多个字段组合;原则上仅支持英文字符(自动大写)、数字、下划线;不支持特殊字符
	// eq: {prefix}{auto_number}
	CustomRule string `db:"custom_rule" json:"customRule" check:"des" min:"1" max:"255" empty:"true"`
}

ArgsCreateConfig 创建配置参数

type ArgsCreateNewCode

type ArgsCreateNewCode struct {
	//系统模块标识码
	// eq: user_core 用户模块
	ModuleCode string `db:"module_code" json:"moduleCode" check:"code"`
	//模块内分支标识码
	// eq: user_core_core 用户模块的用户表
	BranchCode string `db:"branch_code" json:"branchCode" check:"code"`
}

ArgsCreateNewCode 生成新的编码参数

type ArgsDeleteConfig

type ArgsDeleteConfig struct {
	//ID
	ID int64 `db:"id" json:"id" check:"id"`
}

ArgsDeleteConfig 删除配置参数

type ArgsGetConfigByID

type ArgsGetConfigByID struct {
	//ID
	ID int64 `db:"id" json:"id" check:"id"`
}

ArgsGetConfigByID 获取配置参数

type ArgsGetConfigList

type ArgsGetConfigList struct {
	//分页参数
	Pages CoreSQL2.ArgsPages `json:"pages"`
	//系统模块标识码
	// eq: user_core 用户模块
	ModuleCode string `db:"module_code" json:"moduleCode" check:"code" empty:"true"`
	//模块内分支标识码
	// eq: user_core_core 用户模块的用户表
	BranchCode string `db:"branch_code" json:"branchCode" check:"code" empty:"true"`
	//是否删除
	IsRemove bool `json:"isRemove" check:"bool"`
	//搜索
	Search string `json:"search" check:"search" empty:"true"`
}

ArgsGetConfigList 获取编码配置列表参数

type ArgsUpdateConfig

type ArgsUpdateConfig struct {
	//ID
	ID int64 `db:"id" json:"id" check:"id"`
	//名称
	Name string `db:"name" json:"name" check:"name" min:"1" max:"300"`
	//系统模块标识码
	// eq: user_core 用户模块
	ModuleCode string `db:"module_code" json:"moduleCode" check:"code"`
	//模块内分支标识码
	// eq: user_core_core 用户模块的用户表
	BranchCode string `db:"branch_code" json:"branchCode" check:"code"`
	//编码前缀
	// eq: UC 用户中心
	Prefix string `db:"prefix" json:"prefix" check:"code" empty:"true"`
	//是否自动按序号生成
	AutoNumber bool `db:"auto_number" json:"autoNumber" check:"bool"`
	//是否全局强制唯一
	IsGlobalUnique bool `db:"is_global_unique" json:"isGlobalUnique" check:"bool"`
	//模块内是否强制唯一
	IsBranchUnique bool `db:"is_branch_unique" json:"isBranchUnique" check:"bool"`
	//是否记录日志
	// 如果不记录日志,将无法实现上述排重功能
	IsLog bool `db:"is_log" json:"isLog" check:"bool"`
	//是否启用
	IsEnable bool `db:"is_enable" json:"isEnable" check:"bool"`
	//自定义生成规则
	// 对应的字段名用{}包裹,支持多个字段组合;原则上仅支持英文字符(自动大写)、数字、下划线;不支持特殊字符
	// eq: {prefix}{auto_number}
	CustomRule string `db:"custom_rule" json:"customRule" check:"des" min:"1" max:"255" empty:"true"`
}

ArgsUpdateConfig 修改配置参数

type FieldsConfig

type FieldsConfig struct {
	//ID
	ID int64 `db:"id" json:"id" check:"id"`
	//创建时间
	CreateAt time.Time `db:"create_at" json:"createAt"`
	//更新时间
	UpdateAt time.Time `db:"update_at" json:"updateAt"`
	//删除时间
	DeleteAt time.Time `db:"delete_at" json:"deleteAt"`
	//名称
	Name string `db:"name" json:"name" check:"name" min:"1" max:"300"`
	//系统模块标识码
	// eq: user_core 用户模块
	ModuleCode string `db:"module_code" json:"moduleCode" check:"code"`
	//模块内分支标识码
	// eq: user_core_core 用户模块的用户表
	BranchCode string `db:"branch_code" json:"branchCode" check:"code"`
	//编码前缀
	// eq: UC 用户中心
	Prefix string `db:"prefix" json:"prefix" check:"code" empty:"true"`
	//是否自动按序号生成
	AutoNumber bool `db:"auto_number" json:"autoNumber" check:"bool"`
	//自动生成序号预留位数
	AutoNumberLen int `db:"auto_number_len" json:"autoNumberLen" check:"int" min:"1" max:"10" empty:"true"`
	//是否全局强制唯一
	IsGlobalUnique bool `db:"is_global_unique" json:"isGlobalUnique" check:"bool"`
	//模块内是否强制唯一
	IsBranchUnique bool `db:"is_branch_unique" json:"isBranchUnique" check:"bool"`
	//是否记录日志
	// 如果不记录日志,将无法实现上述排重功能
	IsLog bool `db:"is_log" json:"isLog" check:"bool"`
	//是否启用
	IsEnable bool `db:"is_enable" json:"isEnable" check:"bool"`
	//自定义生成规则
	// 对应的字段名用","分割,支持多个字段组合;原则上仅支持英文字符(自动大写)、数字、下划线;不支持特殊字符、标点符号
	// eq: prefix,auto_number
	// eg: jk,area_code,date,count:3
	//     固定标记,地区标记(模块内自定义),日期(年月日),表内计数器(3位)(如果有日期则按照日期检索当日计数器)
	CustomRule string `db:"custom_rule" json:"customRule" check:"des" min:"1" max:"255" empty:"true"`
}

FieldsConfig 自动编码字段配置

func GetConfigByID

func GetConfigByID(args *ArgsGetConfigByID) (data FieldsConfig, err error)

GetConfigByID 获取配置

func GetConfigList

func GetConfigList(args *ArgsGetConfigList) (dataList []FieldsConfig, dataCount int64, err error)

GetConfigList 获取编码配置列表

type FieldsLog

type FieldsLog struct {
	//ID
	ID int64 `db:"id" json:"id" check:"id"`
	//创建时间
	CreateAt time.Time `db:"create_at" json:"createAt"`
	//系统模块标识码
	// eq: user_core 用户模块
	ModuleCode string `db:"module_code" json:"moduleCode" check:"code"`
	//模块内分支标识码
	// eq: user_core_core 用户模块的用户表
	BranchCode string `db:"branch_code" json:"branchCode" check:"code"`
	//采用配置ID
	ConfigID int64 `db:"config_id" json:"configId" check:"id"`
	//编码
	Code string `db:"code" json:"code" check:"code"`
}

FieldsLog 自动编码字段配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL