feat: 完善 dictionary 相关功能。

main
NoahLan 1 year ago
parent ec7677a6e9
commit 8d19325240

@ -47,6 +47,12 @@ const (
UserSocialUserIdNotEmpty code.Code = iota + 1500 UserSocialUserIdNotEmpty code.Code = iota + 1500
) )
// Dictionary
const (
DictionaryNameNotEmpty code.Code = iota + 1600
DictionaryNameInUsed
)
func init() { func init() {
// Common // Common
msg.Add(WrongCode, "auth.wrongCode") msg.Add(WrongCode, "auth.wrongCode")

@ -27,38 +27,50 @@ enum DistrictQueryType {
Parents = 3; Parents = 3;
} }
message DepartmentReq { message DepartmentInfo {
int64 ID = 1; int64 ID = 1;
string name = 2; string status = 2;
int64 leader_id = 3; string created_at = 3;
int64 parent_id = 4; string updated_at = 4;
bool with_leader = 5; string name = 5;
bool with_user = 6; int64 leader_id = 6;
bool with_children = 7; string remark = 7;
optional Pagination page = 10; int64 parent_id = 8;
DepartmentInfo parent = 10;
repeated DepartmentInfo children = 11;
repeated UserInfo users = 12;
UserInfo leader = 13;
} }
message DepartmentListResp { message DeleteDictionaryDetailReq {
repeated int64 ids = 1;
int64 dict_id = 2;
}
message UserSocialListResp {
optional Pagination page = 1; optional Pagination page = 1;
repeated DepartmentInfo data = 2; repeated UserSocialInfo data = 2;
} }
message DictionaryReq { //
int64 ID = 1; message BaseResp {
int32 code = 1;
string msg = 2;
}
message GetDistrictNameResp {
string code = 1;
string name = 2; string name = 2;
string title = 3; repeated string name_list = 3;
bool with_details = 4;
optional Pagination page = 10;
} }
message DictionaryDetailReq { message RecordReq {
int64 user_id = 1;
}
message OauthProviderListResp {
optional Pagination page = 1; optional Pagination page = 1;
int64 ID = 2; repeated OauthProviderInfo data = 2;
int64 dict_id = 3;
string title = 4;
string key = 5;
string value = 6;
bool with_dictionary = 7;
} }
message TokenInfo { message TokenInfo {
@ -74,73 +86,74 @@ message TokenInfo {
UserInfo user = 10; UserInfo user = 10;
} }
message OauthProviderInfo { message UserReq {
int64 ID = 1; int64 ID = 1;
string created_at = 2; string username = 2;
string updated_at = 3; string phone_number = 3;
string name = 4; string email = 4;
string client_id = 5; string nickname = 5;
string client_secret = 6; bool with_role = 6;
string redirect_url = 7; bool with_social = 7;
string scopes = 8; bool with_department = 8;
string auth_url = 9; bool with_token = 9;
string token_url = 10; bool with_login_record = 10;
string info_url = 11; optional Pagination page = 20;
string description = 12;
bool system = 13;
bool init = 14;
} }
message RoleListResp { message GetUserRolesReq {
optional Pagination page = 1; optional Pagination page = 1;
repeated RoleInfo data = 2; int64 user_id = 2;
} }
message IDReq { message DepartmentListResp {
int64 ID = 1; optional Pagination page = 1;
repeated DepartmentInfo data = 2;
} }
// DistrictInfo message DictionaryDetailListResp {
message DistrictInfo { optional Pagination page = 1;
int64 ID = 1; repeated DictionaryDetailInfo data = 2;
string created_at = 2;
string updated_at = 3;
string name = 4;
string short_name = 5;
string code = 6;
string province = 7;
string city = 8;
string area = 9;
string street = 10;
uint32 level = 11;
double latitude = 12;
double longitude = 13;
repeated DistrictInfo children = 20;
} }
message DistrictTree { message DistrictListResp {
repeated DistrictInfo tree = 1; optional Pagination page = 1;
repeated DistrictInfo data = 2;
} }
message DistrictCodeReq { message OauthProviderReq {
string code = 1; int64 ID = 1;
string name = 2;
string client_id = 3;
optional bool system = 4;
optional bool init = 5;
optional Pagination page = 10;
} }
message GetDistrictNameReq { message CallbackReq {
string code = 1; string state = 1;
string separator = 2; string code = 2;
} }
message LoginRecordInfo { message OauthRedirectResp {
string url = 1;
}
message UserInfo {
int64 ID = 1; int64 ID = 1;
string status = 2;
string created_at = 3; string created_at = 3;
string updated_at = 4; string updated_at = 4;
int64 user_id = 5; string username = 5;
string last_login_at = 6; optional string phone_number = 6;
string last_login_ipv4 = 7; optional string email = 7;
string last_login_device = 8; string password = 8;
string last_login_ua = 9; optional string nickname = 9;
uint64 login_count = 10; map<string,string> metas = 10;
repeated RoleInfo roles = 20;
repeated UserSocialInfo socials = 21;
repeated DepartmentInfo departments = 22;
repeated TokenInfo tokens = 23;
LoginRecordInfo login_record = 24;
} }
message UserRoleReq { message UserRoleReq {
@ -149,12 +162,28 @@ message UserRoleReq {
repeated string role_codes = 3; repeated string role_codes = 3;
} }
// Base message message DictionaryInfo {
message Empty {} int64 ID = 1;
string status = 2;
string created_at = 3;
string updated_at = 4;
string title = 5;
string name = 6;
string description = 7;
repeated DictionaryDetailInfo details = 10;
}
message DictionaryDetailListResp { message DictionaryDetailInfo {
optional Pagination page = 1; int64 ID = 1;
repeated DictionaryDetailInfo data = 2; string status = 2;
string created_at = 3;
string updated_at = 4;
string title = 5;
string key = 6;
string value = 7;
uint32 sort = 8;
int64 dictionary_id = 9;
DictionaryInfo dictionary = 10;
} }
message DistrictReq { message DistrictReq {
@ -170,14 +199,8 @@ message DistrictReq {
DistrictQueryType query_type = 11; DistrictQueryType query_type = 11;
} }
message OauthLoginReq { message DistrictCodeReq {
string state = 1; string code = 1;
string provider = 2;
}
message GetUserRolesReq {
optional Pagination page = 1;
int64 user_id = 2;
} }
// //
@ -187,35 +210,47 @@ message Pagination {
uint64 current = 3; uint64 current = 3;
} }
message DictionaryInfo { message GetDistrictNameReq {
string code = 1;
string separator = 2;
}
message LoginRecordInfo {
int64 ID = 1; int64 ID = 1;
string status = 2;
string created_at = 3; string created_at = 3;
string updated_at = 4; string updated_at = 4;
string title = 5; int64 user_id = 5;
string name = 6; string last_login_at = 6;
string description = 7; string last_login_ipv4 = 7;
repeated DictionaryDetailInfo details = 10; string last_login_device = 8;
} string last_login_ua = 9;
uint64 login_count = 10;
message OauthProviderListResp {
optional Pagination page = 1;
repeated OauthProviderInfo data = 2;
} }
message TokenUserReq { message OauthProviderInfo {
int64 user_id = 1; int64 ID = 1;
string created_at = 2;
string updated_at = 3;
string name = 4;
string client_id = 5;
string client_secret = 6;
string redirect_url = 7;
string scopes = 8;
string auth_url = 9;
string token_url = 10;
string info_url = 11;
string description = 12;
bool system = 13;
bool init = 14;
} }
message UserSocialListResp { message OauthLoginReq {
optional Pagination page = 1; string state = 1;
repeated UserSocialInfo data = 2; string provider = 2;
} }
message GetDistrictNameResp { message TokenUserReq {
string code = 1; int64 user_id = 1;
string name = 2;
repeated string name_list = 3;
} }
message TokenReq { message TokenReq {
@ -228,18 +263,32 @@ message TokenReq {
optional Pagination page = 10; optional Pagination page = 10;
} }
message UserReq { message TokenListResp {
optional Pagination page = 1;
repeated TokenInfo data = 2;
}
message DictionaryDetailReq {
optional Pagination page = 1;
int64 ID = 2;
int64 dict_id = 3;
string title = 4;
string key = 5;
string value = 6;
bool with_dictionary = 7;
}
message DictionaryReq {
int64 ID = 1; int64 ID = 1;
string username = 2; string name = 2;
string phone_number = 3; string title = 3;
string email = 4; bool with_details = 4;
string nickname = 5; optional Pagination page = 10;
bool with_role = 6; }
bool with_social = 7;
bool with_department = 8; message RoleListResp {
bool with_token = 9; optional Pagination page = 1;
bool with_login_record = 10; repeated RoleInfo data = 2;
optional Pagination page = 20;
} }
message UserSocialInfo { message UserSocialInfo {
@ -259,44 +308,49 @@ message UserSocialInfo {
UserInfo user = 14; UserInfo user = 14;
} }
message TokenListResp { message DepartmentReq {
optional Pagination page = 1; int64 ID = 1;
repeated TokenInfo data = 2; string name = 2;
} int64 leader_id = 3;
int64 parent_id = 4;
message UserListResp { bool with_leader = 5;
optional Pagination page = 1; bool with_user = 6;
repeated UserInfo data = 2; bool with_children = 7;
} optional Pagination page = 10;
//
message BaseResp {
int32 code = 1;
string msg = 2;
} }
message DeleteDictionaryDetailReq { // ID
repeated int64 ids = 1; message BaseIDResp {
int64 dict_id = 2; int64 ID = 1;
int32 code = 2;
string msg = 3;
} }
message RecordReq { message DictionaryListResp {
int64 user_id = 1; optional Pagination page = 1;
repeated DictionaryInfo data = 2;
} }
message OauthRedirectResp { // DistrictInfo
string url = 1; message DistrictInfo {
int64 ID = 1;
string created_at = 2;
string updated_at = 3;
string name = 4;
string short_name = 5;
string code = 6;
string province = 7;
string city = 8;
string area = 9;
string street = 10;
uint32 level = 11;
double latitude = 12;
double longitude = 13;
repeated DistrictInfo children = 20;
} }
message RoleInfo { message DistrictTree {
int64 ID = 1; repeated DistrictInfo tree = 1;
string status = 2;
string created_at = 3;
string updated_at = 4;
string code = 5;
string name = 6;
string description = 7;
repeated UserInfo users = 10;
} }
message RoleReq { message RoleReq {
@ -307,49 +361,28 @@ message RoleReq {
optional Pagination page = 10; optional Pagination page = 10;
} }
message DictionaryDetailInfo { message UserListResp {
int64 ID = 1; optional Pagination page = 1;
string status = 2; repeated UserInfo data = 2;
string created_at = 3;
string updated_at = 4;
string title = 5;
string key = 6;
string value = 7;
uint32 sort = 8;
int64 dictionary_id = 9;
DictionaryInfo dictionary = 10;
} }
message DistrictListResp { message IDsReq {
optional Pagination page = 1; repeated int64 ids = 1;
repeated DistrictInfo data = 2;
} }
message OauthProviderReq { message IDReq {
int64 ID = 1; int64 ID = 1;
string name = 2;
string client_id = 3;
optional bool system = 4;
optional bool init = 5;
optional Pagination page = 10;
} }
message UserInfo { message RoleInfo {
int64 ID = 1; int64 ID = 1;
string status = 2; string status = 2;
string created_at = 3; string created_at = 3;
string updated_at = 4; string updated_at = 4;
string username = 5; string code = 5;
optional string phone_number = 6; string name = 6;
optional string email = 7; string description = 7;
string password = 8; repeated UserInfo users = 10;
optional string nickname = 9;
map<string,string> metas = 10;
repeated RoleInfo roles = 20;
repeated UserSocialInfo socials = 21;
repeated DepartmentInfo departments = 22;
repeated TokenInfo tokens = 23;
LoginRecordInfo login_record = 24;
} }
message UserSocialReq { message UserSocialReq {
@ -364,41 +397,8 @@ message UserSocialReq {
optional Pagination page = 10; optional Pagination page = 10;
} }
message IDsReq { // Base message
repeated int64 ids = 1; message Empty {}
}
// ID
message BaseIDResp {
int64 ID = 1;
int32 code = 2;
string msg = 3;
}
message DepartmentInfo {
int64 ID = 1;
string status = 2;
string created_at = 3;
string updated_at = 4;
string name = 5;
int64 leader_id = 6;
string remark = 7;
int64 parent_id = 8;
DepartmentInfo parent = 10;
repeated DepartmentInfo children = 11;
repeated UserInfo users = 12;
UserInfo leader = 13;
}
message DictionaryListResp {
optional Pagination page = 1;
repeated DictionaryInfo data = 2;
}
message CallbackReq {
string state = 1;
string code = 2;
}
service Core { service Core {
// group: base // group: base
@ -420,9 +420,9 @@ service Core {
// group: dictionary // group: dictionary
rpc updateDictionary(DictionaryInfo) returns (BaseResp); rpc updateDictionary(DictionaryInfo) returns (BaseResp);
// group: dictionary // group: dictionary
rpc getDictionaryList(UserReq) returns (UserListResp); rpc getDictionaryList(DictionaryReq) returns (DictionaryListResp);
// group: dictionary // group: dictionary
rpc getDictionary(UserReq) returns (DictionaryInfo); rpc getDictionary(DictionaryReq) returns (DictionaryInfo);
// group: dictionary // group: dictionary
rpc deleteDictionary(IDsReq) returns (BaseResp); rpc deleteDictionary(IDsReq) returns (BaseResp);
// Details // Details

@ -71,8 +71,8 @@ type (
// Dictionary Management // Dictionary Management
CreateDictionary(ctx context.Context, in *DictionaryInfo, opts ...grpc.CallOption) (*BaseIDResp, error) CreateDictionary(ctx context.Context, in *DictionaryInfo, opts ...grpc.CallOption) (*BaseIDResp, error)
UpdateDictionary(ctx context.Context, in *DictionaryInfo, opts ...grpc.CallOption) (*BaseResp, error) UpdateDictionary(ctx context.Context, in *DictionaryInfo, opts ...grpc.CallOption) (*BaseResp, error)
GetDictionaryList(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserListResp, error) GetDictionaryList(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryListResp, error)
GetDictionary(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*DictionaryInfo, error) GetDictionary(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryInfo, error)
DeleteDictionary(ctx context.Context, in *IDsReq, opts ...grpc.CallOption) (*BaseResp, error) DeleteDictionary(ctx context.Context, in *IDsReq, opts ...grpc.CallOption) (*BaseResp, error)
// Details // Details
CreateDictionaryDetail(ctx context.Context, in *DictionaryDetailInfo, opts ...grpc.CallOption) (*BaseIDResp, error) CreateDictionaryDetail(ctx context.Context, in *DictionaryDetailInfo, opts ...grpc.CallOption) (*BaseIDResp, error)
@ -184,12 +184,12 @@ func (m *defaultCore) UpdateDictionary(ctx context.Context, in *DictionaryInfo,
return client.UpdateDictionary(ctx, in, opts...) return client.UpdateDictionary(ctx, in, opts...)
} }
func (m *defaultCore) GetDictionaryList(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserListResp, error) { func (m *defaultCore) GetDictionaryList(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryListResp, error) {
client := core.NewCoreClient(m.cli.Conn()) client := core.NewCoreClient(m.cli.Conn())
return client.GetDictionaryList(ctx, in, opts...) return client.GetDictionaryList(ctx, in, opts...)
} }
func (m *defaultCore) GetDictionary(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*DictionaryInfo, error) { func (m *defaultCore) GetDictionary(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryInfo, error) {
client := core.NewCoreClient(m.cli.Conn()) client := core.NewCoreClient(m.cli.Conn())
return client.GetDictionary(ctx, in, opts...) return client.GetDictionary(ctx, in, opts...)
} }

@ -73,9 +73,9 @@ service Core {
// group: dictionary // group: dictionary
rpc updateDictionary (DictionaryInfo) returns (BaseResp); rpc updateDictionary (DictionaryInfo) returns (BaseResp);
// group: dictionary // group: dictionary
rpc getDictionaryList (UserReq) returns (UserListResp); rpc getDictionaryList (DictionaryReq) returns (DictionaryListResp);
// group: dictionary // group: dictionary
rpc getDictionary (UserReq) returns (DictionaryInfo); rpc getDictionary (DictionaryReq) returns (DictionaryInfo);
// group: dictionary // group: dictionary
rpc deleteDictionary (IDsReq) returns (BaseResp); rpc deleteDictionary (IDsReq) returns (BaseResp);
// Details // Details

@ -34,7 +34,7 @@ const (
// EdgeDetails holds the string denoting the details edge name in mutations. // EdgeDetails holds the string denoting the details edge name in mutations.
EdgeDetails = "details" EdgeDetails = "details"
// Table holds the table name of the dictionary in the database. // Table holds the table name of the dictionary in the database.
Table = "sys_dictionaries" Table = "sys_dictionary"
// DetailsTable is the table that holds the details relation/edge. // DetailsTable is the table that holds the details relation/edge.
DetailsTable = "sys_dictionary_details" DetailsTable = "sys_dictionary_details"
// DetailsInverseTable is the table name for the DictionaryDetail entity. // DetailsInverseTable is the table name for the DictionaryDetail entity.

@ -38,7 +38,7 @@ const (
DictionaryTable = "sys_dictionary_details" DictionaryTable = "sys_dictionary_details"
// DictionaryInverseTable is the table name for the Dictionary entity. // DictionaryInverseTable is the table name for the Dictionary entity.
// It exists in this package in order to avoid circular dependency with the "dictionary" package. // It exists in this package in order to avoid circular dependency with the "dictionary" package.
DictionaryInverseTable = "sys_dictionaries" DictionaryInverseTable = "sys_dictionary"
// DictionaryColumn is the table column denoting the dictionary relation/edge. // DictionaryColumn is the table column denoting the dictionary relation/edge.
DictionaryColumn = "dictionary_id" DictionaryColumn = "dictionary_id"
) )

@ -42,8 +42,8 @@ var (
}, },
}, },
} }
// SysDictionariesColumns holds the columns for the "sys_dictionaries" table. // SysDictionaryColumns holds the columns for the "sys_dictionary" table.
SysDictionariesColumns = []*schema.Column{ SysDictionaryColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"}, {Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
@ -53,12 +53,12 @@ var (
{Name: "name", Type: field.TypeString, Unique: true, Comment: "The name of dictionary for search | 字典搜索名称"}, {Name: "name", Type: field.TypeString, Unique: true, Comment: "The name of dictionary for search | 字典搜索名称"},
{Name: "description", Type: field.TypeString, Nullable: true, Comment: "The description of dictionary | 字典的描述"}, {Name: "description", Type: field.TypeString, Nullable: true, Comment: "The description of dictionary | 字典的描述"},
} }
// SysDictionariesTable holds the schema information for the "sys_dictionaries" table. // SysDictionaryTable holds the schema information for the "sys_dictionary" table.
SysDictionariesTable = &schema.Table{ SysDictionaryTable = &schema.Table{
Name: "sys_dictionaries", Name: "sys_dictionary",
Comment: "字典表", Comment: "字典表",
Columns: SysDictionariesColumns, Columns: SysDictionaryColumns,
PrimaryKey: []*schema.Column{SysDictionariesColumns[0]}, PrimaryKey: []*schema.Column{SysDictionaryColumns[0]},
} }
// SysDictionaryDetailsColumns holds the columns for the "sys_dictionary_details" table. // SysDictionaryDetailsColumns holds the columns for the "sys_dictionary_details" table.
SysDictionaryDetailsColumns = []*schema.Column{ SysDictionaryDetailsColumns = []*schema.Column{
@ -79,10 +79,10 @@ var (
PrimaryKey: []*schema.Column{SysDictionaryDetailsColumns[0]}, PrimaryKey: []*schema.Column{SysDictionaryDetailsColumns[0]},
ForeignKeys: []*schema.ForeignKey{ ForeignKeys: []*schema.ForeignKey{
{ {
Symbol: "sys_dictionary_details_sys_dictionaries_details", Symbol: "sys_dictionary_details_sys_dictionary_details",
Columns: []*schema.Column{SysDictionaryDetailsColumns[7]}, Columns: []*schema.Column{SysDictionaryDetailsColumns[7]},
RefColumns: []*schema.Column{SysDictionariesColumns[0]}, RefColumns: []*schema.Column{SysDictionaryColumns[0]},
OnDelete: schema.NoAction, OnDelete: schema.Cascade,
}, },
}, },
} }
@ -133,7 +133,7 @@ var (
Symbol: "sys_login_record_sys_user_loginRecord", Symbol: "sys_login_record_sys_user_loginRecord",
Columns: []*schema.Column{SysLoginRecordColumns[9]}, Columns: []*schema.Column{SysLoginRecordColumns[9]},
RefColumns: []*schema.Column{SysUserColumns[0]}, RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction, OnDelete: schema.Cascade,
}, },
}, },
} }
@ -206,7 +206,7 @@ var (
Symbol: "sys_token_sys_user_token", Symbol: "sys_token_sys_user_token",
Columns: []*schema.Column{SysTokenColumns[10]}, Columns: []*schema.Column{SysTokenColumns[10]},
RefColumns: []*schema.Column{SysUserColumns[0]}, RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction, OnDelete: schema.Cascade,
}, },
}, },
} }
@ -217,7 +217,6 @@ var (
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1}, {Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Soft delete | 软删除(逻辑删除)", SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "username", Type: field.TypeString, Unique: true, Comment: "User's login name | 登录名"}, {Name: "username", Type: field.TypeString, Unique: true, Comment: "User's login name | 登录名"},
{Name: "phone_number", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Phone number | 手机号"}, {Name: "phone_number", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Phone number | 手机号"},
{Name: "email", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Email | 邮箱号"}, {Name: "email", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Email | 邮箱号"},
@ -252,7 +251,7 @@ var (
Symbol: "sys_usermeta_sys_user_metas", Symbol: "sys_usermeta_sys_user_metas",
Columns: []*schema.Column{SysUsermetaColumns[6]}, Columns: []*schema.Column{SysUsermetaColumns[6]},
RefColumns: []*schema.Column{SysUserColumns[0]}, RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction, OnDelete: schema.Cascade,
}, },
}, },
Indexes: []*schema.Index{ Indexes: []*schema.Index{
@ -300,7 +299,7 @@ var (
Symbol: "sys_user_social_sys_user_socials", Symbol: "sys_user_social_sys_user_socials",
Columns: []*schema.Column{SysUserSocialColumns[12]}, Columns: []*schema.Column{SysUserSocialColumns[12]},
RefColumns: []*schema.Column{SysUserColumns[0]}, RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction, OnDelete: schema.Cascade,
}, },
}, },
} }
@ -357,7 +356,7 @@ var (
// Tables holds all the tables in the schema. // Tables holds all the tables in the schema.
Tables = []*schema.Table{ Tables = []*schema.Table{
SysDepartmentTable, SysDepartmentTable,
SysDictionariesTable, SysDictionaryTable,
SysDictionaryDetailsTable, SysDictionaryDetailsTable,
SysDistrictTable, SysDistrictTable,
SysLoginRecordTable, SysLoginRecordTable,
@ -378,10 +377,10 @@ func init() {
SysDepartmentTable.Annotation = &entsql.Annotation{ SysDepartmentTable.Annotation = &entsql.Annotation{
Table: "sys_department", Table: "sys_department",
} }
SysDictionariesTable.Annotation = &entsql.Annotation{ SysDictionaryTable.Annotation = &entsql.Annotation{
Table: "sys_dictionaries", Table: "sys_dictionary",
} }
SysDictionaryDetailsTable.ForeignKeys[0].RefTable = SysDictionariesTable SysDictionaryDetailsTable.ForeignKeys[0].RefTable = SysDictionaryTable
SysDictionaryDetailsTable.Annotation = &entsql.Annotation{ SysDictionaryDetailsTable.Annotation = &entsql.Annotation{
Table: "sys_dictionary_details", Table: "sys_dictionary_details",
} }

@ -7612,7 +7612,6 @@ type UserMutation struct {
updated_at *time.Time updated_at *time.Time
version *int64 version *int64
addversion *int64 addversion *int64
deleted_at *time.Time
username *string username *string
phone_number *string phone_number *string
email *string email *string
@ -7909,55 +7908,6 @@ func (m *UserMutation) ResetVersion() {
m.addversion = nil m.addversion = nil
} }
// SetDeletedAt sets the "deleted_at" field.
func (m *UserMutation) SetDeletedAt(t time.Time) {
m.deleted_at = &t
}
// DeletedAt returns the value of the "deleted_at" field in the mutation.
func (m *UserMutation) DeletedAt() (r time.Time, exists bool) {
v := m.deleted_at
if v == nil {
return
}
return *v, true
}
// OldDeletedAt returns the old "deleted_at" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeletedAt requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
}
return oldValue.DeletedAt, nil
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (m *UserMutation) ClearDeletedAt() {
m.deleted_at = nil
m.clearedFields[user.FieldDeletedAt] = struct{}{}
}
// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (m *UserMutation) DeletedAtCleared() bool {
_, ok := m.clearedFields[user.FieldDeletedAt]
return ok
}
// ResetDeletedAt resets all changes to the "deleted_at" field.
func (m *UserMutation) ResetDeletedAt() {
m.deleted_at = nil
delete(m.clearedFields, user.FieldDeletedAt)
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (m *UserMutation) SetUsername(s string) { func (m *UserMutation) SetUsername(s string) {
m.username = &s m.username = &s
@ -8520,7 +8470,7 @@ func (m *UserMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call // order to get all numeric fields that were incremented/decremented, call
// AddedFields(). // AddedFields().
func (m *UserMutation) Fields() []string { func (m *UserMutation) Fields() []string {
fields := make([]string, 0, 10) fields := make([]string, 0, 9)
if m.status != nil { if m.status != nil {
fields = append(fields, user.FieldStatus) fields = append(fields, user.FieldStatus)
} }
@ -8533,9 +8483,6 @@ func (m *UserMutation) Fields() []string {
if m.version != nil { if m.version != nil {
fields = append(fields, user.FieldVersion) fields = append(fields, user.FieldVersion)
} }
if m.deleted_at != nil {
fields = append(fields, user.FieldDeletedAt)
}
if m.username != nil { if m.username != nil {
fields = append(fields, user.FieldUsername) fields = append(fields, user.FieldUsername)
} }
@ -8567,8 +8514,6 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
return m.UpdatedAt() return m.UpdatedAt()
case user.FieldVersion: case user.FieldVersion:
return m.Version() return m.Version()
case user.FieldDeletedAt:
return m.DeletedAt()
case user.FieldUsername: case user.FieldUsername:
return m.Username() return m.Username()
case user.FieldPhoneNumber: case user.FieldPhoneNumber:
@ -8596,8 +8541,6 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldUpdatedAt(ctx) return m.OldUpdatedAt(ctx)
case user.FieldVersion: case user.FieldVersion:
return m.OldVersion(ctx) return m.OldVersion(ctx)
case user.FieldDeletedAt:
return m.OldDeletedAt(ctx)
case user.FieldUsername: case user.FieldUsername:
return m.OldUsername(ctx) return m.OldUsername(ctx)
case user.FieldPhoneNumber: case user.FieldPhoneNumber:
@ -8645,13 +8588,6 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
} }
m.SetVersion(v) m.SetVersion(v)
return nil return nil
case user.FieldDeletedAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeletedAt(v)
return nil
case user.FieldUsername: case user.FieldUsername:
v, ok := value.(string) v, ok := value.(string)
if !ok { if !ok {
@ -8732,9 +8668,6 @@ func (m *UserMutation) AddField(name string, value ent.Value) error {
// mutation. // mutation.
func (m *UserMutation) ClearedFields() []string { func (m *UserMutation) ClearedFields() []string {
var fields []string var fields []string
if m.FieldCleared(user.FieldDeletedAt) {
fields = append(fields, user.FieldDeletedAt)
}
if m.FieldCleared(user.FieldPhoneNumber) { if m.FieldCleared(user.FieldPhoneNumber) {
fields = append(fields, user.FieldPhoneNumber) fields = append(fields, user.FieldPhoneNumber)
} }
@ -8758,9 +8691,6 @@ func (m *UserMutation) FieldCleared(name string) bool {
// error if the field is not defined in the schema. // error if the field is not defined in the schema.
func (m *UserMutation) ClearField(name string) error { func (m *UserMutation) ClearField(name string) error {
switch name { switch name {
case user.FieldDeletedAt:
m.ClearDeletedAt()
return nil
case user.FieldPhoneNumber: case user.FieldPhoneNumber:
m.ClearPhoneNumber() m.ClearPhoneNumber()
return nil return nil
@ -8790,9 +8720,6 @@ func (m *UserMutation) ResetField(name string) error {
case user.FieldVersion: case user.FieldVersion:
m.ResetVersion() m.ResetVersion()
return nil return nil
case user.FieldDeletedAt:
m.ResetDeletedAt()
return nil
case user.FieldUsername: case user.FieldUsername:
m.ResetUsername() m.ResetUsername()
return nil return nil

@ -37,7 +37,9 @@ func (Dictionary) Mixin() []ent.Mixin {
func (Dictionary) Edges() []ent.Edge { func (Dictionary) Edges() []ent.Edge {
return []ent.Edge{ return []ent.Edge{
edge.To("details", DictionaryDetail.Type), // one to many // one to many
edge.To("details", DictionaryDetail.Type).
Annotations(entsql.OnDelete(entsql.Cascade)),
} }
} }

@ -6,7 +6,6 @@ import (
"entgo.io/ent/schema" "entgo.io/ent/schema"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
mixins2 "git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/schema/mixins"
"git.noahlan.cn/noahlan/ntool-biz/core/orm/nent/mixins" "git.noahlan.cn/noahlan/ntool-biz/core/orm/nent/mixins"
"git.noahlan.cn/noahlan/ntool/nrandom" "git.noahlan.cn/noahlan/ntool/nrandom"
) )
@ -32,18 +31,28 @@ func (User) Mixin() []ent.Mixin {
mixins.StatusMixin{}, mixins.StatusMixin{},
mixins.TimeMixin{}, mixins.TimeMixin{},
mixins.OptimisticLockMixin{}, mixins.OptimisticLockMixin{},
mixins2.SoftDeleteMixin{},
} }
} }
func (User) Edges() []ent.Edge { func (User) Edges() []ent.Edge {
return []ent.Edge{ return []ent.Edge{
edge.To("metas", UserMeta.Type), // one to many // one to many
edge.To("roles", Role.Type), // one to many edge.To("metas", UserMeta.Type).
edge.To("socials", UserSocial.Type), // one to many Annotations(entsql.OnDelete(entsql.Cascade)),
edge.To("departments", Department.Type), // one to many // one to many
edge.To("token", Token.Type), // one to many edge.To("roles", Role.Type),
edge.To("loginRecord", LoginRecord.Type).Unique(), // one to one // one to many
edge.To("socials", UserSocial.Type).
Annotations(entsql.OnDelete(entsql.Cascade)),
// one to many
edge.To("departments", Department.Type),
// one to many
edge.To("token", Token.Type).
Annotations(entsql.OnDelete(entsql.Cascade)),
// one to one
edge.To("loginRecord", LoginRecord.Type).
Annotations(entsql.OnDelete(entsql.Cascade)).
Unique(),
} }
} }

@ -1712,30 +1712,6 @@ func (u *UserCreate) SetNotNilVersion(value *int64) *UserCreate {
return u return u
} }
// set field if value's pointer is not nil.
func (u *UserUpdate) SetNotNilDeletedAt(value *time.Time) *UserUpdate {
if value != nil {
return u.SetDeletedAt(*value)
}
return u
}
// set field if value's pointer is not nil.
func (u *UserUpdateOne) SetNotNilDeletedAt(value *time.Time) *UserUpdateOne {
if value != nil {
return u.SetDeletedAt(*value)
}
return u
}
// set field if value's pointer is not nil.
func (u *UserCreate) SetNotNilDeletedAt(value *time.Time) *UserCreate {
if value != nil {
return u.SetDeletedAt(*value)
}
return u
}
// set field if value's pointer is not nil. // set field if value's pointer is not nil.
func (u *UserUpdate) SetNotNilUsername(value *string) *UserUpdate { func (u *UserUpdate) SetNotNilUsername(value *string) *UserUpdate {
if value != nil { if value != nil {

@ -28,8 +28,6 @@ type User struct {
UpdatedAt time.Time `json:"updated_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"`
// optimistic lock | 乐观锁 // optimistic lock | 乐观锁
Version int64 `json:"version,omitempty"` Version int64 `json:"version,omitempty"`
// Soft delete | 软删除(逻辑删除)
DeletedAt time.Time `json:"deleted_at,omitempty"`
// User's login name | 登录名 // User's login name | 登录名
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
// Phone number | 手机号 // Phone number | 手机号
@ -132,7 +130,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
case user.FieldStatus, user.FieldUsername, user.FieldPhoneNumber, user.FieldEmail, user.FieldPassword, user.FieldNickname: case user.FieldStatus, user.FieldUsername, user.FieldPhoneNumber, user.FieldEmail, user.FieldPassword, user.FieldNickname:
values[i] = new(sql.NullString) values[i] = new(sql.NullString)
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldDeletedAt: case user.FieldCreatedAt, user.FieldUpdatedAt:
values[i] = new(sql.NullTime) values[i] = new(sql.NullTime)
default: default:
values[i] = new(sql.UnknownType) values[i] = new(sql.UnknownType)
@ -179,12 +177,6 @@ func (u *User) assignValues(columns []string, values []any) error {
} else if value.Valid { } else if value.Valid {
u.Version = value.Int64 u.Version = value.Int64
} }
case user.FieldDeletedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
} else if value.Valid {
u.DeletedAt = value.Time
}
case user.FieldUsername: case user.FieldUsername:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field username", values[i]) return fmt.Errorf("unexpected type %T for field username", values[i])
@ -296,9 +288,6 @@ func (u *User) String() string {
builder.WriteString("version=") builder.WriteString("version=")
builder.WriteString(fmt.Sprintf("%v", u.Version)) builder.WriteString(fmt.Sprintf("%v", u.Version))
builder.WriteString(", ") builder.WriteString(", ")
builder.WriteString("deleted_at=")
builder.WriteString(u.DeletedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("username=") builder.WriteString("username=")
builder.WriteString(u.Username) builder.WriteString(u.Username)
builder.WriteString(", ") builder.WriteString(", ")

@ -25,8 +25,6 @@ const (
FieldUpdatedAt = "updated_at" FieldUpdatedAt = "updated_at"
// FieldVersion holds the string denoting the version field in the database. // FieldVersion holds the string denoting the version field in the database.
FieldVersion = "version" FieldVersion = "version"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldUsername holds the string denoting the username field in the database. // FieldUsername holds the string denoting the username field in the database.
FieldUsername = "username" FieldUsername = "username"
// FieldPhoneNumber holds the string denoting the phone_number field in the database. // FieldPhoneNumber holds the string denoting the phone_number field in the database.
@ -98,7 +96,6 @@ var Columns = []string{
FieldCreatedAt, FieldCreatedAt,
FieldUpdatedAt, FieldUpdatedAt,
FieldVersion, FieldVersion,
FieldDeletedAt,
FieldUsername, FieldUsername,
FieldPhoneNumber, FieldPhoneNumber,
FieldEmail, FieldEmail,
@ -184,11 +181,6 @@ func ByVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVersion, opts...).ToFunc() return sql.OrderByField(FieldVersion, opts...).ToFunc()
} }
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByUsername orders the results by the username field. // ByUsername orders the results by the username field.
func ByUsername(opts ...sql.OrderTermOption) OrderOption { func ByUsername(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUsername, opts...).ToFunc() return sql.OrderByField(FieldUsername, opts...).ToFunc()

@ -71,11 +71,6 @@ func Version(v int64) predicate.User {
return predicate.User(sql.FieldEQ(FieldVersion, v)) return predicate.User(sql.FieldEQ(FieldVersion, v))
} }
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
func DeletedAt(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldDeletedAt, v))
}
// Username applies equality check predicate on the "username" field. It's identical to UsernameEQ. // Username applies equality check predicate on the "username" field. It's identical to UsernameEQ.
func Username(v string) predicate.User { func Username(v string) predicate.User {
return predicate.User(sql.FieldEQ(FieldUsername, v)) return predicate.User(sql.FieldEQ(FieldUsername, v))
@ -251,56 +246,6 @@ func VersionLTE(v int64) predicate.User {
return predicate.User(sql.FieldLTE(FieldVersion, v)) return predicate.User(sql.FieldLTE(FieldVersion, v))
} }
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
func DeletedAtEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldDeletedAt, v))
}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
func DeletedAtNEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldNEQ(FieldDeletedAt, v))
}
// DeletedAtIn applies the In predicate on the "deleted_at" field.
func DeletedAtIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldIn(FieldDeletedAt, vs...))
}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
func DeletedAtNotIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldNotIn(FieldDeletedAt, vs...))
}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.
func DeletedAtGT(v time.Time) predicate.User {
return predicate.User(sql.FieldGT(FieldDeletedAt, v))
}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
func DeletedAtGTE(v time.Time) predicate.User {
return predicate.User(sql.FieldGTE(FieldDeletedAt, v))
}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.
func DeletedAtLT(v time.Time) predicate.User {
return predicate.User(sql.FieldLT(FieldDeletedAt, v))
}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
func DeletedAtLTE(v time.Time) predicate.User {
return predicate.User(sql.FieldLTE(FieldDeletedAt, v))
}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
func DeletedAtIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldDeletedAt))
}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
func DeletedAtNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldDeletedAt))
}
// UsernameEQ applies the EQ predicate on the "username" field. // UsernameEQ applies the EQ predicate on the "username" field.
func UsernameEQ(v string) predicate.User { func UsernameEQ(v string) predicate.User {
return predicate.User(sql.FieldEQ(FieldUsername, v)) return predicate.User(sql.FieldEQ(FieldUsername, v))

@ -85,20 +85,6 @@ func (uc *UserCreate) SetNillableVersion(i *int64) *UserCreate {
return uc return uc
} }
// SetDeletedAt sets the "deleted_at" field.
func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate {
uc.mutation.SetDeletedAt(t)
return uc
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate {
if t != nil {
uc.SetDeletedAt(*t)
}
return uc
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (uc *UserCreate) SetUsername(s string) *UserCreate { func (uc *UserCreate) SetUsername(s string) *UserCreate {
uc.mutation.SetUsername(s) uc.mutation.SetUsername(s)
@ -404,10 +390,6 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldVersion, field.TypeInt64, value) _spec.SetField(user.FieldVersion, field.TypeInt64, value)
_node.Version = value _node.Version = value
} }
if value, ok := uc.mutation.DeletedAt(); ok {
_spec.SetField(user.FieldDeletedAt, field.TypeTime, value)
_node.DeletedAt = value
}
if value, ok := uc.mutation.Username(); ok { if value, ok := uc.mutation.Username(); ok {
_spec.SetField(user.FieldUsername, field.TypeString, value) _spec.SetField(user.FieldUsername, field.TypeString, value)
_node.Username = value _node.Username = value
@ -618,24 +600,6 @@ func (u *UserUpsert) AddVersion(v int64) *UserUpsert {
return u return u
} }
// SetDeletedAt sets the "deleted_at" field.
func (u *UserUpsert) SetDeletedAt(v time.Time) *UserUpsert {
u.Set(user.FieldDeletedAt, v)
return u
}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
func (u *UserUpsert) UpdateDeletedAt() *UserUpsert {
u.SetExcluded(user.FieldDeletedAt)
return u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (u *UserUpsert) ClearDeletedAt() *UserUpsert {
u.SetNull(user.FieldDeletedAt)
return u
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (u *UserUpsert) SetUsername(v string) *UserUpsert { func (u *UserUpsert) SetUsername(v string) *UserUpsert {
u.Set(user.FieldUsername, v) u.Set(user.FieldUsername, v)
@ -814,27 +778,6 @@ func (u *UserUpsertOne) UpdateVersion() *UserUpsertOne {
}) })
} }
// SetDeletedAt sets the "deleted_at" field.
func (u *UserUpsertOne) SetDeletedAt(v time.Time) *UserUpsertOne {
return u.Update(func(s *UserUpsert) {
s.SetDeletedAt(v)
})
}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
func (u *UserUpsertOne) UpdateDeletedAt() *UserUpsertOne {
return u.Update(func(s *UserUpsert) {
s.UpdateDeletedAt()
})
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (u *UserUpsertOne) ClearDeletedAt() *UserUpsertOne {
return u.Update(func(s *UserUpsert) {
s.ClearDeletedAt()
})
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (u *UserUpsertOne) SetUsername(v string) *UserUpsertOne { func (u *UserUpsertOne) SetUsername(v string) *UserUpsertOne {
return u.Update(func(s *UserUpsert) { return u.Update(func(s *UserUpsert) {
@ -1188,27 +1131,6 @@ func (u *UserUpsertBulk) UpdateVersion() *UserUpsertBulk {
}) })
} }
// SetDeletedAt sets the "deleted_at" field.
func (u *UserUpsertBulk) SetDeletedAt(v time.Time) *UserUpsertBulk {
return u.Update(func(s *UserUpsert) {
s.SetDeletedAt(v)
})
}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
func (u *UserUpsertBulk) UpdateDeletedAt() *UserUpsertBulk {
return u.Update(func(s *UserUpsert) {
s.UpdateDeletedAt()
})
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (u *UserUpsertBulk) ClearDeletedAt() *UserUpsertBulk {
return u.Update(func(s *UserUpsert) {
s.ClearDeletedAt()
})
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (u *UserUpsertBulk) SetUsername(v string) *UserUpsertBulk { func (u *UserUpsertBulk) SetUsername(v string) *UserUpsertBulk {
return u.Update(func(s *UserUpsert) { return u.Update(func(s *UserUpsert) {

@ -77,26 +77,6 @@ func (uu *UserUpdate) AddVersion(i int64) *UserUpdate {
return uu return uu
} }
// SetDeletedAt sets the "deleted_at" field.
func (uu *UserUpdate) SetDeletedAt(t time.Time) *UserUpdate {
uu.mutation.SetDeletedAt(t)
return uu
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (uu *UserUpdate) SetNillableDeletedAt(t *time.Time) *UserUpdate {
if t != nil {
uu.SetDeletedAt(*t)
}
return uu
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (uu *UserUpdate) ClearDeletedAt() *UserUpdate {
uu.mutation.ClearDeletedAt()
return uu
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (uu *UserUpdate) SetUsername(s string) *UserUpdate { func (uu *UserUpdate) SetUsername(s string) *UserUpdate {
uu.mutation.SetUsername(s) uu.mutation.SetUsername(s)
@ -461,12 +441,6 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if value, ok := uu.mutation.AddedVersion(); ok { if value, ok := uu.mutation.AddedVersion(); ok {
_spec.AddField(user.FieldVersion, field.TypeInt64, value) _spec.AddField(user.FieldVersion, field.TypeInt64, value)
} }
if value, ok := uu.mutation.DeletedAt(); ok {
_spec.SetField(user.FieldDeletedAt, field.TypeTime, value)
}
if uu.mutation.DeletedAtCleared() {
_spec.ClearField(user.FieldDeletedAt, field.TypeTime)
}
if value, ok := uu.mutation.Username(); ok { if value, ok := uu.mutation.Username(); ok {
_spec.SetField(user.FieldUsername, field.TypeString, value) _spec.SetField(user.FieldUsername, field.TypeString, value)
} }
@ -808,26 +782,6 @@ func (uuo *UserUpdateOne) AddVersion(i int64) *UserUpdateOne {
return uuo return uuo
} }
// SetDeletedAt sets the "deleted_at" field.
func (uuo *UserUpdateOne) SetDeletedAt(t time.Time) *UserUpdateOne {
uuo.mutation.SetDeletedAt(t)
return uuo
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableDeletedAt(t *time.Time) *UserUpdateOne {
if t != nil {
uuo.SetDeletedAt(*t)
}
return uuo
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (uuo *UserUpdateOne) ClearDeletedAt() *UserUpdateOne {
uuo.mutation.ClearDeletedAt()
return uuo
}
// SetUsername sets the "username" field. // SetUsername sets the "username" field.
func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne { func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne {
uuo.mutation.SetUsername(s) uuo.mutation.SetUsername(s)
@ -1222,12 +1176,6 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
if value, ok := uuo.mutation.AddedVersion(); ok { if value, ok := uuo.mutation.AddedVersion(); ok {
_spec.AddField(user.FieldVersion, field.TypeInt64, value) _spec.AddField(user.FieldVersion, field.TypeInt64, value)
} }
if value, ok := uuo.mutation.DeletedAt(); ok {
_spec.SetField(user.FieldDeletedAt, field.TypeTime, value)
}
if uuo.mutation.DeletedAtCleared() {
_spec.ClearField(user.FieldDeletedAt, field.TypeTime)
}
if value, ok := uuo.mutation.Username(); ok { if value, ok := uuo.mutation.Username(); ok {
_spec.SetField(user.FieldUsername, field.TypeString, value) _spec.SetField(user.FieldUsername, field.TypeString, value)
} }

@ -2,6 +2,15 @@ package dictionary
import ( import (
"context" "context"
"git.noahlan.cn/n-admin/n-admin-server/dal/errx"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/dictionary"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/entx"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/hander"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/code"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/msg"
"git.noahlan.cn/noahlan/ntool-biz/core/orm/nent/types"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
@ -21,7 +30,42 @@ func NewCreateDictionaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
// Dictionary Management // Dictionary Management
func (l *CreateDictionaryLogic) CreateDictionary(in *core.DictionaryInfo) (*core.BaseIDResp, error) { func (l *CreateDictionaryLogic) CreateDictionary(in *core.DictionaryInfo) (*core.BaseIDResp, error) {
// todo: add your logic here and delete this line var dbData *ent.Dictionary
if err := entx.WithTx(l.ctx, l.svcCtx.DB, func(tx *ent.Tx) error {
var err error
if err := l.preCheck(tx, in); err != nil {
return err
}
dbData, err = tx.Dictionary.Create().
SetStatus(types.ParseStatus(in.Status)).
SetTitle(in.Title).
SetName(in.Name).
SetDescription(in.Description).Save(l.ctx)
if err != nil {
return hander.HandleEntErr(err, in)
}
return nil
}); err != nil {
return nil, err
}
return &core.BaseIDResp{
ID: dbData.ID,
Code: code.StatusOK,
Msg: msg.CreateSuccess,
}, nil
}
return &core.BaseIDResp{}, nil func (l *CreateDictionaryLogic) preCheck(tx *ent.Tx, in *core.DictionaryInfo) error {
if in.Name == "" {
return nstatus.NewBizErrWithCode(errx.DictionaryNameNotEmpty)
} else {
exist, err := tx.Dictionary.Query().Where(dictionary.NameEQ(in.Name)).Exist(l.ctx)
if err != nil {
return hander.HandleEntErr(err, in)
}
if exist {
return nstatus.NewBizErrWithCode(errx.DictionaryNameInUsed)
}
}
return nil
} }

@ -2,6 +2,10 @@ package dictionary
import ( import (
"context" "context"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/dictionary"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/hander"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/code"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/msg"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
@ -20,7 +24,12 @@ func NewDeleteDictionaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
} }
func (l *DeleteDictionaryLogic) DeleteDictionary(in *core.IDsReq) (*core.BaseResp, error) { func (l *DeleteDictionaryLogic) DeleteDictionary(in *core.IDsReq) (*core.BaseResp, error) {
// todo: add your logic here and delete this line _, err := l.svcCtx.DB.Dictionary.Delete().Where(dictionary.IDIn(in.Ids...)).Exec(l.ctx)
if err != nil {
return &core.BaseResp{}, nil return nil, hander.HandleEntErr(err, in)
}
return &core.BaseResp{
Code: code.StatusOK,
Msg: msg.DeleteSuccess,
}, nil
} }

@ -2,6 +2,11 @@ package dictionary
import ( import (
"context" "context"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/dictionary"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/predicate"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/hander"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
@ -19,8 +24,45 @@ func NewGetDictionaryListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
} }
} }
func (l *GetDictionaryListLogic) GetDictionaryList(in *core.UserReq) (*core.UserListResp, error) { func (l *GetDictionaryListLogic) GetDictionaryList(in *core.DictionaryReq) (*core.DictionaryListResp, error) {
// todo: add your logic here and delete this line var predicates []predicate.Dictionary
if in.Name != "" {
predicates = append(predicates, dictionary.NameContains(in.Name))
}
if in.Title != "" {
predicates = append(predicates, dictionary.TitleContains(in.Title))
}
return &core.UserListResp{}, nil query := l.svcCtx.DB.Dictionary.Query().Where(predicates...)
if in.WithDetails {
query.WithDetails()
}
var (
pagination *core.Pagination
list []*ent.Dictionary
err error
)
if in.Page != nil {
result, pageErr := query.Page(l.ctx, in.Page.Current, in.Page.Size)
if pageErr == nil {
pagination = utils.ConvertPaginationDb(result.PageDetails)
list = result.List
} else {
err = pageErr
}
} else {
list, err = query.All(l.ctx)
}
if err != nil {
return nil, hander.HandleEntErr(err, in)
}
resp := &core.DictionaryListResp{
Page: pagination,
Data: make([]*core.DictionaryInfo, len(list)),
}
for i, v := range list {
resp.Data[i] = l.svcCtx.Convert.ConvertDictionaryRpc(l.ctx, v)
}
return resp, nil
} }

@ -2,6 +2,9 @@ package dictionary
import ( import (
"context" "context"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/dictionary"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/predicate"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/hander"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
@ -19,8 +22,30 @@ func NewGetDictionaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
} }
} }
func (l *GetDictionaryLogic) GetDictionary(in *core.UserReq) (*core.DictionaryInfo, error) { func (l *GetDictionaryLogic) GetDictionary(in *core.DictionaryReq) (*core.DictionaryInfo, error) {
// todo: add your logic here and delete this line var predicates []predicate.Dictionary
if in.ID != 0 {
predicates = append(predicates, dictionary.IDEQ(in.ID))
goto Query
}
if in.Name != "" {
predicates = append(predicates, dictionary.NameEQ(in.Name))
}
if in.Title != "" {
predicates = append(predicates, dictionary.TitleEQ(in.Title))
}
if len(predicates) == 0 {
return nil, nil
}
Query:
query := l.svcCtx.DB.Dictionary.Query().Where(predicates...)
if in.WithDetails {
query.WithDetails()
}
dbData, err := query.First(l.ctx)
if err != nil {
return nil, hander.HandleEntErr(err, in)
}
return &core.DictionaryInfo{}, nil return l.svcCtx.Convert.ConvertDictionaryRpc(l.ctx, dbData), nil
} }

@ -2,9 +2,17 @@ package dictionary
import ( import (
"context" "context"
"git.noahlan.cn/n-admin/n-admin-server/dal/errx"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/ent/dictionary"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/entx"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/internal/utils/hander"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core" "git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/code"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/msg"
"git.noahlan.cn/noahlan/ntool-biz/core/orm/nent/types"
) )
type UpdateDictionaryLogic struct { type UpdateDictionaryLogic struct {
@ -20,7 +28,43 @@ func NewUpdateDictionaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
} }
func (l *UpdateDictionaryLogic) UpdateDictionary(in *core.DictionaryInfo) (*core.BaseResp, error) { func (l *UpdateDictionaryLogic) UpdateDictionary(in *core.DictionaryInfo) (*core.BaseResp, error) {
// todo: add your logic here and delete this line if err := entx.WithTx(l.ctx, l.svcCtx.DB, func(tx *ent.Tx) error {
var err error
if err := l.preCheck(tx, in); err != nil {
return err
}
update := tx.Dictionary.Update().Where(dictionary.IDEQ(in.ID))
update.SetNotEmptyTitle(in.Title).
SetNotEmptyName(in.Name).
SetNotEmptyDescription(in.Description)
if in.Status != "" {
update.SetStatus(types.ParseStatus(in.Status))
}
err = update.Exec(l.ctx)
if err != nil {
return hander.HandleEntErr(err, in)
}
return nil
}); err != nil {
return nil, err
}
return &core.BaseResp{
Code: code.StatusOK,
Msg: msg.UpdateSuccess,
}, nil
}
return &core.BaseResp{}, nil func (l *UpdateDictionaryLogic) preCheck(tx *ent.Tx, in *core.DictionaryInfo) error {
if in.Name == "" {
return nstatus.NewBizErrWithCode(errx.DictionaryNameNotEmpty)
} else {
exist, err := tx.Dictionary.Query().Where(dictionary.NameEQ(in.Name)).Exist(l.ctx)
if err != nil {
return hander.HandleEntErr(err, in)
}
if exist {
return nstatus.NewBizErrWithCode(errx.DictionaryNameInUsed)
}
}
return nil
} }

@ -74,12 +74,12 @@ func (s *CoreServer) UpdateDictionary(ctx context.Context, in *core.DictionaryIn
return l.UpdateDictionary(in) return l.UpdateDictionary(in)
} }
func (s *CoreServer) GetDictionaryList(ctx context.Context, in *core.UserReq) (*core.UserListResp, error) { func (s *CoreServer) GetDictionaryList(ctx context.Context, in *core.DictionaryReq) (*core.DictionaryListResp, error) {
l := dictionary.NewGetDictionaryListLogic(ctx, s.svcCtx) l := dictionary.NewGetDictionaryListLogic(ctx, s.svcCtx)
return l.GetDictionaryList(in) return l.GetDictionaryList(in)
} }
func (s *CoreServer) GetDictionary(ctx context.Context, in *core.UserReq) (*core.DictionaryInfo, error) { func (s *CoreServer) GetDictionary(ctx context.Context, in *core.DictionaryReq) (*core.DictionaryInfo, error) {
l := dictionary.NewGetDictionaryLogic(ctx, s.svcCtx) l := dictionary.NewGetDictionaryLogic(ctx, s.svcCtx)
return l.GetDictionary(in) return l.GetDictionary(in)
} }

@ -190,6 +190,37 @@ func (c *Convert) ConvertDistrictRpc(_ context.Context, v *ent.District) *core.D
} }
var tmp core.DistrictInfo var tmp core.DistrictInfo
_ = copier.Copy(&tmp, v) _ = copier.Copy(&tmp, v)
tmp.CreatedAt = ntime.Format(v.CreatedAt)
tmp.UpdatedAt = ntime.Format(v.UpdatedAt)
return &tmp
}
func (c *Convert) ConvertDictionaryRpc(ctx context.Context, v *ent.Dictionary) *core.DictionaryInfo {
if v == nil {
return nil
}
var tmp core.DictionaryInfo
_ = copier.Copy(&tmp, v)
tmp.CreatedAt = ntime.Format(v.CreatedAt)
tmp.UpdatedAt = ntime.Format(v.UpdatedAt)
if len(v.Edges.Details) > 0 {
tmp.Details = make([]*core.DictionaryDetailInfo, len(v.Edges.Details))
for i, item := range v.Edges.Details {
tmp.Details[i] = c.ConvertDictionaryDetailRpc(ctx, item)
}
}
return &tmp
}
func (c *Convert) ConvertDictionaryDetailRpc(_ context.Context, v *ent.DictionaryDetail) *core.DictionaryDetailInfo {
if v == nil {
return nil
}
var tmp core.DictionaryDetailInfo
_ = copier.Copy(&tmp, v)
tmp.DictionaryId = v.DictionaryID
return &tmp return &tmp
} }

File diff suppressed because it is too large Load Diff

@ -41,9 +41,9 @@ type CoreClient interface {
// group: dictionary // group: dictionary
UpdateDictionary(ctx context.Context, in *DictionaryInfo, opts ...grpc.CallOption) (*BaseResp, error) UpdateDictionary(ctx context.Context, in *DictionaryInfo, opts ...grpc.CallOption) (*BaseResp, error)
// group: dictionary // group: dictionary
GetDictionaryList(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserListResp, error) GetDictionaryList(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryListResp, error)
// group: dictionary // group: dictionary
GetDictionary(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*DictionaryInfo, error) GetDictionary(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryInfo, error)
// group: dictionary // group: dictionary
DeleteDictionary(ctx context.Context, in *IDsReq, opts ...grpc.CallOption) (*BaseResp, error) DeleteDictionary(ctx context.Context, in *IDsReq, opts ...grpc.CallOption) (*BaseResp, error)
// Details // Details
@ -227,8 +227,8 @@ func (c *coreClient) UpdateDictionary(ctx context.Context, in *DictionaryInfo, o
return out, nil return out, nil
} }
func (c *coreClient) GetDictionaryList(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserListResp, error) { func (c *coreClient) GetDictionaryList(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryListResp, error) {
out := new(UserListResp) out := new(DictionaryListResp)
err := c.cc.Invoke(ctx, "/core.Core/getDictionaryList", in, out, opts...) err := c.cc.Invoke(ctx, "/core.Core/getDictionaryList", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -236,7 +236,7 @@ func (c *coreClient) GetDictionaryList(ctx context.Context, in *UserReq, opts ..
return out, nil return out, nil
} }
func (c *coreClient) GetDictionary(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*DictionaryInfo, error) { func (c *coreClient) GetDictionary(ctx context.Context, in *DictionaryReq, opts ...grpc.CallOption) (*DictionaryInfo, error) {
out := new(DictionaryInfo) out := new(DictionaryInfo)
err := c.cc.Invoke(ctx, "/core.Core/getDictionary", in, out, opts...) err := c.cc.Invoke(ctx, "/core.Core/getDictionary", in, out, opts...)
if err != nil { if err != nil {
@ -664,9 +664,9 @@ type CoreServer interface {
// group: dictionary // group: dictionary
UpdateDictionary(context.Context, *DictionaryInfo) (*BaseResp, error) UpdateDictionary(context.Context, *DictionaryInfo) (*BaseResp, error)
// group: dictionary // group: dictionary
GetDictionaryList(context.Context, *UserReq) (*UserListResp, error) GetDictionaryList(context.Context, *DictionaryReq) (*DictionaryListResp, error)
// group: dictionary // group: dictionary
GetDictionary(context.Context, *UserReq) (*DictionaryInfo, error) GetDictionary(context.Context, *DictionaryReq) (*DictionaryInfo, error)
// group: dictionary // group: dictionary
DeleteDictionary(context.Context, *IDsReq) (*BaseResp, error) DeleteDictionary(context.Context, *IDsReq) (*BaseResp, error)
// Details // Details
@ -799,10 +799,10 @@ func (UnimplementedCoreServer) CreateDictionary(context.Context, *DictionaryInfo
func (UnimplementedCoreServer) UpdateDictionary(context.Context, *DictionaryInfo) (*BaseResp, error) { func (UnimplementedCoreServer) UpdateDictionary(context.Context, *DictionaryInfo) (*BaseResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateDictionary not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateDictionary not implemented")
} }
func (UnimplementedCoreServer) GetDictionaryList(context.Context, *UserReq) (*UserListResp, error) { func (UnimplementedCoreServer) GetDictionaryList(context.Context, *DictionaryReq) (*DictionaryListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDictionaryList not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetDictionaryList not implemented")
} }
func (UnimplementedCoreServer) GetDictionary(context.Context, *UserReq) (*DictionaryInfo, error) { func (UnimplementedCoreServer) GetDictionary(context.Context, *DictionaryReq) (*DictionaryInfo, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDictionary not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetDictionary not implemented")
} }
func (UnimplementedCoreServer) DeleteDictionary(context.Context, *IDsReq) (*BaseResp, error) { func (UnimplementedCoreServer) DeleteDictionary(context.Context, *IDsReq) (*BaseResp, error) {
@ -1095,7 +1095,7 @@ func _Core_UpdateDictionary_Handler(srv interface{}, ctx context.Context, dec fu
} }
func _Core_GetDictionaryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Core_GetDictionaryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserReq) in := new(DictionaryReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -1107,13 +1107,13 @@ func _Core_GetDictionaryList_Handler(srv interface{}, ctx context.Context, dec f
FullMethod: "/core.Core/getDictionaryList", FullMethod: "/core.Core/getDictionaryList",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CoreServer).GetDictionaryList(ctx, req.(*UserReq)) return srv.(CoreServer).GetDictionaryList(ctx, req.(*DictionaryReq))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Core_GetDictionary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Core_GetDictionary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserReq) in := new(DictionaryReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -1125,7 +1125,7 @@ func _Core_GetDictionary_Handler(srv interface{}, ctx context.Context, dec func(
FullMethod: "/core.Core/getDictionary", FullMethod: "/core.Core/getDictionary",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CoreServer).GetDictionary(ctx, req.(*UserReq)) return srv.(CoreServer).GetDictionary(ctx, req.(*DictionaryReq))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }

Loading…
Cancel
Save