正在显示
58 个修改的文件
包含
320 行增加
和
31 行删除
@@ -23,9 +23,14 @@ type DeviceDto struct { | @@ -23,9 +23,14 @@ type DeviceDto struct { | ||
23 | RiskLevel int `json:"riskLevel,omitempty"` | 23 | RiskLevel int `json:"riskLevel,omitempty"` |
24 | // 所属位置 | 24 | // 所属位置 |
25 | *domain.WorkStation | 25 | *domain.WorkStation |
26 | + | ||
27 | + // 组织名称 | ||
28 | + OrgName string `json:"orgName"` | ||
29 | + // 权限标识 (当前登录组织匹配为true,否则false) | ||
30 | + AuthFlag bool `json:"authFlag"` | ||
26 | } | 31 | } |
27 | 32 | ||
28 | -func (d *DeviceDto) LoadDto(m *domain.Device) *DeviceDto { | 33 | +func (d *DeviceDto) LoadDto(m *domain.Device, orgId int) *DeviceDto { |
29 | d.DeviceId = m.DeviceId | 34 | d.DeviceId = m.DeviceId |
30 | d.DeviceCode = m.DeviceCode | 35 | d.DeviceCode = m.DeviceCode |
31 | d.DeviceName = m.DeviceName | 36 | d.DeviceName = m.DeviceName |
@@ -34,5 +39,9 @@ func (d *DeviceDto) LoadDto(m *domain.Device) *DeviceDto { | @@ -34,5 +39,9 @@ func (d *DeviceDto) LoadDto(m *domain.Device) *DeviceDto { | ||
34 | d.DeviceStatus = m.DeviceStatus | 39 | d.DeviceStatus = m.DeviceStatus |
35 | d.RiskLevel = m.RiskLevel | 40 | d.RiskLevel = m.RiskLevel |
36 | d.WorkStation = m.WorkStation | 41 | d.WorkStation = m.WorkStation |
42 | + d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) | ||
43 | + if m.Ext != nil { | ||
44 | + d.OrgName = m.Ext.OrgName | ||
45 | + } | ||
37 | return d | 46 | return d |
38 | } | 47 | } |
@@ -43,6 +43,13 @@ func (deviceService *DeviceService) CreateDevice(operateInfo *domain.OperateInfo | @@ -43,6 +43,13 @@ func (deviceService *DeviceService) CreateDevice(operateInfo *domain.OperateInfo | ||
43 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 43 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
44 | } | 44 | } |
45 | 45 | ||
46 | + var userService = domainService.NewUserService() | ||
47 | + var org *domain.Org | ||
48 | + org, err = userService.Organization(operateInfo.OrgId) | ||
49 | + if err != nil { | ||
50 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
51 | + } | ||
52 | + | ||
46 | newDevice := &domain.Device{ | 53 | newDevice := &domain.Device{ |
47 | CompanyId: cmd.CompanyId, | 54 | CompanyId: cmd.CompanyId, |
48 | OrgId: cmd.OrgId, | 55 | OrgId: cmd.OrgId, |
@@ -56,6 +63,7 @@ func (deviceService *DeviceService) CreateDevice(operateInfo *domain.OperateInfo | @@ -56,6 +63,7 @@ func (deviceService *DeviceService) CreateDevice(operateInfo *domain.OperateInfo | ||
56 | RiskLevel: cmd.RiskLevel, | 63 | RiskLevel: cmd.RiskLevel, |
57 | CreatedAt: time.Now(), | 64 | CreatedAt: time.Now(), |
58 | UpdatedAt: time.Now(), | 65 | UpdatedAt: time.Now(), |
66 | + Ext: domain.NewExt(org.OrgName), | ||
59 | } | 67 | } |
60 | deviceRepository, _, _ := factory.FastPgDevice(transactionContext, 0) | 68 | deviceRepository, _, _ := factory.FastPgDevice(transactionContext, 0) |
61 | 69 | ||
@@ -116,7 +124,7 @@ func (deviceService *DeviceService) GetDevice(getDeviceQuery *query.GetDeviceQue | @@ -116,7 +124,7 @@ func (deviceService *DeviceService) GetDevice(getDeviceQuery *query.GetDeviceQue | ||
116 | } | 124 | } |
117 | 125 | ||
118 | result := &dto.DeviceDto{} | 126 | result := &dto.DeviceDto{} |
119 | - result.LoadDto(device) | 127 | + result.LoadDto(device, 0) |
120 | return result, nil | 128 | return result, nil |
121 | } | 129 | } |
122 | } | 130 | } |
@@ -280,7 +288,17 @@ func (deviceService *DeviceService) UpdateDevice(cmd *command.UpdateDeviceComman | @@ -280,7 +288,17 @@ func (deviceService *DeviceService) UpdateDevice(cmd *command.UpdateDeviceComman | ||
280 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "设备编号重复") | 288 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "设备编号重复") |
281 | } | 289 | } |
282 | } | 290 | } |
283 | - if err := device.Update(tool_funs.SimpleStructToMap(cmd)); err != nil { | 291 | + |
292 | + var userService = domainService.NewUserService() | ||
293 | + var org *domain.Org | ||
294 | + org, err = userService.Organization(device.OrgId) | ||
295 | + if err != nil { | ||
296 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
297 | + } | ||
298 | + | ||
299 | + data := tool_funs.SimpleStructToMap(cmd) | ||
300 | + data["orgName"] = org.OrgName | ||
301 | + if err := device.Update(data); err != nil { | ||
284 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 302 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
285 | } | 303 | } |
286 | if err := device.Valid(); err != nil { | 304 | if err := device.Valid(); err != nil { |
@@ -327,7 +345,7 @@ func (deviceService *DeviceService) SearchDevice(operateInfo *domain.OperateInfo | @@ -327,7 +345,7 @@ func (deviceService *DeviceService) SearchDevice(operateInfo *domain.OperateInfo | ||
327 | for i := range devices { | 345 | for i := range devices { |
328 | item := devices[i] | 346 | item := devices[i] |
329 | newJobDto := &dto.DeviceDto{} | 347 | newJobDto := &dto.DeviceDto{} |
330 | - newJobDto.LoadDto(item) | 348 | + newJobDto.LoadDto(item, operateInfo.OrgId) |
331 | result = append(result, newJobDto) | 349 | result = append(result, newJobDto) |
332 | } | 350 | } |
333 | return count, result, nil | 351 | return count, result, nil |
@@ -13,13 +13,21 @@ type ProductDto struct { | @@ -13,13 +13,21 @@ type ProductDto struct { | ||
13 | ProductCategory string `json:"productCategory,omitempty"` | 13 | ProductCategory string `json:"productCategory,omitempty"` |
14 | // 产品规格 | 14 | // 产品规格 |
15 | *domain.UnitQuantity | 15 | *domain.UnitQuantity |
16 | + // 组织名称 | ||
17 | + OrgName string `json:"orgName"` | ||
18 | + // 权限标识 (当前登录组织匹配为true,否则false) | ||
19 | + AuthFlag bool `json:"authFlag"` | ||
16 | } | 20 | } |
17 | 21 | ||
18 | -func (d *ProductDto) LoadDto(m *domain.Product) *ProductDto { | 22 | +func (d *ProductDto) LoadDto(m *domain.Product, orgId int) *ProductDto { |
19 | d.ProductId = m.ProductId | 23 | d.ProductId = m.ProductId |
20 | d.ProductCode = m.ProductCode | 24 | d.ProductCode = m.ProductCode |
21 | d.ProductName = m.ProductName | 25 | d.ProductName = m.ProductName |
22 | d.ProductCategory = m.ProductCategory | 26 | d.ProductCategory = m.ProductCategory |
23 | d.UnitQuantity = m.ProductSpec | 27 | d.UnitQuantity = m.ProductSpec |
28 | + d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) | ||
29 | + if m.Ext != nil { | ||
30 | + d.OrgName = m.Ext.OrgName | ||
31 | + } | ||
24 | return d | 32 | return d |
25 | } | 33 | } |
@@ -46,6 +46,12 @@ func (productService *ProductService) CreateProduct(createProductCommand *comman | @@ -46,6 +46,12 @@ func (productService *ProductService) CreateProduct(createProductCommand *comman | ||
46 | } | 46 | } |
47 | createProductCommand.ProductCode = code | 47 | createProductCommand.ProductCode = code |
48 | } | 48 | } |
49 | + var userService = domainService.NewUserService() | ||
50 | + var org *domain.Org | ||
51 | + org, err = userService.Organization(createProductCommand.OrgId) | ||
52 | + if err != nil { | ||
53 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
54 | + } | ||
49 | 55 | ||
50 | newProduct := &domain.Product{ | 56 | newProduct := &domain.Product{ |
51 | CompanyId: createProductCommand.CompanyId, | 57 | CompanyId: createProductCommand.CompanyId, |
@@ -59,6 +65,7 @@ func (productService *ProductService) CreateProduct(createProductCommand *comman | @@ -59,6 +65,7 @@ func (productService *ProductService) CreateProduct(createProductCommand *comman | ||
59 | }, | 65 | }, |
60 | CreatedAt: time.Now(), | 66 | CreatedAt: time.Now(), |
61 | UpdatedAt: time.Now(), | 67 | UpdatedAt: time.Now(), |
68 | + Ext: domain.NewExt(org.OrgName), | ||
62 | } | 69 | } |
63 | productRepository, _, _ := factory.FastPgProduct(transactionContext, 0) | 70 | productRepository, _, _ := factory.FastPgProduct(transactionContext, 0) |
64 | 71 | ||
@@ -110,7 +117,7 @@ func (productService *ProductService) GetProduct(getProductQuery *query.GetProdu | @@ -110,7 +117,7 @@ func (productService *ProductService) GetProduct(getProductQuery *query.GetProdu | ||
110 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 117 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
111 | } | 118 | } |
112 | result := &dto.ProductDto{} | 119 | result := &dto.ProductDto{} |
113 | - return result.LoadDto(product), nil | 120 | + return result.LoadDto(product, 0), nil |
114 | } | 121 | } |
115 | } | 122 | } |
116 | 123 | ||
@@ -267,7 +274,16 @@ func (productService *ProductService) UpdateProduct(updateProductCommand *comman | @@ -267,7 +274,16 @@ func (productService *ProductService) UpdateProduct(updateProductCommand *comman | ||
267 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "产品编号重复,请重新提交") | 274 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "产品编号重复,请重新提交") |
268 | } | 275 | } |
269 | } | 276 | } |
270 | - if err := product.Update(tool_funs.SimpleStructToMap(updateProductCommand)); err != nil { | 277 | + |
278 | + var userService = domainService.NewUserService() | ||
279 | + var org *domain.Org | ||
280 | + org, err = userService.Organization(product.OrgId) | ||
281 | + if err != nil { | ||
282 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
283 | + } | ||
284 | + data := tool_funs.SimpleStructToMap(updateProductCommand) | ||
285 | + data["orgName"] = org.OrgName | ||
286 | + if err := product.Update(data); err != nil { | ||
271 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 287 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
272 | } | 288 | } |
273 | if product, err := productRepository.Save(product); err != nil { | 289 | if product, err := productRepository.Save(product); err != nil { |
@@ -315,7 +331,7 @@ func (productService *ProductService) SearchProduct(operateInfo *domain.OperateI | @@ -315,7 +331,7 @@ func (productService *ProductService) SearchProduct(operateInfo *domain.OperateI | ||
315 | var result = make([]*dto.ProductDto, 0) | 331 | var result = make([]*dto.ProductDto, 0) |
316 | for i := range products { | 332 | for i := range products { |
317 | newItem := &dto.ProductDto{} | 333 | newItem := &dto.ProductDto{} |
318 | - result = append(result, newItem.LoadDto(products[i])) | 334 | + result = append(result, newItem.LoadDto(products[i], operateInfo.OrgId)) |
319 | } | 335 | } |
320 | return count, result, nil | 336 | return count, result, nil |
321 | 337 |
@@ -28,9 +28,13 @@ type ProductCalendarDto struct { | @@ -28,9 +28,13 @@ type ProductCalendarDto struct { | ||
28 | WorkTime float64 `json:"workTime,omitempty"` | 28 | WorkTime float64 `json:"workTime,omitempty"` |
29 | // 已选择日历 | 29 | // 已选择日历 |
30 | CalendarSelectedString string `json:"calendarSelectedString,omitempty"` | 30 | CalendarSelectedString string `json:"calendarSelectedString,omitempty"` |
31 | + // 组织名称 | ||
32 | + OrgName string `json:"orgName"` | ||
33 | + // 权限标识 (当前登录组织匹配为true,否则false) | ||
34 | + AuthFlag bool `json:"authFlag"` | ||
31 | } | 35 | } |
32 | 36 | ||
33 | -func (d *ProductCalendarDto) LoadDto(m *domain.ProductCalendar) *ProductCalendarDto { | 37 | +func (d *ProductCalendarDto) LoadDto(m *domain.ProductCalendar, orgId int) *ProductCalendarDto { |
34 | d.ProductCalendarId = m.ProductCalendarId | 38 | d.ProductCalendarId = m.ProductCalendarId |
35 | d.WorkStation = m.WorkStation | 39 | d.WorkStation = m.WorkStation |
36 | d.WorkOn = m.WorkOn | 40 | d.WorkOn = m.WorkOn |
@@ -40,5 +44,9 @@ func (d *ProductCalendarDto) LoadDto(m *domain.ProductCalendar) *ProductCalendar | @@ -40,5 +44,9 @@ func (d *ProductCalendarDto) LoadDto(m *domain.ProductCalendar) *ProductCalendar | ||
40 | d.BreakTime = m.BreakTime | 44 | d.BreakTime = m.BreakTime |
41 | d.WorkTime = m.WorkTime | 45 | d.WorkTime = m.WorkTime |
42 | d.CalendarSelectedString = strings.Join(m.CalendarSelected, "/") | 46 | d.CalendarSelectedString = strings.Join(m.CalendarSelected, "/") |
47 | + d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) | ||
48 | + if m.Ext != nil { | ||
49 | + d.OrgName = m.Ext.OrgName | ||
50 | + } | ||
43 | return d | 51 | return d |
44 | } | 52 | } |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/dto" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/dto" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/query" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/query" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" |
12 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService" | ||
12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" | 13 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" |
13 | "time" | 14 | "time" |
14 | ) | 15 | ) |
@@ -53,6 +54,13 @@ func (productCalendarService *ProductCalendarService) CreateProductCalendar(oper | @@ -53,6 +54,13 @@ func (productCalendarService *ProductCalendarService) CreateProductCalendar(oper | ||
53 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "工厂日历已存在") | 54 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "工厂日历已存在") |
54 | } | 55 | } |
55 | 56 | ||
57 | + var userService = domainService.NewUserService() | ||
58 | + var org *domain.Org | ||
59 | + org, err = userService.Organization(cmd.OrgId) | ||
60 | + if err != nil { | ||
61 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
62 | + } | ||
63 | + | ||
56 | newProductCalendar := &domain.ProductCalendar{ | 64 | newProductCalendar := &domain.ProductCalendar{ |
57 | CompanyId: cmd.CompanyId, | 65 | CompanyId: cmd.CompanyId, |
58 | OrgId: cmd.OrgId, | 66 | OrgId: cmd.OrgId, |
@@ -65,6 +73,7 @@ func (productCalendarService *ProductCalendarService) CreateProductCalendar(oper | @@ -65,6 +73,7 @@ func (productCalendarService *ProductCalendarService) CreateProductCalendar(oper | ||
65 | //WorkTime: cmd.WorkTime, | 73 | //WorkTime: cmd.WorkTime, |
66 | CreatedAt: time.Now(), | 74 | CreatedAt: time.Now(), |
67 | UpdatedAt: time.Now(), | 75 | UpdatedAt: time.Now(), |
76 | + Ext: domain.NewExt(org.OrgName), | ||
68 | } | 77 | } |
69 | if err = newProductCalendar.ResetWorkTime(cmd.WorkTime); err != nil { | 78 | if err = newProductCalendar.ResetWorkTime(cmd.WorkTime); err != nil { |
70 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 79 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -115,7 +124,7 @@ func (productCalendarService *ProductCalendarService) GetProductCalendar(getProd | @@ -115,7 +124,7 @@ func (productCalendarService *ProductCalendarService) GetProductCalendar(getProd | ||
115 | } | 124 | } |
116 | 125 | ||
117 | result := &dto.ProductCalendarDto{} | 126 | result := &dto.ProductCalendarDto{} |
118 | - result.LoadDto(productCalendar) | 127 | + result.LoadDto(productCalendar, 0) |
119 | return result, nil | 128 | return result, nil |
120 | } | 129 | } |
121 | } | 130 | } |
@@ -281,12 +290,20 @@ func (productCalendarService *ProductCalendarService) UpdateProductCalendar(cmd | @@ -281,12 +290,20 @@ func (productCalendarService *ProductCalendarService) UpdateProductCalendar(cmd | ||
281 | } | 290 | } |
282 | } | 291 | } |
283 | 292 | ||
293 | + var userService = domainService.NewUserService() | ||
294 | + var org *domain.Org | ||
295 | + org, err = userService.Organization(productCalendar.OrgId) | ||
296 | + if err != nil { | ||
297 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
298 | + } | ||
299 | + | ||
284 | productCalendar.WorkStation = workStation | 300 | productCalendar.WorkStation = workStation |
285 | productCalendar.WorkOn = cmd.WorkOn | 301 | productCalendar.WorkOn = cmd.WorkOn |
286 | productCalendar.CalendarSelected = cmd.CalendarSelected | 302 | productCalendar.CalendarSelected = cmd.CalendarSelected |
287 | productCalendar.InWorkAt = cmd.InWorkAt | 303 | productCalendar.InWorkAt = cmd.InWorkAt |
288 | productCalendar.OutWorkAt = cmd.OutWorkAt | 304 | productCalendar.OutWorkAt = cmd.OutWorkAt |
289 | productCalendar.BreakTime = cmd.BreakTime | 305 | productCalendar.BreakTime = cmd.BreakTime |
306 | + productCalendar.Ext = domain.NewExt(org.OrgName) | ||
290 | if err = productCalendar.ResetWorkTime(cmd.WorkTime); err != nil { | 307 | if err = productCalendar.ResetWorkTime(cmd.WorkTime); err != nil { |
291 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 308 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
292 | } | 309 | } |
@@ -336,7 +353,7 @@ func (productCalendarService *ProductCalendarService) SearchProductCalendar(oper | @@ -336,7 +353,7 @@ func (productCalendarService *ProductCalendarService) SearchProductCalendar(oper | ||
336 | for i := range productCalendars { | 353 | for i := range productCalendars { |
337 | item := productCalendars[i] | 354 | item := productCalendars[i] |
338 | newJobDto := &dto.ProductCalendarDto{} | 355 | newJobDto := &dto.ProductCalendarDto{} |
339 | - newJobDto.LoadDto(item) | 356 | + newJobDto.LoadDto(item, operateInfo.OrgId) |
340 | result = append(result, newJobDto) | 357 | result = append(result, newJobDto) |
341 | } | 358 | } |
342 | 359 |
@@ -23,15 +23,13 @@ type ProductGroupDto struct { | @@ -23,15 +23,13 @@ type ProductGroupDto struct { | ||
23 | WorkOn int `json:"workOn,omitempty"` | 23 | WorkOn int `json:"workOn,omitempty"` |
24 | // 工作位置 | 24 | // 工作位置 |
25 | *domain.WorkStation | 25 | *domain.WorkStation |
26 | - // 创建时间 | ||
27 | - //CreatedAt time.Time `json:"createdAt,omitempty"` | ||
28 | - // 更新时间 | ||
29 | - //UpdatedAt time.Time `json:"updatedAt,omitempty"` | ||
30 | - // 删除时间 | ||
31 | - //DeletedAt time.Time `json:"deletedAt,omitempty"` | 26 | + // 组织名称 |
27 | + OrgName string `json:"orgName"` | ||
28 | + // 权限标识 (当前登录组织匹配为true,否则false) | ||
29 | + AuthFlag bool `json:"authFlag"` | ||
32 | } | 30 | } |
33 | 31 | ||
34 | -func (d *ProductGroupDto) LoadDto(m *domain.ProductGroup) *ProductGroupDto { | 32 | +func (d *ProductGroupDto) LoadDto(m *domain.ProductGroup, orgId int) *ProductGroupDto { |
35 | d.ProductGroupId = m.ProductGroupId | 33 | d.ProductGroupId = m.ProductGroupId |
36 | d.GroupName = m.GroupName | 34 | d.GroupName = m.GroupName |
37 | d.GroupLeader = m.GroupLeader.UserName | 35 | d.GroupLeader = m.GroupLeader.UserName |
@@ -42,5 +40,9 @@ func (d *ProductGroupDto) LoadDto(m *domain.ProductGroup) *ProductGroupDto { | @@ -42,5 +40,9 @@ func (d *ProductGroupDto) LoadDto(m *domain.ProductGroup) *ProductGroupDto { | ||
42 | d.GroupMembers = strings.Join(members, ",") | 40 | d.GroupMembers = strings.Join(members, ",") |
43 | d.WorkOn = m.WorkOn | 41 | d.WorkOn = m.WorkOn |
44 | d.WorkStation = m.WorkStation | 42 | d.WorkStation = m.WorkStation |
43 | + d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) | ||
44 | + if m.Ext != nil { | ||
45 | + d.OrgName = m.Ext.OrgName | ||
46 | + } | ||
45 | return d | 47 | return d |
46 | } | 48 | } |
@@ -55,6 +55,11 @@ func (productGroupService *ProductGroupService) CreateProductGroup(operateInfo * | @@ -55,6 +55,11 @@ func (productGroupService *ProductGroupService) CreateProductGroup(operateInfo * | ||
55 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 55 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
56 | } | 56 | } |
57 | 57 | ||
58 | + var org *domain.Org | ||
59 | + org, err = userService.Organization(operateInfo.OrgId) | ||
60 | + if err != nil { | ||
61 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
62 | + } | ||
58 | newProductGroup := &domain.ProductGroup{ | 63 | newProductGroup := &domain.ProductGroup{ |
59 | CompanyId: operateInfo.CompanyId, | 64 | CompanyId: operateInfo.CompanyId, |
60 | OrgId: operateInfo.OrgId, | 65 | OrgId: operateInfo.OrgId, |
@@ -65,6 +70,7 @@ func (productGroupService *ProductGroupService) CreateProductGroup(operateInfo * | @@ -65,6 +70,7 @@ func (productGroupService *ProductGroupService) CreateProductGroup(operateInfo * | ||
65 | WorkOn: cmd.WorkOn, | 70 | WorkOn: cmd.WorkOn, |
66 | CreatedAt: time.Now(), | 71 | CreatedAt: time.Now(), |
67 | UpdatedAt: time.Now(), | 72 | UpdatedAt: time.Now(), |
73 | + Ext: domain.NewExt(org.OrgName), | ||
68 | } | 74 | } |
69 | if group, err := productGroupRepository.FindOne(map[string]interface{}{ | 75 | if group, err := productGroupRepository.FindOne(map[string]interface{}{ |
70 | "groupName": cmd.GroupName, | 76 | "groupName": cmd.GroupName, |
@@ -296,6 +302,13 @@ func (productGroupService *ProductGroupService) UpdateProductGroup(cmd *command. | @@ -296,6 +302,13 @@ func (productGroupService *ProductGroupService) UpdateProductGroup(cmd *command. | ||
296 | productGroup.WorkStation = workStation | 302 | productGroup.WorkStation = workStation |
297 | productGroup.GroupName = cmd.GroupName | 303 | productGroup.GroupName = cmd.GroupName |
298 | 304 | ||
305 | + var org *domain.Org | ||
306 | + org, err = userService.Organization(productGroup.OrgId) | ||
307 | + if err != nil { | ||
308 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
309 | + } | ||
310 | + productGroup.Ext = domain.NewExt(org.OrgName) | ||
311 | + | ||
299 | if err := productGroup.Update(tool_funs.SimpleStructToMap(cmd)); err != nil { | 312 | if err := productGroup.Update(tool_funs.SimpleStructToMap(cmd)); err != nil { |
300 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 313 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
301 | } | 314 | } |
@@ -335,7 +348,7 @@ func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo * | @@ -335,7 +348,7 @@ func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo * | ||
335 | var results = make([]*dto.ProductGroupDto, 0) | 348 | var results = make([]*dto.ProductGroupDto, 0) |
336 | for i := range productGroups { | 349 | for i := range productGroups { |
337 | newItem := &dto.ProductGroupDto{} | 350 | newItem := &dto.ProductGroupDto{} |
338 | - results = append(results, newItem.LoadDto(productGroups[i])) | 351 | + results = append(results, newItem.LoadDto(productGroups[i], operateInfo.OrgId)) |
339 | } | 352 | } |
340 | if err := transactionContext.CommitTransaction(); err != nil { | 353 | if err := transactionContext.CommitTransaction(); err != nil { |
341 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 354 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -30,6 +30,12 @@ type SearchProductJobQuery struct { | @@ -30,6 +30,12 @@ type SearchProductJobQuery struct { | ||
30 | LineName string `cname:"生产线名称" json:"lineName,omitempty"` | 30 | LineName string `cname:"生产线名称" json:"lineName,omitempty"` |
31 | // 工段名称 | 31 | // 工段名称 |
32 | SectionName string `cname:"工段名称" json:"sectionName,omitempty"` | 32 | SectionName string `cname:"工段名称" json:"sectionName,omitempty"` |
33 | + // 车间ID | ||
34 | + WorkshopId int `cname:"车间ID" json: workshopId,omitempty"` | ||
35 | + // 生产线ID | ||
36 | + LineId int `cname:"生产线ID" json:"lineId,omitempty"` | ||
37 | + // 工段ID | ||
38 | + SectionId int `json:"sectionId,omitempty"` | ||
33 | } | 39 | } |
34 | 40 | ||
35 | func (cmd *SearchProductJobQuery) Valid(validation *validation.Validation) { | 41 | func (cmd *SearchProductJobQuery) Valid(validation *validation.Validation) { |
@@ -19,14 +19,22 @@ type UnitConversionDto struct { | @@ -19,14 +19,22 @@ type UnitConversionDto struct { | ||
19 | ToUnitQuantity *domain.UnitQuantity `json:"toUnitQuantity,omitempty"` | 19 | ToUnitQuantity *domain.UnitQuantity `json:"toUnitQuantity,omitempty"` |
20 | // 智能称重标识 1:是 2:否 | 20 | // 智能称重标识 1:是 2:否 |
21 | IntelligentWeighingFlag int `json:"intelligentWeighingFlag,omitempty"` | 21 | IntelligentWeighingFlag int `json:"intelligentWeighingFlag,omitempty"` |
22 | + // 组织名称 | ||
23 | + OrgName string `json:"orgName"` | ||
24 | + // 权限标识 (当前登录组织匹配为true,否则false) | ||
25 | + AuthFlag bool `json:"authFlag"` | ||
22 | } | 26 | } |
23 | 27 | ||
24 | -func (d *UnitConversionDto) LoadDto(m *domain.UnitConversion) *UnitConversionDto { | 28 | +func (d *UnitConversionDto) LoadDto(m *domain.UnitConversion, orgId int) *UnitConversionDto { |
25 | d.UnitConversionId = m.UnitConversionId | 29 | d.UnitConversionId = m.UnitConversionId |
26 | d.WorkStation = m.WorkStation | 30 | d.WorkStation = m.WorkStation |
27 | d.Material = m.Material | 31 | d.Material = m.Material |
28 | d.FromUnitQuantity = m.FromUnitQuantity | 32 | d.FromUnitQuantity = m.FromUnitQuantity |
29 | d.ToUnitQuantity = m.ToUnitQuantity | 33 | d.ToUnitQuantity = m.ToUnitQuantity |
30 | d.IntelligentWeighingFlag = m.IntelligentWeighingFlag | 34 | d.IntelligentWeighingFlag = m.IntelligentWeighingFlag |
35 | + d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) | ||
36 | + if m.Ext != nil { | ||
37 | + d.OrgName = m.Ext.OrgName | ||
38 | + } | ||
31 | return d | 39 | return d |
32 | } | 40 | } |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/dto" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/dto" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/query" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/query" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" |
12 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService" | ||
12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" | 13 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" |
13 | "time" | 14 | "time" |
14 | ) | 15 | ) |
@@ -41,6 +42,13 @@ func (unitConversionService *UnitConversionService) CreateUnitConversion(operate | @@ -41,6 +42,13 @@ func (unitConversionService *UnitConversionService) CreateUnitConversion(operate | ||
41 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 42 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
42 | } | 43 | } |
43 | 44 | ||
45 | + var userService = domainService.NewUserService() | ||
46 | + var org *domain.Org | ||
47 | + org, err = userService.Organization(cmd.OrgId) | ||
48 | + if err != nil { | ||
49 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
50 | + } | ||
51 | + | ||
44 | newUnitConversion := &domain.UnitConversion{ | 52 | newUnitConversion := &domain.UnitConversion{ |
45 | CompanyId: cmd.CompanyId, | 53 | CompanyId: cmd.CompanyId, |
46 | OrgId: cmd.OrgId, | 54 | OrgId: cmd.OrgId, |
@@ -51,6 +59,7 @@ func (unitConversionService *UnitConversionService) CreateUnitConversion(operate | @@ -51,6 +59,7 @@ func (unitConversionService *UnitConversionService) CreateUnitConversion(operate | ||
51 | WorkStation: workStation, | 59 | WorkStation: workStation, |
52 | CreatedAt: time.Now(), | 60 | CreatedAt: time.Now(), |
53 | UpdatedAt: time.Now(), | 61 | UpdatedAt: time.Now(), |
62 | + Ext: domain.NewExt(org.OrgName), | ||
54 | } | 63 | } |
55 | unitConversionRepository, _, _ := factory.FastPgUnitConversion(transactionContext, 0) | 64 | unitConversionRepository, _, _ := factory.FastPgUnitConversion(transactionContext, 0) |
56 | 65 | ||
@@ -87,7 +96,7 @@ func (unitConversionService *UnitConversionService) GetUnitConversion(getUnitCon | @@ -87,7 +96,7 @@ func (unitConversionService *UnitConversionService) GetUnitConversion(getUnitCon | ||
87 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 96 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
88 | } | 97 | } |
89 | result := &dto.UnitConversionDto{} | 98 | result := &dto.UnitConversionDto{} |
90 | - result.LoadDto(unitConversion) | 99 | + result.LoadDto(unitConversion, 0) |
91 | return result, nil | 100 | return result, nil |
92 | 101 | ||
93 | } | 102 | } |
@@ -236,11 +245,20 @@ func (unitConversionService *UnitConversionService) UpdateUnitConversion(cmd *co | @@ -236,11 +245,20 @@ func (unitConversionService *UnitConversionService) UpdateUnitConversion(cmd *co | ||
236 | if err != nil { | 245 | if err != nil { |
237 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 246 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
238 | } | 247 | } |
248 | + | ||
249 | + var userService = domainService.NewUserService() | ||
250 | + var org *domain.Org | ||
251 | + org, err = userService.Organization(unitConversion.OrgId) | ||
252 | + if err != nil { | ||
253 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
254 | + } | ||
255 | + | ||
239 | unitConversion.WorkStation = workStation | 256 | unitConversion.WorkStation = workStation |
240 | unitConversion.Material = cmd.Material | 257 | unitConversion.Material = cmd.Material |
241 | unitConversion.FromUnitQuantity = cmd.FromUnitQuantity | 258 | unitConversion.FromUnitQuantity = cmd.FromUnitQuantity |
242 | unitConversion.ToUnitQuantity = cmd.ToUnitQuantity | 259 | unitConversion.ToUnitQuantity = cmd.ToUnitQuantity |
243 | unitConversion.IntelligentWeighingFlag = cmd.IntelligentWeighingFlag | 260 | unitConversion.IntelligentWeighingFlag = cmd.IntelligentWeighingFlag |
261 | + unitConversion.Ext = domain.NewExt(org.OrgName) | ||
244 | 262 | ||
245 | if err := unitConversion.Update(utils.ObjectToMap(cmd)); err != nil { | 263 | if err := unitConversion.Update(utils.ObjectToMap(cmd)); err != nil { |
246 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 264 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
@@ -285,7 +303,7 @@ func (unitConversionService *UnitConversionService) SearchUnitConversion(operate | @@ -285,7 +303,7 @@ func (unitConversionService *UnitConversionService) SearchUnitConversion(operate | ||
285 | for i := range unitConversions { | 303 | for i := range unitConversions { |
286 | item := unitConversions[i] | 304 | item := unitConversions[i] |
287 | newItem := &dto.UnitConversionDto{} | 305 | newItem := &dto.UnitConversionDto{} |
288 | - newItem.LoadDto(item) | 306 | + newItem.LoadDto(item, operateInfo.OrgId) |
289 | result = append(result, newItem) | 307 | result = append(result, newItem) |
290 | } | 308 | } |
291 | return count, result, nil | 309 | return count, result, nil |
@@ -14,6 +14,8 @@ type WorkshopDto struct { | @@ -14,6 +14,8 @@ type WorkshopDto struct { | ||
14 | WorkshopId int `json:"workshopId,omitempty"` | 14 | WorkshopId int `json:"workshopId,omitempty"` |
15 | // 车间名称 | 15 | // 车间名称 |
16 | WorkshopName string `json:"workshopName,omitempty"` | 16 | WorkshopName string `json:"workshopName,omitempty"` |
17 | + // 负责人ID | ||
18 | + //PrincipalId int `cname:"负责人" json:"principalId" valid:"Required"` | ||
17 | // 负责人 (用户对象) | 19 | // 负责人 (用户对象) |
18 | Principal *domain.User `json:"principal,omitempty"` | 20 | Principal *domain.User `json:"principal,omitempty"` |
19 | // 生产线 | 21 | // 生产线 |
@@ -31,5 +33,6 @@ func (dto *WorkshopDto) LoadDto(m *domain.Workshop) *WorkshopDto { | @@ -31,5 +33,6 @@ func (dto *WorkshopDto) LoadDto(m *domain.Workshop) *WorkshopDto { | ||
31 | dto.WorkshopName = m.WorkshopName | 33 | dto.WorkshopName = m.WorkshopName |
32 | dto.Principal = m.Principal | 34 | dto.Principal = m.Principal |
33 | dto.ProductLines = m.GetProductLines(domain.NotDeleted) | 35 | dto.ProductLines = m.GetProductLines(domain.NotDeleted) |
36 | + //dto.PrincipalId = m.Principal.UserId | ||
34 | return dto | 37 | return dto |
35 | } | 38 | } |
@@ -104,7 +104,9 @@ func (workshopService *WorkshopService) GetWorkshop(getWorkshopQuery *query.GetW | @@ -104,7 +104,9 @@ func (workshopService *WorkshopService) GetWorkshop(getWorkshopQuery *query.GetW | ||
104 | if err := transactionContext.CommitTransaction(); err != nil { | 104 | if err := transactionContext.CommitTransaction(); err != nil { |
105 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 105 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
106 | } | 106 | } |
107 | - return workshop, nil | 107 | + result := &dto.WorkshopDto{} |
108 | + result.LoadDto(workshop) | ||
109 | + return result, nil | ||
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 | ||
@@ -232,7 +234,9 @@ func (workshopService *WorkshopService) UpdateWorkshop(updateWorkshopCommand *co | @@ -232,7 +234,9 @@ func (workshopService *WorkshopService) UpdateWorkshop(updateWorkshopCommand *co | ||
232 | if err := transactionContext.CommitTransaction(); err != nil { | 234 | if err := transactionContext.CommitTransaction(); err != nil { |
233 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 235 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
234 | } | 236 | } |
235 | - return workshop, nil | 237 | + result := &dto.WorkshopDto{} |
238 | + result.LoadDto(workshop) | ||
239 | + return result, nil | ||
236 | } | 240 | } |
237 | } | 241 | } |
238 | 242 |
@@ -61,6 +61,8 @@ type Device struct { | @@ -61,6 +61,8 @@ type Device struct { | ||
61 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 61 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
62 | // 所属位置 | 62 | // 所属位置 |
63 | WorkStation *WorkStation `json:"workStation,omitempty"` | 63 | WorkStation *WorkStation `json:"workStation,omitempty"` |
64 | + // 扩展数据 | ||
65 | + Ext *Ext `json:"ext,omitempty"` | ||
64 | } | 66 | } |
65 | 67 | ||
66 | type DeviceRepository interface { | 68 | type DeviceRepository interface { |
@@ -99,6 +101,12 @@ func (device *Device) Update(data map[string]interface{}) error { | @@ -99,6 +101,12 @@ func (device *Device) Update(data map[string]interface{}) error { | ||
99 | if riskLevel, ok := data["riskLevel"]; ok { | 101 | if riskLevel, ok := data["riskLevel"]; ok { |
100 | device.RiskLevel = riskLevel.(int) | 102 | device.RiskLevel = riskLevel.(int) |
101 | } | 103 | } |
104 | + if device.Ext == nil { | ||
105 | + device.Ext = &Ext{} | ||
106 | + } | ||
107 | + if orgName, ok := data["orgName"]; ok { | ||
108 | + device.Ext.OrgName = orgName.(string) | ||
109 | + } | ||
102 | device.UpdatedAt = time.Now() | 110 | device.UpdatedAt = time.Now() |
103 | return nil | 111 | return nil |
104 | } | 112 | } |
pkg/domain/ext.go
0 → 100644
@@ -7,3 +7,10 @@ type Org struct { | @@ -7,3 +7,10 @@ type Org struct { | ||
7 | // 组织名称 | 7 | // 组织名称 |
8 | OrgName string `json:"orgName,omitempty"` | 8 | OrgName string `json:"orgName,omitempty"` |
9 | } | 9 | } |
10 | + | ||
11 | +func CheckOrgAuth(currentOrg int, belongOrg int) bool { | ||
12 | + if currentOrg == belongOrg { | ||
13 | + return true | ||
14 | + } | ||
15 | + return false | ||
16 | +} |
@@ -28,6 +28,8 @@ type Product struct { | @@ -28,6 +28,8 @@ type Product struct { | ||
28 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 28 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
29 | // 删除时间 | 29 | // 删除时间 |
30 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 30 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
31 | + // 扩展数据 | ||
32 | + Ext *Ext `json:"ext,omitempty"` | ||
31 | } | 33 | } |
32 | 34 | ||
33 | type ProductRepository interface { | 35 | type ProductRepository interface { |
@@ -63,6 +65,12 @@ func (product *Product) Update(data map[string]interface{}) error { | @@ -63,6 +65,12 @@ func (product *Product) Update(data map[string]interface{}) error { | ||
63 | if unitWeight, ok := data["unitWeight"]; ok { | 65 | if unitWeight, ok := data["unitWeight"]; ok { |
64 | product.ProductSpec.UnitWeight = unitWeight.(float64) | 66 | product.ProductSpec.UnitWeight = unitWeight.(float64) |
65 | } | 67 | } |
68 | + if product.Ext == nil { | ||
69 | + product.Ext = &Ext{} | ||
70 | + } | ||
71 | + if orgName, ok := data["orgName"]; ok { | ||
72 | + product.Ext.OrgName = orgName.(string) | ||
73 | + } | ||
66 | product.UpdatedAt = time.Now() | 74 | product.UpdatedAt = time.Now() |
67 | return nil | 75 | return nil |
68 | } | 76 | } |
@@ -32,6 +32,8 @@ type ProductAttendanceRecord struct { | @@ -32,6 +32,8 @@ type ProductAttendanceRecord struct { | ||
32 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 32 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
33 | // 删除时间 | 33 | // 删除时间 |
34 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 34 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
35 | + // 扩展数据 | ||
36 | + Ext *Ext `json:"ext,omitempty"` | ||
35 | } | 37 | } |
36 | 38 | ||
37 | type ProductAttendanceRecordRepository interface { | 39 | type ProductAttendanceRecordRepository interface { |
@@ -33,6 +33,8 @@ type ProductCalendar struct { | @@ -33,6 +33,8 @@ type ProductCalendar struct { | ||
33 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 33 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
34 | // 删除时间 | 34 | // 删除时间 |
35 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 35 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
36 | + // 扩展数据 | ||
37 | + Ext *Ext `json:"ext,omitempty"` | ||
36 | } | 38 | } |
37 | 39 | ||
38 | type ProductCalendarRepository interface { | 40 | type ProductCalendarRepository interface { |
@@ -26,6 +26,8 @@ type ProductGroup struct { | @@ -26,6 +26,8 @@ type ProductGroup struct { | ||
26 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 26 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
27 | // 删除时间 | 27 | // 删除时间 |
28 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 28 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
29 | + // 扩展数据 | ||
30 | + Ext *Ext `json:"ext,omitempty"` | ||
29 | } | 31 | } |
30 | 32 | ||
31 | type ProductGroupRepository interface { | 33 | type ProductGroupRepository interface { |
@@ -24,6 +24,8 @@ type ProductJob struct { | @@ -24,6 +24,8 @@ type ProductJob struct { | ||
24 | WorkStation *WorkStation `json:"workStation,omitempty"` | 24 | WorkStation *WorkStation `json:"workStation,omitempty"` |
25 | // 关联设备列表 | 25 | // 关联设备列表 |
26 | RelatedDevices []int `json:"relatedDevices,omitempty"` | 26 | RelatedDevices []int `json:"relatedDevices,omitempty"` |
27 | + // 扩展数据 | ||
28 | + Ext *Ext `json:"ext,omitempty"` | ||
27 | } | 29 | } |
28 | 30 | ||
29 | type ProductJobRepository interface { | 31 | type ProductJobRepository interface { |
@@ -36,6 +36,8 @@ type ProductPlan struct { | @@ -36,6 +36,8 @@ type ProductPlan struct { | ||
36 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 36 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
37 | // 删除时间 | 37 | // 删除时间 |
38 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 38 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
39 | + // 扩展数据 | ||
40 | + Ext *Ext `json:"ext,omitempty"` | ||
39 | } | 41 | } |
40 | 42 | ||
41 | type ProductPlanRepository interface { | 43 | type ProductPlanRepository interface { |
@@ -24,6 +24,8 @@ type ProductRecord struct { | @@ -24,6 +24,8 @@ type ProductRecord struct { | ||
24 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 24 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
25 | // 生产记录信息 | 25 | // 生产记录信息 |
26 | ProductRecordInfo *ProductRecordInfo `json:"productRecordInfo,omitempty"` | 26 | ProductRecordInfo *ProductRecordInfo `json:"productRecordInfo,omitempty"` |
27 | + // 扩展数据 | ||
28 | + Ext *Ext `json:"ext,omitempty"` | ||
27 | } | 29 | } |
28 | 30 | ||
29 | type ProductRecordRepository interface { | 31 | type ProductRecordRepository interface { |
@@ -26,6 +26,8 @@ type UnitConversion struct { | @@ -26,6 +26,8 @@ type UnitConversion struct { | ||
26 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 26 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
27 | // 删除时间 | 27 | // 删除时间 |
28 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 28 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
29 | + // 扩展数据 | ||
30 | + Ext *Ext `json:"ext,omitempty"` | ||
29 | } | 31 | } |
30 | 32 | ||
31 | type UnitConversionRepository interface { | 33 | type UnitConversionRepository interface { |
@@ -32,6 +32,8 @@ type Workshop struct { | @@ -32,6 +32,8 @@ type Workshop struct { | ||
32 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 32 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
33 | // 删除时间 | 33 | // 删除时间 |
34 | DeletedAt time.Time `json:"deletedAt,omitempty"` | 34 | DeletedAt time.Time `json:"deletedAt,omitempty"` |
35 | + // 扩展数据 | ||
36 | + Ext *Ext `json:"ext,omitempty"` | ||
35 | } | 37 | } |
36 | 38 | ||
37 | type WorkshopRepository interface { | 39 | type WorkshopRepository interface { |
@@ -31,13 +31,13 @@ func (svr *UserService) Users(id []int) ([]*domain.User, error) { | @@ -31,13 +31,13 @@ func (svr *UserService) Users(id []int) ([]*domain.User, error) { | ||
31 | return result, nil | 31 | return result, nil |
32 | } | 32 | } |
33 | 33 | ||
34 | -//func(svr *UserService)Organization(id int)(*domain.Org,error){ | ||
35 | -// rsp,err:= svr.internalUserService.Organization(id) | ||
36 | -// if err!=nil{ | ||
37 | -// return nil, err | ||
38 | -// } | ||
39 | -// return svr.ToUser(rsp), nil | ||
40 | -//} | 34 | +func (svr *UserService) Organization(id int) (*domain.Org, error) { |
35 | + rsp, err := svr.internalUserService.Organization(id) | ||
36 | + if err != nil { | ||
37 | + return nil, err | ||
38 | + } | ||
39 | + return svr.ToOrg(rsp), nil | ||
40 | +} | ||
41 | 41 | ||
42 | func (svr *UserService) ToUser(from *models.User) *domain.User { | 42 | func (svr *UserService) ToUser(from *models.User) *domain.User { |
43 | return &domain.User{ | 43 | return &domain.User{ |
@@ -50,6 +50,13 @@ func (svr *UserService) ToUser(from *models.User) *domain.User { | @@ -50,6 +50,13 @@ func (svr *UserService) ToUser(from *models.User) *domain.User { | ||
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | +func (svr *UserService) ToOrg(from *models.Organization) *domain.Org { | ||
54 | + return &domain.Org{ | ||
55 | + OrgId: from.OrgId, | ||
56 | + OrgName: from.OrgName, | ||
57 | + } | ||
58 | +} | ||
59 | + | ||
53 | //func(svr *UserService) ToOrg(from *models.Organization)*domain.Org{ | 60 | //func(svr *UserService) ToOrg(from *models.Organization)*domain.Org{ |
54 | // | 61 | // |
55 | //} | 62 | //} |
@@ -17,6 +17,13 @@ type PGBatchAddDeviceService struct { | @@ -17,6 +17,13 @@ type PGBatchAddDeviceService struct { | ||
17 | func (ptr *PGBatchAddDeviceService) BatchAddDevice(opt *domain.OperateInfo, list []*domain.ImportDeviceItem) ([]interface{}, error) { | 17 | func (ptr *PGBatchAddDeviceService) BatchAddDevice(opt *domain.OperateInfo, list []*domain.ImportDeviceItem) ([]interface{}, error) { |
18 | var failRows = make([]interface{}, 0) | 18 | var failRows = make([]interface{}, 0) |
19 | 19 | ||
20 | + var userService = NewUserService() | ||
21 | + var org *domain.Org | ||
22 | + org, err := userService.Organization(opt.OrgId) | ||
23 | + if err != nil { | ||
24 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
25 | + } | ||
26 | + | ||
20 | deviceRepository, _ := repository.NewDeviceRepository(ptr.transactionContext) | 27 | deviceRepository, _ := repository.NewDeviceRepository(ptr.transactionContext) |
21 | _, devices, _ := deviceRepository.Find(map[string]interface{}{"companyId": opt.CompanyId, "orgId": opt.OrgId}) | 28 | _, devices, _ := deviceRepository.Find(map[string]interface{}{"companyId": opt.CompanyId, "orgId": opt.OrgId}) |
22 | var mapProduct = make(map[string]*domain.Device) | 29 | var mapProduct = make(map[string]*domain.Device) |
@@ -44,6 +51,7 @@ func (ptr *PGBatchAddDeviceService) BatchAddDevice(opt *domain.OperateInfo, list | @@ -44,6 +51,7 @@ func (ptr *PGBatchAddDeviceService) BatchAddDevice(opt *domain.OperateInfo, list | ||
44 | CreatedAt: time.Now(), | 51 | CreatedAt: time.Now(), |
45 | UpdatedAt: time.Now(), | 52 | UpdatedAt: time.Now(), |
46 | WorkStation: &domain.WorkStation{}, | 53 | WorkStation: &domain.WorkStation{}, |
54 | + Ext: domain.NewExt(org.OrgName), | ||
47 | } | 55 | } |
48 | if _, ok := mapProduct[newItem.DeviceCode]; !ok { | 56 | if _, ok := mapProduct[newItem.DeviceCode]; !ok { |
49 | mapProduct[newItem.DeviceCode] = newItem | 57 | mapProduct[newItem.DeviceCode] = newItem |
@@ -30,6 +30,13 @@ func (ptr *PGBatchAddProductService) BatchAddProduct(opt *domain.OperateInfo, li | @@ -30,6 +30,13 @@ func (ptr *PGBatchAddProductService) BatchAddProduct(opt *domain.OperateInfo, li | ||
30 | mapProduct[products[i].ProductCode] = products[i] | 30 | mapProduct[products[i].ProductCode] = products[i] |
31 | } | 31 | } |
32 | 32 | ||
33 | + var userService = NewUserService() | ||
34 | + var org *domain.Org | ||
35 | + org, err := userService.Organization(opt.OrgId) | ||
36 | + if err != nil { | ||
37 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
38 | + } | ||
39 | + | ||
33 | var generator = redis.NewProductCodeCache(opt.CompanyId) | 40 | var generator = redis.NewProductCodeCache(opt.CompanyId) |
34 | for i := range list { | 41 | for i := range list { |
35 | item := list[i] | 42 | item := list[i] |
@@ -51,6 +58,7 @@ func (ptr *PGBatchAddProductService) BatchAddProduct(opt *domain.OperateInfo, li | @@ -51,6 +58,7 @@ func (ptr *PGBatchAddProductService) BatchAddProduct(opt *domain.OperateInfo, li | ||
51 | }, | 58 | }, |
52 | CreatedAt: time.Now(), | 59 | CreatedAt: time.Now(), |
53 | UpdatedAt: time.Now(), | 60 | UpdatedAt: time.Now(), |
61 | + Ext: domain.NewExt(org.OrgName), | ||
54 | } | 62 | } |
55 | // 存在旧数据->>覆盖 | 63 | // 存在旧数据->>覆盖 |
56 | if replaceOld { | 64 | if replaceOld { |
@@ -35,4 +35,6 @@ type Device struct { | @@ -35,4 +35,6 @@ type Device struct { | ||
35 | UpdatedAt time.Time `comment:"更新时间"` | 35 | UpdatedAt time.Time `comment:"更新时间"` |
36 | // 删除时间 | 36 | // 删除时间 |
37 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 37 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
38 | + // 扩展数据 | ||
39 | + Ext *domain.Ext `comment:"扩展数据"` | ||
38 | } | 40 | } |
@@ -27,4 +27,6 @@ type Product struct { | @@ -27,4 +27,6 @@ type Product struct { | ||
27 | UpdatedAt time.Time `comment:"更新时间"` | 27 | UpdatedAt time.Time `comment:"更新时间"` |
28 | // 删除时间 | 28 | // 删除时间 |
29 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 29 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
30 | + // 扩展数据 | ||
31 | + Ext *domain.Ext `comment:"扩展数据"` | ||
30 | } | 32 | } |
@@ -37,4 +37,6 @@ type ProductAttendanceRecord struct { | @@ -37,4 +37,6 @@ type ProductAttendanceRecord struct { | ||
37 | UpdatedAt time.Time `comment:"更新时间"` | 37 | UpdatedAt time.Time `comment:"更新时间"` |
38 | // 删除时间 | 38 | // 删除时间 |
39 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 39 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
40 | + // 扩展数据 | ||
41 | + Ext *domain.Ext `comment:"扩展数据"` | ||
40 | } | 42 | } |
@@ -33,4 +33,6 @@ type ProductCalendar struct { | @@ -33,4 +33,6 @@ type ProductCalendar struct { | ||
33 | UpdatedAt time.Time `comment:"更新时间"` | 33 | UpdatedAt time.Time `comment:"更新时间"` |
34 | // 删除时间 | 34 | // 删除时间 |
35 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 35 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
36 | + // 扩展数据 | ||
37 | + Ext *domain.Ext `comment:"扩展数据"` | ||
36 | } | 38 | } |
@@ -29,4 +29,6 @@ type ProductGroup struct { | @@ -29,4 +29,6 @@ type ProductGroup struct { | ||
29 | UpdatedAt time.Time `comment:"更新时间"` | 29 | UpdatedAt time.Time `comment:"更新时间"` |
30 | // 删除时间 | 30 | // 删除时间 |
31 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 31 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
32 | + // 扩展数据 | ||
33 | + Ext *domain.Ext `comment:"扩展数据"` | ||
32 | } | 34 | } |
@@ -27,4 +27,6 @@ type ProductJob struct { | @@ -27,4 +27,6 @@ type ProductJob struct { | ||
27 | RelatedDevices []int ` comment:"关联设备列表"` | 27 | RelatedDevices []int ` comment:"关联设备列表"` |
28 | // 工序名称 | 28 | // 工序名称 |
29 | ProcessName string ` comment:"工序名称"` | 29 | ProcessName string ` comment:"工序名称"` |
30 | + // 扩展数据 | ||
31 | + Ext *domain.Ext `comment:"扩展数据"` | ||
30 | } | 32 | } |
@@ -39,4 +39,6 @@ type ProductPlan struct { | @@ -39,4 +39,6 @@ type ProductPlan struct { | ||
39 | UpdatedAt time.Time `comment:"更新时间"` | 39 | UpdatedAt time.Time `comment:"更新时间"` |
40 | // 删除时间 | 40 | // 删除时间 |
41 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 41 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
42 | + // 扩展数据 | ||
43 | + Ext *domain.Ext `comment:"扩展数据"` | ||
42 | } | 44 | } |
@@ -27,4 +27,6 @@ type ProductRecord struct { | @@ -27,4 +27,6 @@ type ProductRecord struct { | ||
27 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 27 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
28 | // 生产记录信息 | 28 | // 生产记录信息 |
29 | ProductRecordInfo *domain.ProductRecordInfo `comment:"生产记录信息"` | 29 | ProductRecordInfo *domain.ProductRecordInfo `comment:"生产记录信息"` |
30 | + // 扩展数据 | ||
31 | + Ext *domain.Ext `comment:"扩展数据"` | ||
30 | } | 32 | } |
@@ -29,4 +29,6 @@ type UnitConversion struct { | @@ -29,4 +29,6 @@ type UnitConversion struct { | ||
29 | UpdatedAt time.Time `comment:"更新时间"` | 29 | UpdatedAt time.Time `comment:"更新时间"` |
30 | // 删除时间 | 30 | // 删除时间 |
31 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 31 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
32 | + // 扩展数据 | ||
33 | + Ext *domain.Ext `comment:"扩展数据"` | ||
32 | } | 34 | } |
@@ -25,4 +25,6 @@ type Workshop struct { | @@ -25,4 +25,6 @@ type Workshop struct { | ||
25 | UpdatedAt time.Time `comment:"更新时间"` | 25 | UpdatedAt time.Time `comment:"更新时间"` |
26 | // 删除时间 | 26 | // 删除时间 |
27 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` | 27 | DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"` |
28 | + // 扩展数据 | ||
29 | + Ext *domain.Ext `comment:"扩展数据"` | ||
28 | } | 30 | } |
@@ -21,5 +21,6 @@ func TransformToDeviceDomainModelFromPgModels(deviceModel *models.Device) (*doma | @@ -21,5 +21,6 @@ func TransformToDeviceDomainModelFromPgModels(deviceModel *models.Device) (*doma | ||
21 | UpdatedAt: deviceModel.UpdatedAt, | 21 | UpdatedAt: deviceModel.UpdatedAt, |
22 | DeletedAt: deviceModel.DeletedAt, | 22 | DeletedAt: deviceModel.DeletedAt, |
23 | WorkStation: deviceModel.WorkStation, | 23 | WorkStation: deviceModel.WorkStation, |
24 | + Ext: deviceModel.Ext, | ||
24 | }, nil | 25 | }, nil |
25 | } | 26 | } |
@@ -17,5 +17,6 @@ func TransformToProductDomainModelFromPgModels(productModel *models.Product) (*d | @@ -17,5 +17,6 @@ func TransformToProductDomainModelFromPgModels(productModel *models.Product) (*d | ||
17 | CreatedAt: productModel.CreatedAt, | 17 | CreatedAt: productModel.CreatedAt, |
18 | UpdatedAt: productModel.UpdatedAt, | 18 | UpdatedAt: productModel.UpdatedAt, |
19 | DeletedAt: productModel.DeletedAt, | 19 | DeletedAt: productModel.DeletedAt, |
20 | + Ext: productModel.Ext, | ||
20 | }, nil | 21 | }, nil |
21 | } | 22 | } |
@@ -21,5 +21,6 @@ func TransformToProductAttendanceRecordDomainModelFromPgModels(productAttendance | @@ -21,5 +21,6 @@ func TransformToProductAttendanceRecordDomainModelFromPgModels(productAttendance | ||
21 | CreatedAt: productAttendanceRecordModel.CreatedAt, | 21 | CreatedAt: productAttendanceRecordModel.CreatedAt, |
22 | UpdatedAt: productAttendanceRecordModel.UpdatedAt, | 22 | UpdatedAt: productAttendanceRecordModel.UpdatedAt, |
23 | DeletedAt: productAttendanceRecordModel.DeletedAt, | 23 | DeletedAt: productAttendanceRecordModel.DeletedAt, |
24 | + Ext: productAttendanceRecordModel.Ext, | ||
24 | }, nil | 25 | }, nil |
25 | } | 26 | } |
@@ -20,5 +20,6 @@ func TransformToProductCalendarDomainModelFromPgModels(productCalendarModel *mod | @@ -20,5 +20,6 @@ func TransformToProductCalendarDomainModelFromPgModels(productCalendarModel *mod | ||
20 | CreatedAt: productCalendarModel.CreatedAt, | 20 | CreatedAt: productCalendarModel.CreatedAt, |
21 | UpdatedAt: productCalendarModel.UpdatedAt, | 21 | UpdatedAt: productCalendarModel.UpdatedAt, |
22 | DeletedAt: productCalendarModel.DeletedAt, | 22 | DeletedAt: productCalendarModel.DeletedAt, |
23 | + Ext: productCalendarModel.Ext, | ||
23 | }, nil | 24 | }, nil |
24 | } | 25 | } |
@@ -18,5 +18,6 @@ func TransformToProductGroupDomainModelFromPgModels(productGroupModel *models.Pr | @@ -18,5 +18,6 @@ func TransformToProductGroupDomainModelFromPgModels(productGroupModel *models.Pr | ||
18 | CreatedAt: productGroupModel.CreatedAt, | 18 | CreatedAt: productGroupModel.CreatedAt, |
19 | UpdatedAt: productGroupModel.UpdatedAt, | 19 | UpdatedAt: productGroupModel.UpdatedAt, |
20 | DeletedAt: productGroupModel.DeletedAt, | 20 | DeletedAt: productGroupModel.DeletedAt, |
21 | + Ext: productGroupModel.Ext, | ||
21 | }, nil | 22 | }, nil |
22 | } | 23 | } |
@@ -17,5 +17,6 @@ func TransformToProductJobDomainModelFromPgModels(productJobModel *models.Produc | @@ -17,5 +17,6 @@ func TransformToProductJobDomainModelFromPgModels(productJobModel *models.Produc | ||
17 | WorkStation: productJobModel.WorkStation, | 17 | WorkStation: productJobModel.WorkStation, |
18 | RelatedDevices: productJobModel.RelatedDevices, | 18 | RelatedDevices: productJobModel.RelatedDevices, |
19 | ProcessName: productJobModel.ProcessName, | 19 | ProcessName: productJobModel.ProcessName, |
20 | + Ext: productJobModel.Ext, | ||
20 | }, nil | 21 | }, nil |
21 | } | 22 | } |
@@ -23,5 +23,6 @@ func TransformToProductPlanDomainModelFromPgModels(productPlanModel *models.Prod | @@ -23,5 +23,6 @@ func TransformToProductPlanDomainModelFromPgModels(productPlanModel *models.Prod | ||
23 | CreatedAt: productPlanModel.CreatedAt, | 23 | CreatedAt: productPlanModel.CreatedAt, |
24 | UpdatedAt: productPlanModel.UpdatedAt, | 24 | UpdatedAt: productPlanModel.UpdatedAt, |
25 | DeletedAt: productPlanModel.DeletedAt, | 25 | DeletedAt: productPlanModel.DeletedAt, |
26 | + Ext: productPlanModel.Ext, | ||
26 | }, nil | 27 | }, nil |
27 | } | 28 | } |
@@ -17,5 +17,6 @@ func TransformToProductRecordDomainModelFromPgModels(productRecordModel *models. | @@ -17,5 +17,6 @@ func TransformToProductRecordDomainModelFromPgModels(productRecordModel *models. | ||
17 | UpdatedAt: productRecordModel.UpdatedAt, | 17 | UpdatedAt: productRecordModel.UpdatedAt, |
18 | DeletedAt: productRecordModel.DeletedAt, | 18 | DeletedAt: productRecordModel.DeletedAt, |
19 | ProductRecordInfo: productRecordModel.ProductRecordInfo, | 19 | ProductRecordInfo: productRecordModel.ProductRecordInfo, |
20 | + Ext: productRecordModel.Ext, | ||
20 | }, nil | 21 | }, nil |
21 | } | 22 | } |
@@ -18,5 +18,6 @@ func TransformToUnitConversionDomainModelFromPgModels(unitConversionModel *model | @@ -18,5 +18,6 @@ func TransformToUnitConversionDomainModelFromPgModels(unitConversionModel *model | ||
18 | CreatedAt: unitConversionModel.CreatedAt, | 18 | CreatedAt: unitConversionModel.CreatedAt, |
19 | UpdatedAt: unitConversionModel.UpdatedAt, | 19 | UpdatedAt: unitConversionModel.UpdatedAt, |
20 | DeletedAt: unitConversionModel.DeletedAt, | 20 | DeletedAt: unitConversionModel.DeletedAt, |
21 | + Ext: unitConversionModel.Ext, | ||
21 | }, nil | 22 | }, nil |
22 | } | 23 | } |
@@ -16,5 +16,6 @@ func TransformToWorkshopDomainModelFromPgModels(workshopModel *models.Workshop) | @@ -16,5 +16,6 @@ func TransformToWorkshopDomainModelFromPgModels(workshopModel *models.Workshop) | ||
16 | CreatedAt: workshopModel.CreatedAt, | 16 | CreatedAt: workshopModel.CreatedAt, |
17 | UpdatedAt: workshopModel.UpdatedAt, | 17 | UpdatedAt: workshopModel.UpdatedAt, |
18 | DeletedAt: workshopModel.DeletedAt, | 18 | DeletedAt: workshopModel.DeletedAt, |
19 | + Ext: workshopModel.Ext, | ||
19 | }, nil | 20 | }, nil |
20 | } | 21 | } |
@@ -40,6 +40,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | @@ -40,6 +40,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | ||
40 | "updated_at", | 40 | "updated_at", |
41 | "deleted_at", | 41 | "deleted_at", |
42 | "work_station", | 42 | "work_station", |
43 | + "ext", | ||
43 | } | 44 | } |
44 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "device_id", "deleted_at")) | 45 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "device_id", "deleted_at")) |
45 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "device_id", "deleted_at")) | 46 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "device_id", "deleted_at")) |
@@ -64,6 +65,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | @@ -64,6 +65,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | ||
64 | &device.UpdatedAt, | 65 | &device.UpdatedAt, |
65 | &device.DeletedAt, | 66 | &device.DeletedAt, |
66 | &device.WorkStation, | 67 | &device.WorkStation, |
68 | + &device.Ext, | ||
67 | ), | 69 | ), |
68 | fmt.Sprintf("INSERT INTO manufacture.device (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 70 | fmt.Sprintf("INSERT INTO manufacture.device (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
69 | //device.DeviceId, | 71 | //device.DeviceId, |
@@ -80,6 +82,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | @@ -80,6 +82,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | ||
80 | device.UpdatedAt, | 82 | device.UpdatedAt, |
81 | //device.DeletedAt, | 83 | //device.DeletedAt, |
82 | device.WorkStation, | 84 | device.WorkStation, |
85 | + device.Ext, | ||
83 | ); err != nil { | 86 | ); err != nil { |
84 | return device, err | 87 | return device, err |
85 | } | 88 | } |
@@ -100,6 +103,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | @@ -100,6 +103,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | ||
100 | &device.UpdatedAt, | 103 | &device.UpdatedAt, |
101 | &device.DeletedAt, | 104 | &device.DeletedAt, |
102 | &device.WorkStation, | 105 | &device.WorkStation, |
106 | + &device.Ext, | ||
103 | ), | 107 | ), |
104 | fmt.Sprintf("UPDATE manufacture.device SET %s WHERE device_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 108 | fmt.Sprintf("UPDATE manufacture.device SET %s WHERE device_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
105 | device.CompanyId, | 109 | device.CompanyId, |
@@ -114,6 +118,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | @@ -114,6 +118,7 @@ func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, | ||
114 | device.CreatedAt, | 118 | device.CreatedAt, |
115 | device.UpdatedAt, | 119 | device.UpdatedAt, |
116 | device.WorkStation, | 120 | device.WorkStation, |
121 | + device.Ext, | ||
117 | device.Identify(), | 122 | device.Identify(), |
118 | ); err != nil { | 123 | ); err != nil { |
119 | return device, err | 124 | return device, err |
@@ -40,6 +40,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | @@ -40,6 +40,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | ||
40 | "created_at", | 40 | "created_at", |
41 | "updated_at", | 41 | "updated_at", |
42 | "deleted_at", | 42 | "deleted_at", |
43 | + "ext", | ||
43 | } | 44 | } |
44 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 45 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
45 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 46 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
@@ -70,6 +71,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | @@ -70,6 +71,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | ||
70 | &productAttendanceRecord.CreatedAt, | 71 | &productAttendanceRecord.CreatedAt, |
71 | &productAttendanceRecord.UpdatedAt, | 72 | &productAttendanceRecord.UpdatedAt, |
72 | &productAttendanceRecord.DeletedAt, | 73 | &productAttendanceRecord.DeletedAt, |
74 | + &productAttendanceRecord.Ext, | ||
73 | ), | 75 | ), |
74 | fmt.Sprintf("INSERT INTO product_attendance_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 76 | fmt.Sprintf("INSERT INTO product_attendance_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
75 | productAttendanceRecord.ProductAttendanceId, | 77 | productAttendanceRecord.ProductAttendanceId, |
@@ -86,6 +88,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | @@ -86,6 +88,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | ||
86 | productAttendanceRecord.CreatedAt, | 88 | productAttendanceRecord.CreatedAt, |
87 | productAttendanceRecord.UpdatedAt, | 89 | productAttendanceRecord.UpdatedAt, |
88 | productAttendanceRecord.DeletedAt, | 90 | productAttendanceRecord.DeletedAt, |
91 | + productAttendanceRecord.Ext, | ||
89 | ); err != nil { | 92 | ); err != nil { |
90 | return productAttendanceRecord, err | 93 | return productAttendanceRecord, err |
91 | } | 94 | } |
@@ -106,6 +109,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | @@ -106,6 +109,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | ||
106 | &productAttendanceRecord.CreatedAt, | 109 | &productAttendanceRecord.CreatedAt, |
107 | &productAttendanceRecord.UpdatedAt, | 110 | &productAttendanceRecord.UpdatedAt, |
108 | &productAttendanceRecord.DeletedAt, | 111 | &productAttendanceRecord.DeletedAt, |
112 | + &productAttendanceRecord.Ext, | ||
109 | ), | 113 | ), |
110 | fmt.Sprintf("UPDATE product_attendance_records SET %s WHERE product_attendance_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 114 | fmt.Sprintf("UPDATE product_attendance_records SET %s WHERE product_attendance_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
111 | productAttendanceRecord.ProductAttendanceId, | 115 | productAttendanceRecord.ProductAttendanceId, |
@@ -122,6 +126,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | @@ -122,6 +126,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor | ||
122 | productAttendanceRecord.CreatedAt, | 126 | productAttendanceRecord.CreatedAt, |
123 | productAttendanceRecord.UpdatedAt, | 127 | productAttendanceRecord.UpdatedAt, |
124 | productAttendanceRecord.DeletedAt, | 128 | productAttendanceRecord.DeletedAt, |
129 | + productAttendanceRecord.Ext, | ||
125 | productAttendanceRecord.Identify(), | 130 | productAttendanceRecord.Identify(), |
126 | ); err != nil { | 131 | ); err != nil { |
127 | return productAttendanceRecord, err | 132 | return productAttendanceRecord, err |
@@ -39,6 +39,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | @@ -39,6 +39,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | ||
39 | "created_at", | 39 | "created_at", |
40 | "updated_at", | 40 | "updated_at", |
41 | "deleted_at", | 41 | "deleted_at", |
42 | + "ext", | ||
42 | } | 43 | } |
43 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_calendar_id", "deleted_at")) | 44 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_calendar_id", "deleted_at")) |
44 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_calendar_id", "deleted_at")) | 45 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_calendar_id", "deleted_at")) |
@@ -62,6 +63,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | @@ -62,6 +63,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | ||
62 | &productCalendar.CreatedAt, | 63 | &productCalendar.CreatedAt, |
63 | &productCalendar.UpdatedAt, | 64 | &productCalendar.UpdatedAt, |
64 | &productCalendar.DeletedAt, | 65 | &productCalendar.DeletedAt, |
66 | + &productCalendar.Ext, | ||
65 | ), | 67 | ), |
66 | fmt.Sprintf("INSERT INTO manufacture.product_calendar (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 68 | fmt.Sprintf("INSERT INTO manufacture.product_calendar (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
67 | productCalendar.CompanyId, | 69 | productCalendar.CompanyId, |
@@ -75,6 +77,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | @@ -75,6 +77,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | ||
75 | productCalendar.WorkTime, | 77 | productCalendar.WorkTime, |
76 | productCalendar.CreatedAt, | 78 | productCalendar.CreatedAt, |
77 | productCalendar.UpdatedAt, | 79 | productCalendar.UpdatedAt, |
80 | + productCalendar.Ext, | ||
78 | ); err != nil { | 81 | ); err != nil { |
79 | return productCalendar, err | 82 | return productCalendar, err |
80 | } | 83 | } |
@@ -94,6 +97,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | @@ -94,6 +97,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | ||
94 | &productCalendar.CreatedAt, | 97 | &productCalendar.CreatedAt, |
95 | &productCalendar.UpdatedAt, | 98 | &productCalendar.UpdatedAt, |
96 | &productCalendar.DeletedAt, | 99 | &productCalendar.DeletedAt, |
100 | + &productCalendar.Ext, | ||
97 | ), | 101 | ), |
98 | fmt.Sprintf("UPDATE manufacture.product_calendar SET %s WHERE product_calendar_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 102 | fmt.Sprintf("UPDATE manufacture.product_calendar SET %s WHERE product_calendar_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
99 | productCalendar.CompanyId, | 103 | productCalendar.CompanyId, |
@@ -107,6 +111,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | @@ -107,6 +111,7 @@ func (repository *ProductCalendarRepository) Save(productCalendar *domain.Produc | ||
107 | productCalendar.WorkTime, | 111 | productCalendar.WorkTime, |
108 | productCalendar.CreatedAt, | 112 | productCalendar.CreatedAt, |
109 | productCalendar.UpdatedAt, | 113 | productCalendar.UpdatedAt, |
114 | + productCalendar.Ext, | ||
110 | productCalendar.Identify(), | 115 | productCalendar.Identify(), |
111 | ); err != nil { | 116 | ); err != nil { |
112 | return productCalendar, err | 117 | return productCalendar, err |
@@ -37,6 +37,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | @@ -37,6 +37,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | ||
37 | "created_at", | 37 | "created_at", |
38 | "updated_at", | 38 | "updated_at", |
39 | "deleted_at", | 39 | "deleted_at", |
40 | + "ext", | ||
40 | } | 41 | } |
41 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_group_id", "deleted_at")) | 42 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_group_id", "deleted_at")) |
42 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_group_id", "deleted_at")) | 43 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_group_id", "deleted_at")) |
@@ -58,6 +59,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | @@ -58,6 +59,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | ||
58 | &productGroup.CreatedAt, | 59 | &productGroup.CreatedAt, |
59 | &productGroup.UpdatedAt, | 60 | &productGroup.UpdatedAt, |
60 | &productGroup.DeletedAt, | 61 | &productGroup.DeletedAt, |
62 | + &productGroup.Ext, | ||
61 | ), | 63 | ), |
62 | fmt.Sprintf("INSERT INTO manufacture.product_group (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 64 | fmt.Sprintf("INSERT INTO manufacture.product_group (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
63 | productGroup.CompanyId, | 65 | productGroup.CompanyId, |
@@ -69,6 +71,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | @@ -69,6 +71,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | ||
69 | productGroup.WorkStation, | 71 | productGroup.WorkStation, |
70 | productGroup.CreatedAt, | 72 | productGroup.CreatedAt, |
71 | productGroup.UpdatedAt, | 73 | productGroup.UpdatedAt, |
74 | + productGroup.Ext, | ||
72 | ); err != nil { | 75 | ); err != nil { |
73 | return productGroup, err | 76 | return productGroup, err |
74 | } | 77 | } |
@@ -86,6 +89,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | @@ -86,6 +89,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | ||
86 | &productGroup.CreatedAt, | 89 | &productGroup.CreatedAt, |
87 | &productGroup.UpdatedAt, | 90 | &productGroup.UpdatedAt, |
88 | &productGroup.DeletedAt, | 91 | &productGroup.DeletedAt, |
92 | + &productGroup.Ext, | ||
89 | ), | 93 | ), |
90 | fmt.Sprintf("UPDATE manufacture.product_group SET %s WHERE product_group_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 94 | fmt.Sprintf("UPDATE manufacture.product_group SET %s WHERE product_group_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
91 | productGroup.CompanyId, | 95 | productGroup.CompanyId, |
@@ -97,6 +101,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | @@ -97,6 +101,7 @@ func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup | ||
97 | productGroup.WorkStation, | 101 | productGroup.WorkStation, |
98 | productGroup.CreatedAt, | 102 | productGroup.CreatedAt, |
99 | productGroup.UpdatedAt, | 103 | productGroup.UpdatedAt, |
104 | + productGroup.Ext, | ||
100 | productGroup.Identify(), | 105 | productGroup.Identify(), |
101 | ); err != nil { | 106 | ); err != nil { |
102 | return productGroup, err | 107 | return productGroup, err |
@@ -36,6 +36,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | @@ -36,6 +36,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | ||
36 | "work_station", | 36 | "work_station", |
37 | "related_devices", | 37 | "related_devices", |
38 | "process_name", | 38 | "process_name", |
39 | + "ext", | ||
39 | } | 40 | } |
40 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_job_id", "deleted_at")) | 41 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_job_id", "deleted_at")) |
41 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_job_id", "deleted_at")) | 42 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_job_id", "deleted_at")) |
@@ -56,6 +57,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | @@ -56,6 +57,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | ||
56 | &productJob.WorkStation, | 57 | &productJob.WorkStation, |
57 | &productJob.RelatedDevices, | 58 | &productJob.RelatedDevices, |
58 | &productJob.ProcessName, | 59 | &productJob.ProcessName, |
60 | + &productJob.Ext, | ||
59 | ), | 61 | ), |
60 | fmt.Sprintf("INSERT INTO manufacture.product_job (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 62 | fmt.Sprintf("INSERT INTO manufacture.product_job (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
61 | productJob.CompanyId, | 63 | productJob.CompanyId, |
@@ -66,6 +68,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | @@ -66,6 +68,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | ||
66 | productJob.WorkStation, | 68 | productJob.WorkStation, |
67 | productJob.RelatedDevices, | 69 | productJob.RelatedDevices, |
68 | productJob.ProcessName, | 70 | productJob.ProcessName, |
71 | + productJob.Ext, | ||
69 | ); err != nil { | 72 | ); err != nil { |
70 | return productJob, err | 73 | return productJob, err |
71 | } | 74 | } |
@@ -82,6 +85,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | @@ -82,6 +85,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | ||
82 | &productJob.WorkStation, | 85 | &productJob.WorkStation, |
83 | &productJob.RelatedDevices, | 86 | &productJob.RelatedDevices, |
84 | &productJob.ProcessName, | 87 | &productJob.ProcessName, |
88 | + &productJob.Ext, | ||
85 | ), | 89 | ), |
86 | fmt.Sprintf("UPDATE manufacture.product_job SET %s WHERE product_job_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 90 | fmt.Sprintf("UPDATE manufacture.product_job SET %s WHERE product_job_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
87 | productJob.CompanyId, | 91 | productJob.CompanyId, |
@@ -92,6 +96,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | @@ -92,6 +96,7 @@ func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*do | ||
92 | productJob.WorkStation, | 96 | productJob.WorkStation, |
93 | productJob.RelatedDevices, | 97 | productJob.RelatedDevices, |
94 | productJob.ProcessName, | 98 | productJob.ProcessName, |
99 | + productJob.Ext, | ||
95 | productJob.Identify(), | 100 | productJob.Identify(), |
96 | ); err != nil { | 101 | ); err != nil { |
97 | return productJob, err | 102 | return productJob, err |
@@ -140,6 +145,10 @@ func (repository *ProductJobRepository) Find(queryOptions map[string]interface{} | @@ -140,6 +145,10 @@ func (repository *ProductJobRepository) Find(queryOptions map[string]interface{} | ||
140 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 145 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
141 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 146 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
142 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") | 147 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") |
148 | + | ||
149 | + query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") | ||
150 | + query.SetWhereByQueryOption("work_station->>'lineId'='?'", "lineId") | ||
151 | + query.SetWhereByQueryOption("work_station->>'sectionId'='?'", "sectionId") | ||
143 | if v, ok := queryOptions["jobName"]; ok && len(v.(string)) > 0 { | 152 | if v, ok := queryOptions["jobName"]; ok && len(v.(string)) > 0 { |
144 | query.Where(fmt.Sprintf(`job_name like '%%%v%%'`, v)) | 153 | query.Where(fmt.Sprintf(`job_name like '%%%v%%'`, v)) |
145 | } | 154 | } |
@@ -42,6 +42,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | @@ -42,6 +42,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | ||
42 | "created_at", | 42 | "created_at", |
43 | "updated_at", | 43 | "updated_at", |
44 | "deleted_at", | 44 | "deleted_at", |
45 | + "ext", | ||
45 | } | 46 | } |
46 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 47 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
47 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 48 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
@@ -74,6 +75,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | @@ -74,6 +75,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | ||
74 | &productPlan.CreatedAt, | 75 | &productPlan.CreatedAt, |
75 | &productPlan.UpdatedAt, | 76 | &productPlan.UpdatedAt, |
76 | &productPlan.DeletedAt, | 77 | &productPlan.DeletedAt, |
78 | + &productPlan.Ext, | ||
77 | ), | 79 | ), |
78 | fmt.Sprintf("INSERT INTO product_plans (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 80 | fmt.Sprintf("INSERT INTO product_plans (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
79 | productPlan.ProductPlanId, | 81 | productPlan.ProductPlanId, |
@@ -92,6 +94,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | @@ -92,6 +94,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | ||
92 | productPlan.CreatedAt, | 94 | productPlan.CreatedAt, |
93 | productPlan.UpdatedAt, | 95 | productPlan.UpdatedAt, |
94 | productPlan.DeletedAt, | 96 | productPlan.DeletedAt, |
97 | + productPlan.Ext, | ||
95 | ); err != nil { | 98 | ); err != nil { |
96 | return productPlan, err | 99 | return productPlan, err |
97 | } | 100 | } |
@@ -114,6 +117,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | @@ -114,6 +117,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | ||
114 | &productPlan.CreatedAt, | 117 | &productPlan.CreatedAt, |
115 | &productPlan.UpdatedAt, | 118 | &productPlan.UpdatedAt, |
116 | &productPlan.DeletedAt, | 119 | &productPlan.DeletedAt, |
120 | + &productPlan.Ext, | ||
117 | ), | 121 | ), |
118 | fmt.Sprintf("UPDATE product_plans SET %s WHERE product_plan_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 122 | fmt.Sprintf("UPDATE product_plans SET %s WHERE product_plan_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
119 | productPlan.ProductPlanId, | 123 | productPlan.ProductPlanId, |
@@ -132,6 +136,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | @@ -132,6 +136,7 @@ func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) ( | ||
132 | productPlan.CreatedAt, | 136 | productPlan.CreatedAt, |
133 | productPlan.UpdatedAt, | 137 | productPlan.UpdatedAt, |
134 | productPlan.DeletedAt, | 138 | productPlan.DeletedAt, |
139 | + productPlan.Ext, | ||
135 | productPlan.Identify(), | 140 | productPlan.Identify(), |
136 | ); err != nil { | 141 | ); err != nil { |
137 | return productPlan, err | 142 | return productPlan, err |
@@ -36,6 +36,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -36,6 +36,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
36 | "updated_at", | 36 | "updated_at", |
37 | "deleted_at", | 37 | "deleted_at", |
38 | "product_record_info", | 38 | "product_record_info", |
39 | + "ext", | ||
39 | } | 40 | } |
40 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 41 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
41 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 42 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
@@ -62,6 +63,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -62,6 +63,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
62 | &productRecord.UpdatedAt, | 63 | &productRecord.UpdatedAt, |
63 | &productRecord.DeletedAt, | 64 | &productRecord.DeletedAt, |
64 | &productRecord.ProductRecordInfo, | 65 | &productRecord.ProductRecordInfo, |
66 | + &productRecord.Ext, | ||
65 | ), | 67 | ), |
66 | fmt.Sprintf("INSERT INTO product_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 68 | fmt.Sprintf("INSERT INTO product_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
67 | productRecord.ProductRecordId, | 69 | productRecord.ProductRecordId, |
@@ -74,6 +76,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -74,6 +76,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
74 | productRecord.UpdatedAt, | 76 | productRecord.UpdatedAt, |
75 | productRecord.DeletedAt, | 77 | productRecord.DeletedAt, |
76 | productRecord.ProductRecordInfo, | 78 | productRecord.ProductRecordInfo, |
79 | + productRecord.Ext, | ||
77 | ); err != nil { | 80 | ); err != nil { |
78 | return productRecord, err | 81 | return productRecord, err |
79 | } | 82 | } |
@@ -90,6 +93,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -90,6 +93,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
90 | &productRecord.UpdatedAt, | 93 | &productRecord.UpdatedAt, |
91 | &productRecord.DeletedAt, | 94 | &productRecord.DeletedAt, |
92 | &productRecord.ProductRecordInfo, | 95 | &productRecord.ProductRecordInfo, |
96 | + &productRecord.Ext, | ||
93 | ), | 97 | ), |
94 | fmt.Sprintf("UPDATE product_records SET %s WHERE product_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 98 | fmt.Sprintf("UPDATE product_records SET %s WHERE product_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
95 | productRecord.ProductRecordId, | 99 | productRecord.ProductRecordId, |
@@ -102,6 +106,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | @@ -102,6 +106,7 @@ func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRec | ||
102 | productRecord.UpdatedAt, | 106 | productRecord.UpdatedAt, |
103 | productRecord.DeletedAt, | 107 | productRecord.DeletedAt, |
104 | productRecord.ProductRecordInfo, | 108 | productRecord.ProductRecordInfo, |
109 | + productRecord.Ext, | ||
105 | productRecord.Identify(), | 110 | productRecord.Identify(), |
106 | ); err != nil { | 111 | ); err != nil { |
107 | return productRecord, err | 112 | return productRecord, err |
@@ -36,6 +36,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | @@ -36,6 +36,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | ||
36 | "created_at", | 36 | "created_at", |
37 | "updated_at", | 37 | "updated_at", |
38 | "deleted_at", | 38 | "deleted_at", |
39 | + "ext", | ||
39 | } | 40 | } |
40 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_id", "deleted_at")) | 41 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_id", "deleted_at")) |
41 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_id", "deleted_at")) | 42 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_id", "deleted_at")) |
@@ -56,6 +57,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | @@ -56,6 +57,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | ||
56 | &product.CreatedAt, | 57 | &product.CreatedAt, |
57 | &product.UpdatedAt, | 58 | &product.UpdatedAt, |
58 | &product.DeletedAt, | 59 | &product.DeletedAt, |
60 | + &product.Ext, | ||
59 | ), | 61 | ), |
60 | fmt.Sprintf("INSERT INTO manufacture.product (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 62 | fmt.Sprintf("INSERT INTO manufacture.product (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
61 | product.CompanyId, | 63 | product.CompanyId, |
@@ -67,6 +69,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | @@ -67,6 +69,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | ||
67 | product.ProductSpec, | 69 | product.ProductSpec, |
68 | product.CreatedAt, | 70 | product.CreatedAt, |
69 | product.UpdatedAt, | 71 | product.UpdatedAt, |
72 | + &product.Ext, | ||
70 | //product.DeletedAt, | 73 | //product.DeletedAt, |
71 | ); err != nil { | 74 | ); err != nil { |
72 | return product, err | 75 | return product, err |
@@ -84,6 +87,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | @@ -84,6 +87,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | ||
84 | &product.CreatedAt, | 87 | &product.CreatedAt, |
85 | &product.UpdatedAt, | 88 | &product.UpdatedAt, |
86 | &product.DeletedAt, | 89 | &product.DeletedAt, |
90 | + &product.Ext, | ||
87 | ), | 91 | ), |
88 | fmt.Sprintf("UPDATE manufacture.product SET %s WHERE product_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 92 | fmt.Sprintf("UPDATE manufacture.product SET %s WHERE product_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
89 | product.CompanyId, | 93 | product.CompanyId, |
@@ -96,6 +100,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | @@ -96,6 +100,7 @@ func (repository *ProductRepository) Save(product *domain.Product) (*domain.Prod | ||
96 | product.CreatedAt, | 100 | product.CreatedAt, |
97 | product.UpdatedAt, | 101 | product.UpdatedAt, |
98 | //product.DeletedAt, | 102 | //product.DeletedAt, |
103 | + product.Ext, | ||
99 | product.Identify(), | 104 | product.Identify(), |
100 | ); err != nil { | 105 | ); err != nil { |
101 | return product, err | 106 | return product, err |
@@ -37,6 +37,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | @@ -37,6 +37,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | ||
37 | "created_at", | 37 | "created_at", |
38 | "updated_at", | 38 | "updated_at", |
39 | "deleted_at", | 39 | "deleted_at", |
40 | + "ext", | ||
40 | } | 41 | } |
41 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "unit_conversion_id", "deleted_at")) | 42 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "unit_conversion_id", "deleted_at")) |
42 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "unit_conversion_id", "deleted_at")) | 43 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "unit_conversion_id", "deleted_at")) |
@@ -58,6 +59,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | @@ -58,6 +59,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | ||
58 | &unitConversion.CreatedAt, | 59 | &unitConversion.CreatedAt, |
59 | &unitConversion.UpdatedAt, | 60 | &unitConversion.UpdatedAt, |
60 | &unitConversion.DeletedAt, | 61 | &unitConversion.DeletedAt, |
62 | + &unitConversion.Ext, | ||
61 | ), | 63 | ), |
62 | fmt.Sprintf("INSERT INTO manufacture.unit_conversion (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 64 | fmt.Sprintf("INSERT INTO manufacture.unit_conversion (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
63 | unitConversion.CompanyId, | 65 | unitConversion.CompanyId, |
@@ -69,6 +71,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | @@ -69,6 +71,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | ||
69 | unitConversion.IntelligentWeighingFlag, | 71 | unitConversion.IntelligentWeighingFlag, |
70 | unitConversion.CreatedAt, | 72 | unitConversion.CreatedAt, |
71 | unitConversion.UpdatedAt, | 73 | unitConversion.UpdatedAt, |
74 | + unitConversion.Ext, | ||
72 | ); err != nil { | 75 | ); err != nil { |
73 | return unitConversion, err | 76 | return unitConversion, err |
74 | } | 77 | } |
@@ -86,6 +89,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | @@ -86,6 +89,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | ||
86 | &unitConversion.CreatedAt, | 89 | &unitConversion.CreatedAt, |
87 | &unitConversion.UpdatedAt, | 90 | &unitConversion.UpdatedAt, |
88 | &unitConversion.DeletedAt, | 91 | &unitConversion.DeletedAt, |
92 | + &unitConversion.Ext, | ||
89 | ), | 93 | ), |
90 | fmt.Sprintf("UPDATE manufacture.unit_conversion SET %s WHERE unit_conversion_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 94 | fmt.Sprintf("UPDATE manufacture.unit_conversion SET %s WHERE unit_conversion_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
91 | unitConversion.CompanyId, | 95 | unitConversion.CompanyId, |
@@ -97,6 +101,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | @@ -97,6 +101,7 @@ func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConv | ||
97 | unitConversion.IntelligentWeighingFlag, | 101 | unitConversion.IntelligentWeighingFlag, |
98 | unitConversion.CreatedAt, | 102 | unitConversion.CreatedAt, |
99 | unitConversion.UpdatedAt, | 103 | unitConversion.UpdatedAt, |
104 | + unitConversion.Ext, | ||
100 | unitConversion.Identify(), | 105 | unitConversion.Identify(), |
101 | ); err != nil { | 106 | ); err != nil { |
102 | return unitConversion, err | 107 | return unitConversion, err |
@@ -35,6 +35,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | @@ -35,6 +35,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | ||
35 | "created_at", | 35 | "created_at", |
36 | "updated_at", | 36 | "updated_at", |
37 | "deleted_at", | 37 | "deleted_at", |
38 | + "ext", | ||
38 | } | 39 | } |
39 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "workshop_id", "deleted_at")) | 40 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "workshop_id", "deleted_at")) |
40 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "workshop_id", "deleted_at")) | 41 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "workshop_id", "deleted_at")) |
@@ -54,6 +55,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | @@ -54,6 +55,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | ||
54 | &workshop.CreatedAt, | 55 | &workshop.CreatedAt, |
55 | &workshop.UpdatedAt, | 56 | &workshop.UpdatedAt, |
56 | &workshop.DeletedAt, | 57 | &workshop.DeletedAt, |
58 | + &workshop.Ext, | ||
57 | ), | 59 | ), |
58 | fmt.Sprintf("INSERT INTO manufacture.workshop (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 60 | fmt.Sprintf("INSERT INTO manufacture.workshop (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
59 | workshop.CompanyId, | 61 | workshop.CompanyId, |
@@ -63,6 +65,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | @@ -63,6 +65,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | ||
63 | workshop.ProductLines, | 65 | workshop.ProductLines, |
64 | workshop.CreatedAt, | 66 | workshop.CreatedAt, |
65 | workshop.UpdatedAt, | 67 | workshop.UpdatedAt, |
68 | + workshop.Ext, | ||
66 | ); err != nil { | 69 | ); err != nil { |
67 | return workshop, err | 70 | return workshop, err |
68 | } | 71 | } |
@@ -78,6 +81,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | @@ -78,6 +81,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | ||
78 | &workshop.CreatedAt, | 81 | &workshop.CreatedAt, |
79 | &workshop.UpdatedAt, | 82 | &workshop.UpdatedAt, |
80 | &workshop.DeletedAt, | 83 | &workshop.DeletedAt, |
84 | + &workshop.Ext, | ||
81 | ), | 85 | ), |
82 | fmt.Sprintf("UPDATE manufacture.workshop SET %s WHERE workshop_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 86 | fmt.Sprintf("UPDATE manufacture.workshop SET %s WHERE workshop_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
83 | workshop.CompanyId, | 87 | workshop.CompanyId, |
@@ -87,6 +91,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | @@ -87,6 +91,7 @@ func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.W | ||
87 | workshop.ProductLines, | 91 | workshop.ProductLines, |
88 | workshop.CreatedAt, | 92 | workshop.CreatedAt, |
89 | workshop.UpdatedAt, | 93 | workshop.UpdatedAt, |
94 | + workshop.Ext, | ||
90 | workshop.Identify(), | 95 | workshop.Identify(), |
91 | ); err != nil { | 96 | ); err != nil { |
92 | return workshop, err | 97 | return workshop, err |
-
请 注册 或 登录 后发表评论