正在显示
9 个修改的文件
包含
26 行增加
和
14 行删除
不能预览此文件类型
@@ -131,10 +131,13 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen | @@ -131,10 +131,13 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen | ||
131 | if departmentList[i].Id == param.Id { | 131 | if departmentList[i].Id == param.Id { |
132 | departmentList[i].CompanyId = param.CompanyId | 132 | departmentList[i].CompanyId = param.CompanyId |
133 | departmentList[i].Name = param.Name | 133 | departmentList[i].Name = param.Name |
134 | - departmentList[i].Name = param.Path | ||
135 | - departmentList[i].ChargeUserIds = param.ChargeUserIds | 134 | + departmentList[i].Path = param.Path |
135 | + departmentList[i].ChargeUserIds = make([]int64, 0) | ||
136 | departmentList[i].Level = param.Level | 136 | departmentList[i].Level = param.Level |
137 | departmentList[i].ParentId = param.ParentId | 137 | departmentList[i].ParentId = param.ParentId |
138 | + if len(param.ChargeUserIds) > 0 { | ||
139 | + departmentList[i].ChargeUserIds = param.ChargeUserIds | ||
140 | + } | ||
138 | continue | 141 | continue |
139 | } | 142 | } |
140 | 143 |
@@ -156,6 +156,9 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error | @@ -156,6 +156,9 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error | ||
156 | newUser.AdminType = param.AdminType | 156 | newUser.AdminType = param.AdminType |
157 | newUser.Name = param.Name | 157 | newUser.Name = param.Name |
158 | newUser.Status = param.Status | 158 | newUser.Status = param.Status |
159 | + newUser.PositionId = make([]int, 0) | ||
160 | + newUser.DepartmentId = make([]int, 0) | ||
161 | + | ||
159 | newUser.UpdateAt = nowTime | 162 | newUser.UpdateAt = nowTime |
160 | if len(userList) > 0 { | 163 | if len(userList) > 0 { |
161 | _, err = userRepo.Update(newUser) | 164 | _, err = userRepo.Update(newUser) |
@@ -11,5 +11,5 @@ type Company struct { | @@ -11,5 +11,5 @@ type Company struct { | ||
11 | Status int //公司状态,1正常 2禁用 | 11 | Status int //公司状态,1正常 2禁用 |
12 | UpdateAt time.Time //更新时间 | 12 | UpdateAt time.Time //更新时间 |
13 | CreateAt time.Time //创建时间 | 13 | CreateAt time.Time //创建时间 |
14 | - DeleteAt *time.Time `bun:",soft_delete"` //删除时间 | 14 | + DeleteAt *time.Time `pg:",soft_delete"` //删除时间 |
15 | } | 15 | } |
@@ -8,12 +8,12 @@ type Department struct { | @@ -8,12 +8,12 @@ type Department struct { | ||
8 | tableName struct{} `pg:"department"` | 8 | tableName struct{} `pg:"department"` |
9 | Id int64 `pg:"pk:id"` // 组织id | 9 | Id int64 `pg:"pk:id"` // 组织id |
10 | CompanyId int64 // 公司编号 | 10 | CompanyId int64 // 公司编号 |
11 | - Level int // 组织级别 | 11 | + Level int `pg:",use_zero"` // 组织级别 |
12 | Name string // 组织名称 | 12 | Name string // 组织名称 |
13 | - ParentId int64 // 组织父级id | 13 | + ParentId int64 `pg:",use_zero"` // 组织父级id |
14 | ChargeUserIds []int64 // 主管uids | 14 | ChargeUserIds []int64 // 主管uids |
15 | Path string // 组织路径 | 15 | Path string // 组织路径 |
16 | CreateAt time.Time // 创建时间 | 16 | CreateAt time.Time // 创建时间 |
17 | UpdateAt time.Time // 更新时间 | 17 | UpdateAt time.Time // 更新时间 |
18 | - DeleteAt *time.Time `bun:",soft_delete"` // 删除时间 | 18 | + DeleteAt *time.Time `pg:",soft_delete"` // 删除时间 |
19 | } | 19 | } |
@@ -6,11 +6,11 @@ type Positions struct { | @@ -6,11 +6,11 @@ type Positions struct { | ||
6 | Id int64 //ID | 6 | Id int64 //ID |
7 | CompanyId int64 //公司ID | 7 | CompanyId int64 //公司ID |
8 | Name string //职位名称 | 8 | Name string //职位名称 |
9 | - ParentId int64 //父级职位 | 9 | + ParentId int64 `pg:",use_zero"` //父级职位 |
10 | Path string //职位路径 | 10 | Path string //职位路径 |
11 | - Level int //层级 | 11 | + Level int `pg:",use_zero"` //层级 |
12 | Remarks string //备注 | 12 | Remarks string //备注 |
13 | CreatedAt time.Time | 13 | CreatedAt time.Time |
14 | UpdatedAt time.Time | 14 | UpdatedAt time.Time |
15 | - DeletedAt *time.Time `bun:",soft_delete"` | 15 | + DeletedAt *time.Time `pg:",soft_delete"` |
16 | } | 16 | } |
@@ -16,5 +16,5 @@ type User struct { | @@ -16,5 +16,5 @@ type User struct { | ||
16 | PositionId []int // 用户职位 | 16 | PositionId []int // 用户职位 |
17 | UpdateAt time.Time // 更新时间 | 17 | UpdateAt time.Time // 更新时间 |
18 | CreateAt time.Time // 创建时间 | 18 | CreateAt time.Time // 创建时间 |
19 | - DeleteAt *time.Time `bun:",soft_delete"` // 删除时间 | 19 | + DeleteAt *time.Time `pg:",soft_delete"` // 删除时间 |
20 | } | 20 | } |
@@ -97,7 +97,7 @@ func (repo *UserRepository) FindOne(queryOptions map[string]interface{}) (*domai | @@ -97,7 +97,7 @@ func (repo *UserRepository) FindOne(queryOptions map[string]interface{}) (*domai | ||
97 | func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*domain.User, error) { | 97 | func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*domain.User, error) { |
98 | tx := repo.transactionContext.PgTx | 98 | tx := repo.transactionContext.PgTx |
99 | userModel := []models.User{} | 99 | userModel := []models.User{} |
100 | - query := tx.Model(&userModel).Where("delete_at isnull"). | 100 | + query := tx.Model(&userModel).Where("delete_at is null"). |
101 | Limit(20) | 101 | Limit(20) |
102 | if v, ok := queryOptions["id"]; ok { | 102 | if v, ok := queryOptions["id"]; ok { |
103 | query.Where("id=?", v) | 103 | query.Where("id=?", v) |
@@ -59,7 +59,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | @@ -59,7 +59,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | ||
59 | err = companySrv.FromBusinessAdmin(&msgBody) | 59 | err = companySrv.FromBusinessAdmin(&msgBody) |
60 | if err != nil { | 60 | if err != nil { |
61 | log.Logger.Error("处理company消息失败"+err.Error(), map[string]interface{}{ | 61 | log.Logger.Error("处理company消息失败"+err.Error(), map[string]interface{}{ |
62 | - "data": msgBody, | 62 | + "module": msgBody.Module, |
63 | + "action": msgBody.Action, | ||
64 | + "data": string(msgBody.Data), | ||
63 | }) | 65 | }) |
64 | return err | 66 | return err |
65 | } | 67 | } |
@@ -68,7 +70,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | @@ -68,7 +70,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | ||
68 | err = departmentSrv.FromBusinessAdmin(&msgBody) | 70 | err = departmentSrv.FromBusinessAdmin(&msgBody) |
69 | if err != nil { | 71 | if err != nil { |
70 | log.Logger.Error("处理department消息失败"+err.Error(), map[string]interface{}{ | 72 | log.Logger.Error("处理department消息失败"+err.Error(), map[string]interface{}{ |
71 | - "data": msgBody, | 73 | + "module": msgBody.Module, |
74 | + "action": msgBody.Action, | ||
75 | + "data": string(msgBody.Data), | ||
72 | }) | 76 | }) |
73 | return err | 77 | return err |
74 | } | 78 | } |
@@ -77,7 +81,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | @@ -77,7 +81,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | ||
77 | err = employeeSrv.FromBusinessAdmin(&msgBody) | 81 | err = employeeSrv.FromBusinessAdmin(&msgBody) |
78 | if err != nil { | 82 | if err != nil { |
79 | log.Logger.Error("处理employee消息失败"+err.Error(), map[string]interface{}{ | 83 | log.Logger.Error("处理employee消息失败"+err.Error(), map[string]interface{}{ |
80 | - "data": msgBody, | 84 | + "module": msgBody.Module, |
85 | + "action": msgBody.Action, | ||
86 | + "data": string(msgBody.Data), | ||
81 | }) | 87 | }) |
82 | return err | 88 | return err |
83 | } | 89 | } |
-
请 注册 或 登录 后发表评论