正在显示
4 个修改的文件
包含
10 行增加
和
5 行删除
| @@ -28,6 +28,11 @@ func (rs *RoleUserService) Create(in *command.UserRoleCreateCommand) (interface{ | @@ -28,6 +28,11 @@ func (rs *RoleUserService) Create(in *command.UserRoleCreateCommand) (interface{ | ||
| 28 | }() | 28 | }() |
| 29 | roleUserRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | 29 | roleUserRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 30 | 30 | ||
| 31 | + //int64Array := make([]int64, 0) | ||
| 32 | + //for i := range in.UserIds { | ||
| 33 | + // int64Num, _ := strconv.ParseInt(in.UserIds[i], 10, 64) | ||
| 34 | + // int64Array = append(int64Array, int64Num) | ||
| 35 | + //} | ||
| 31 | // 检测已存在的关联用户 | 36 | // 检测已存在的关联用户 |
| 32 | _, rus, err := roleUserRepository.Find(map[string]interface{}{"roleId": in.RoleId, "companyId": in.CompanyId, "userIds": in.UserIds, "limit": 9999999}) | 37 | _, rus, err := roleUserRepository.Find(map[string]interface{}{"roleId": in.RoleId, "companyId": in.CompanyId, "userIds": in.UserIds, "limit": 9999999}) |
| 33 | if err != nil { | 38 | if err != nil { |
| @@ -17,5 +17,5 @@ type EvaluationRule struct { | @@ -17,5 +17,5 @@ type EvaluationRule struct { | ||
| 17 | Score domain.Score `comment:"评分"` | 17 | Score domain.Score `comment:"评分"` |
| 18 | CreatedAt time.Time `comment:"创建时间"` | 18 | CreatedAt time.Time `comment:"创建时间"` |
| 19 | UpdatedAt time.Time `comment:"更新时间"` | 19 | UpdatedAt time.Time `comment:"更新时间"` |
| 20 | - DeletedAt *time.Time `comment:"删除时间" pg:",soft_delete"` | 20 | + DeletedAt *time.Time `comment:"删除时间"` |
| 21 | } | 21 | } |
| @@ -10,5 +10,5 @@ type RoleUser struct { | @@ -10,5 +10,5 @@ type RoleUser struct { | ||
| 10 | CompanyId int64 `comment:"公司ID"` | 10 | CompanyId int64 `comment:"公司ID"` |
| 11 | CreatedAt time.Time `comment:"创建时间"` | 11 | CreatedAt time.Time `comment:"创建时间"` |
| 12 | UpdatedAt time.Time `comment:"更新时间"` | 12 | UpdatedAt time.Time `comment:"更新时间"` |
| 13 | - DeletedAt *time.Time `comment:"删除时间" pg:",soft_delete"` | 13 | + DeletedAt *time.Time `comment:"删除时间"` |
| 14 | } | 14 | } |
| @@ -125,7 +125,7 @@ func (repo *RoleUserRepository) Find(queryOptions map[string]interface{}) (int64 | @@ -125,7 +125,7 @@ func (repo *RoleUserRepository) Find(queryOptions map[string]interface{}) (int64 | ||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | if userIds, ok := queryOptions["userIds"]; ok { | 127 | if userIds, ok := queryOptions["userIds"]; ok { |
| 128 | - query.Where("user_id in (?)", userIds) | 128 | + query.Where("user_id in (?)", pg.In(userIds)) |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | if v, ok := queryOptions["limit"].(int); ok { | 131 | if v, ok := queryOptions["limit"].(int); ok { |
| @@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error { | @@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error { | ||
| 182 | return err | 182 | return err |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | -func (repo *RoleUserRepository) FindAllContainUser(pageSize int, pageNumber int, companyId int64, roleId int64) ([]*domain.RoleContainUser, error) { | 185 | +func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) ([]*domain.RoleContainUser, error) { |
| 186 | limit := pageSize | 186 | limit := pageSize |
| 187 | offset := limit * (pageNumber - 1) | 187 | offset := limit * (pageNumber - 1) |
| 188 | if offset < 0 { | 188 | if offset < 0 { |
| @@ -192,7 +192,7 @@ func (repo *RoleUserRepository) FindAllContainUser(pageSize int, pageNumber int, | @@ -192,7 +192,7 @@ func (repo *RoleUserRepository) FindAllContainUser(pageSize int, pageNumber int, | ||
| 192 | "role_user".role_id, | 192 | "role_user".role_id, |
| 193 | "role_user".user_id, | 193 | "role_user".user_id, |
| 194 | "user".name as user_name, | 194 | "user".name as user_name, |
| 195 | - "user".email as user_email, | 195 | + "user".email as user_email |
| 196 | ` | 196 | ` |
| 197 | whereFrom := ` | 197 | whereFrom := ` |
| 198 | FROM "role_user" | 198 | FROM "role_user" |
-
请 注册 或 登录 后发表评论