正在显示
28 个修改的文件
包含
575 行增加
和
28 行删除
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "reflect" | ||
| 6 | + "strings" | ||
| 7 | + | ||
| 8 | + "github.com/beego/beego/v2/core/validation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type BatchRemoveDeviceCommand struct { | ||
| 12 | + // ID列表 | ||
| 13 | + IdList []int `cname:"ID列表" json:"idList" valid:"Required"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (removeDeviceCommand *BatchRemoveDeviceCommand) Valid(validation *validation.Validation) { | ||
| 17 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (removeDeviceCommand *BatchRemoveDeviceCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(removeDeviceCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + elem := reflect.TypeOf(removeDeviceCommand).Elem() | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 30 | + if isExist { | ||
| 31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 32 | + } else { | ||
| 33 | + return fmt.Errorf(validErr.Message) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return nil | ||
| 38 | +} |
| @@ -197,6 +197,50 @@ func (deviceService *DeviceService) RemoveDevice(removeDeviceCommand *command.Re | @@ -197,6 +197,50 @@ func (deviceService *DeviceService) RemoveDevice(removeDeviceCommand *command.Re | ||
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | +// 移除设备服务 | ||
| 201 | +func (deviceService *DeviceService) BatchRemoveDevice(cmd *command.BatchRemoveDeviceCommand) (interface{}, error) { | ||
| 202 | + if err := cmd.ValidateCommand(); err != nil { | ||
| 203 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 204 | + } | ||
| 205 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 206 | + if err != nil { | ||
| 207 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 208 | + } | ||
| 209 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 210 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 211 | + } | ||
| 212 | + defer func() { | ||
| 213 | + transactionContext.RollbackTransaction() | ||
| 214 | + }() | ||
| 215 | + var deviceRepository domain.DeviceRepository | ||
| 216 | + if value, err := factory.CreateDeviceRepository(map[string]interface{}{ | ||
| 217 | + "transactionContext": transactionContext, | ||
| 218 | + }); err != nil { | ||
| 219 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 220 | + } else { | ||
| 221 | + deviceRepository = value | ||
| 222 | + } | ||
| 223 | + for i := range cmd.IdList { | ||
| 224 | + id := cmd.IdList[i] | ||
| 225 | + device, err := deviceRepository.FindOne(map[string]interface{}{"deviceId": id}) | ||
| 226 | + if err != nil { | ||
| 227 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 228 | + } | ||
| 229 | + if device == nil { | ||
| 230 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", id)) | ||
| 231 | + } | ||
| 232 | + if _, err := deviceRepository.Remove(device); err != nil { | ||
| 233 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 237 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 238 | + } | ||
| 239 | + return struct { | ||
| 240 | + }{}, nil | ||
| 241 | + | ||
| 242 | +} | ||
| 243 | + | ||
| 200 | // 更新设备服务 | 244 | // 更新设备服务 |
| 201 | func (deviceService *DeviceService) UpdateDevice(cmd *command.UpdateDeviceCommand) (interface{}, error) { | 245 | func (deviceService *DeviceService) UpdateDevice(cmd *command.UpdateDeviceCommand) (interface{}, error) { |
| 202 | if err := cmd.ValidateCommand(); err != nil { | 246 | if err := cmd.ValidateCommand(); err != nil { |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "reflect" | ||
| 6 | + "strings" | ||
| 7 | + | ||
| 8 | + "github.com/beego/beego/v2/core/validation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type BatchRemoveProductCommand struct { | ||
| 12 | + // ID列表 | ||
| 13 | + IdList []int `cname:"ID列表" json:"idList" valid:"Required"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (removeProductCommand *BatchRemoveProductCommand) Valid(validation *validation.Validation) { | ||
| 17 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (removeProductCommand *BatchRemoveProductCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(removeProductCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + elem := reflect.TypeOf(removeProductCommand).Elem() | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 30 | + if isExist { | ||
| 31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 32 | + } else { | ||
| 33 | + return fmt.Errorf(validErr.Message) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return nil | ||
| 38 | +} |
| @@ -190,6 +190,50 @@ func (productService *ProductService) RemoveProduct(removeProductCommand *comman | @@ -190,6 +190,50 @@ func (productService *ProductService) RemoveProduct(removeProductCommand *comman | ||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | +// 移除产品服务 | ||
| 194 | +func (productService *ProductService) BatchRemoveProduct(cmd *command.BatchRemoveProductCommand) (interface{}, error) { | ||
| 195 | + if err := cmd.ValidateCommand(); err != nil { | ||
| 196 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 197 | + } | ||
| 198 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 199 | + if err != nil { | ||
| 200 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 201 | + } | ||
| 202 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 203 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 204 | + } | ||
| 205 | + defer func() { | ||
| 206 | + transactionContext.RollbackTransaction() | ||
| 207 | + }() | ||
| 208 | + var productRepository domain.ProductRepository | ||
| 209 | + if value, err := factory.CreateProductRepository(map[string]interface{}{ | ||
| 210 | + "transactionContext": transactionContext, | ||
| 211 | + }); err != nil { | ||
| 212 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 213 | + } else { | ||
| 214 | + productRepository = value | ||
| 215 | + } | ||
| 216 | + for i := range cmd.IdList { | ||
| 217 | + id := cmd.IdList[i] | ||
| 218 | + product, err := productRepository.FindOne(map[string]interface{}{"productId": id}) | ||
| 219 | + if err != nil { | ||
| 220 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 221 | + } | ||
| 222 | + if product == nil { | ||
| 223 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", id)) | ||
| 224 | + } | ||
| 225 | + if _, err := productRepository.Remove(product); err != nil { | ||
| 226 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 230 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 231 | + } | ||
| 232 | + return struct { | ||
| 233 | + }{}, nil | ||
| 234 | + | ||
| 235 | +} | ||
| 236 | + | ||
| 193 | // 更新产品服务 | 237 | // 更新产品服务 |
| 194 | func (productService *ProductService) UpdateProduct(updateProductCommand *command.UpdateProductCommand) (interface{}, error) { | 238 | func (productService *ProductService) UpdateProduct(updateProductCommand *command.UpdateProductCommand) (interface{}, error) { |
| 195 | if err := updateProductCommand.ValidateCommand(); err != nil { | 239 | if err := updateProductCommand.ValidateCommand(); err != nil { |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "reflect" | ||
| 6 | + "strings" | ||
| 7 | + | ||
| 8 | + "github.com/beego/beego/v2/core/validation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type BatchRemoveProductCalendarCommand struct { | ||
| 12 | + // ID列表 | ||
| 13 | + IdList []int `cname:"ID列表" json:"idList" valid:"Required"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (removeProductCalendarCommand *BatchRemoveProductCalendarCommand) Valid(validation *validation.Validation) { | ||
| 17 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (removeProductCalendarCommand *BatchRemoveProductCalendarCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(removeProductCalendarCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + elem := reflect.TypeOf(removeProductCalendarCommand).Elem() | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 30 | + if isExist { | ||
| 31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 32 | + } else { | ||
| 33 | + return fmt.Errorf(validErr.Message) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return nil | ||
| 38 | +} |
| @@ -196,6 +196,50 @@ func (productCalendarService *ProductCalendarService) RemoveProductCalendar(remo | @@ -196,6 +196,50 @@ func (productCalendarService *ProductCalendarService) RemoveProductCalendar(remo | ||
| 196 | } | 196 | } |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | +// 移除工厂日历服务 | ||
| 200 | +func (productCalendarService *ProductCalendarService) BatchRemoveProductCalendar(cmd *command.BatchRemoveProductCalendarCommand) (interface{}, error) { | ||
| 201 | + if err := cmd.ValidateCommand(); err != nil { | ||
| 202 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 203 | + } | ||
| 204 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 205 | + if err != nil { | ||
| 206 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 207 | + } | ||
| 208 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 209 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 210 | + } | ||
| 211 | + defer func() { | ||
| 212 | + transactionContext.RollbackTransaction() | ||
| 213 | + }() | ||
| 214 | + var productCalendarRepository domain.ProductCalendarRepository | ||
| 215 | + if value, err := factory.CreateProductCalendarRepository(map[string]interface{}{ | ||
| 216 | + "transactionContext": transactionContext, | ||
| 217 | + }); err != nil { | ||
| 218 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 219 | + } else { | ||
| 220 | + productCalendarRepository = value | ||
| 221 | + } | ||
| 222 | + for i := range cmd.IdList { | ||
| 223 | + id := cmd.IdList[i] | ||
| 224 | + productCalendar, err := productCalendarRepository.FindOne(map[string]interface{}{"productCalendarId": id}) | ||
| 225 | + if err != nil { | ||
| 226 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 227 | + } | ||
| 228 | + if productCalendar == nil { | ||
| 229 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", id)) | ||
| 230 | + } | ||
| 231 | + if _, err := productCalendarRepository.Remove(productCalendar); err != nil { | ||
| 232 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 236 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 237 | + } | ||
| 238 | + return struct { | ||
| 239 | + }{}, nil | ||
| 240 | + | ||
| 241 | +} | ||
| 242 | + | ||
| 199 | // 更新工厂日历服务 | 243 | // 更新工厂日历服务 |
| 200 | func (productCalendarService *ProductCalendarService) UpdateProductCalendar(cmd *command.UpdateProductCalendarCommand) (interface{}, error) { | 244 | func (productCalendarService *ProductCalendarService) UpdateProductCalendar(cmd *command.UpdateProductCalendarCommand) (interface{}, error) { |
| 201 | if err := cmd.ValidateCommand(); err != nil { | 245 | if err := cmd.ValidateCommand(); err != nil { |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "reflect" | ||
| 6 | + "strings" | ||
| 7 | + | ||
| 8 | + "github.com/beego/beego/v2/core/validation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type BatchRemoveProductGroupCommand struct { | ||
| 12 | + // ID列表 | ||
| 13 | + IdList []int `cname:"ID列表" json:"idList" valid:"Required"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (removeProductGroupCommand *BatchRemoveProductGroupCommand) Valid(validation *validation.Validation) { | ||
| 17 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (removeProductGroupCommand *BatchRemoveProductGroupCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(removeProductGroupCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + elem := reflect.TypeOf(removeProductGroupCommand).Elem() | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 30 | + if isExist { | ||
| 31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 32 | + } else { | ||
| 33 | + return fmt.Errorf(validErr.Message) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return nil | ||
| 38 | +} |
| @@ -197,6 +197,52 @@ func (productGroupService *ProductGroupService) RemoveProductGroup(removeProduct | @@ -197,6 +197,52 @@ func (productGroupService *ProductGroupService) RemoveProductGroup(removeProduct | ||
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | +// 移除生产班组服务 | ||
| 201 | +func (productGroupService *ProductGroupService) BatchRemoveProductGroup(cmd *command.BatchRemoveProductGroupCommand) (interface{}, error) { | ||
| 202 | + if err := cmd.ValidateCommand(); err != nil { | ||
| 203 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 204 | + } | ||
| 205 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 206 | + if err != nil { | ||
| 207 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 208 | + } | ||
| 209 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 210 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 211 | + } | ||
| 212 | + defer func() { | ||
| 213 | + transactionContext.RollbackTransaction() | ||
| 214 | + }() | ||
| 215 | + var productGroupRepository domain.ProductGroupRepository | ||
| 216 | + if value, err := factory.CreateProductGroupRepository(map[string]interface{}{ | ||
| 217 | + "transactionContext": transactionContext, | ||
| 218 | + }); err != nil { | ||
| 219 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 220 | + } else { | ||
| 221 | + productGroupRepository = value | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + for i := range cmd.IdList { | ||
| 225 | + id := cmd.IdList[i] | ||
| 226 | + productGroup, err := productGroupRepository.FindOne(map[string]interface{}{"productGroupId": id}) | ||
| 227 | + if err != nil { | ||
| 228 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 229 | + } | ||
| 230 | + if productGroup == nil { | ||
| 231 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%v", id)) | ||
| 232 | + } | ||
| 233 | + if _, err := productGroupRepository.Remove(productGroup); err != nil { | ||
| 234 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 239 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 240 | + } | ||
| 241 | + return struct { | ||
| 242 | + }{}, nil | ||
| 243 | + | ||
| 244 | +} | ||
| 245 | + | ||
| 200 | // 更新生产班组服务 | 246 | // 更新生产班组服务 |
| 201 | func (productGroupService *ProductGroupService) UpdateProductGroup(cmd *command.UpdateProductGroupCommand) (interface{}, error) { | 247 | func (productGroupService *ProductGroupService) UpdateProductGroup(cmd *command.UpdateProductGroupCommand) (interface{}, error) { |
| 202 | if err := cmd.ValidateCommand(); err != nil { | 248 | if err := cmd.ValidateCommand(); err != nil { |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "reflect" | ||
| 6 | + "strings" | ||
| 7 | + | ||
| 8 | + "github.com/beego/beego/v2/core/validation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type BatchRemoveProductJobCommand struct { | ||
| 12 | + // ID列表 | ||
| 13 | + IdList []int `cname:"ID列表" json:"idList" valid:"Required"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (removeProductJobCommand *BatchRemoveProductJobCommand) Valid(validation *validation.Validation) { | ||
| 17 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (removeProductJobCommand *BatchRemoveProductJobCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(removeProductJobCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + elem := reflect.TypeOf(removeProductJobCommand).Elem() | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 30 | + if isExist { | ||
| 31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 32 | + } else { | ||
| 33 | + return fmt.Errorf(validErr.Message) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return nil | ||
| 38 | +} |
| @@ -16,7 +16,7 @@ type CreateProductJobCommand struct { | @@ -16,7 +16,7 @@ type CreateProductJobCommand struct { | ||
| 16 | // 工位名称 | 16 | // 工位名称 |
| 17 | JobName string `cname:"工位名称" json:"jobName" valid:"Required"` | 17 | JobName string `cname:"工位名称" json:"jobName" valid:"Required"` |
| 18 | // 工位名称 | 18 | // 工位名称 |
| 19 | - ProcessName string `cname:"工位名称" json:"processName" valid:"Required"` | 19 | + ProcessName string `cname:"工序名称" json:"processName" valid:"Required"` |
| 20 | // 车间ID | 20 | // 车间ID |
| 21 | WorkshopId int `cname:"车间ID" json:"workshopId" valid:"Required"` | 21 | WorkshopId int `cname:"车间ID" json:"workshopId" valid:"Required"` |
| 22 | // 生产线ID | 22 | // 生产线ID |
| @@ -175,6 +175,49 @@ func (productJobService *ProductJobService) RemoveProductJob(removeProductJobCom | @@ -175,6 +175,49 @@ func (productJobService *ProductJobService) RemoveProductJob(removeProductJobCom | ||
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | +// 移除工位服务 | ||
| 179 | +func (productJobService *ProductJobService) BatchRemoveProductJob(cmd *command.BatchRemoveProductJobCommand) (interface{}, error) { | ||
| 180 | + if err := cmd.ValidateCommand(); err != nil { | ||
| 181 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 182 | + } | ||
| 183 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 184 | + if err != nil { | ||
| 185 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 186 | + } | ||
| 187 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 188 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 189 | + } | ||
| 190 | + defer func() { | ||
| 191 | + transactionContext.RollbackTransaction() | ||
| 192 | + }() | ||
| 193 | + var productJobRepository domain.ProductJobRepository | ||
| 194 | + if value, err := factory.CreateProductJobRepository(map[string]interface{}{ | ||
| 195 | + "transactionContext": transactionContext, | ||
| 196 | + }); err != nil { | ||
| 197 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 198 | + } else { | ||
| 199 | + productJobRepository = value | ||
| 200 | + } | ||
| 201 | + for i := range cmd.IdList { | ||
| 202 | + id := cmd.IdList[i] | ||
| 203 | + productJob, err := productJobRepository.FindOne(map[string]interface{}{"productJobId": id}) | ||
| 204 | + if err != nil { | ||
| 205 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 206 | + } | ||
| 207 | + if productJob == nil { | ||
| 208 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", id)) | ||
| 209 | + } | ||
| 210 | + if _, err := productJobRepository.Remove(productJob); err != nil { | ||
| 211 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 215 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 216 | + } | ||
| 217 | + return struct { | ||
| 218 | + }{}, nil | ||
| 219 | +} | ||
| 220 | + | ||
| 178 | // 更新工位服务 | 221 | // 更新工位服务 |
| 179 | func (productJobService *ProductJobService) UpdateProductJob(cmd *command.UpdateProductJobCommand) (interface{}, error) { | 222 | func (productJobService *ProductJobService) UpdateProductJob(cmd *command.UpdateProductJobCommand) (interface{}, error) { |
| 180 | if err := cmd.ValidateCommand(); err != nil { | 223 | if err := cmd.ValidateCommand(); err != nil { |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "reflect" | ||
| 6 | + "strings" | ||
| 7 | + | ||
| 8 | + "github.com/beego/beego/v2/core/validation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type BatchRemoveUnitConversionCommand struct { | ||
| 12 | + // ID列表 | ||
| 13 | + IdList []int `cname:"ID列表" json:"idList" valid:"Required"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (removeUnitConversionCommand *BatchRemoveUnitConversionCommand) Valid(validation *validation.Validation) { | ||
| 17 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (removeUnitConversionCommand *BatchRemoveUnitConversionCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(removeUnitConversionCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + elem := reflect.TypeOf(removeUnitConversionCommand).Elem() | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 30 | + if isExist { | ||
| 31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 32 | + } else { | ||
| 33 | + return fmt.Errorf(validErr.Message) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return nil | ||
| 38 | +} |
| @@ -168,6 +168,50 @@ func (unitConversionService *UnitConversionService) RemoveUnitConversion(removeU | @@ -168,6 +168,50 @@ func (unitConversionService *UnitConversionService) RemoveUnitConversion(removeU | ||
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | +// 移除单位换算服务 | ||
| 172 | +func (unitConversionService *UnitConversionService) BatchRemoveUnitConversion(cmd *command.BatchRemoveUnitConversionCommand) (interface{}, error) { | ||
| 173 | + if err := cmd.ValidateCommand(); err != nil { | ||
| 174 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 175 | + } | ||
| 176 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 177 | + if err != nil { | ||
| 178 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 179 | + } | ||
| 180 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 181 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 182 | + } | ||
| 183 | + defer func() { | ||
| 184 | + transactionContext.RollbackTransaction() | ||
| 185 | + }() | ||
| 186 | + var unitConversionRepository domain.UnitConversionRepository | ||
| 187 | + if value, err := factory.CreateUnitConversionRepository(map[string]interface{}{ | ||
| 188 | + "transactionContext": transactionContext, | ||
| 189 | + }); err != nil { | ||
| 190 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 191 | + } else { | ||
| 192 | + unitConversionRepository = value | ||
| 193 | + } | ||
| 194 | + for i := range cmd.IdList { | ||
| 195 | + id := cmd.IdList[i] | ||
| 196 | + unitConversion, err := unitConversionRepository.FindOne(map[string]interface{}{"unitConversionId": id}) | ||
| 197 | + if err != nil { | ||
| 198 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 199 | + } | ||
| 200 | + if unitConversion == nil { | ||
| 201 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", id)) | ||
| 202 | + } | ||
| 203 | + if _, err := unitConversionRepository.Remove(unitConversion); err != nil { | ||
| 204 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 205 | + } | ||
| 206 | + } | ||
| 207 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 208 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 209 | + } | ||
| 210 | + return struct { | ||
| 211 | + }{}, nil | ||
| 212 | + | ||
| 213 | +} | ||
| 214 | + | ||
| 171 | // 更新单位换算服务 | 215 | // 更新单位换算服务 |
| 172 | func (unitConversionService *UnitConversionService) UpdateUnitConversion(cmd *command.UpdateUnitConversionCommand) (interface{}, error) { | 216 | func (unitConversionService *UnitConversionService) UpdateUnitConversion(cmd *command.UpdateUnitConversionCommand) (interface{}, error) { |
| 173 | if err := cmd.ValidateCommand(); err != nil { | 217 | if err := cmd.ValidateCommand(); err != nil { |
| @@ -15,7 +15,7 @@ type DeviceController struct { | @@ -15,7 +15,7 @@ type DeviceController struct { | ||
| 15 | func (controller *DeviceController) CreateDevice() { | 15 | func (controller *DeviceController) CreateDevice() { |
| 16 | deviceService := service.NewDeviceService(nil) | 16 | deviceService := service.NewDeviceService(nil) |
| 17 | createDeviceCommand := &command.CreateDeviceCommand{} | 17 | createDeviceCommand := &command.CreateDeviceCommand{} |
| 18 | - controller.Unmarshal(createDeviceCommand) | 18 | + Must(controller.Unmarshal(createDeviceCommand)) |
| 19 | data, err := deviceService.CreateDevice(ParseOperateInfo(controller.BaseController), createDeviceCommand) | 19 | data, err := deviceService.CreateDevice(ParseOperateInfo(controller.BaseController), createDeviceCommand) |
| 20 | controller.Response(data, err) | 20 | controller.Response(data, err) |
| 21 | } | 21 | } |
| @@ -23,7 +23,7 @@ func (controller *DeviceController) CreateDevice() { | @@ -23,7 +23,7 @@ func (controller *DeviceController) CreateDevice() { | ||
| 23 | func (controller *DeviceController) UpdateDevice() { | 23 | func (controller *DeviceController) UpdateDevice() { |
| 24 | deviceService := service.NewDeviceService(nil) | 24 | deviceService := service.NewDeviceService(nil) |
| 25 | updateDeviceCommand := &command.UpdateDeviceCommand{} | 25 | updateDeviceCommand := &command.UpdateDeviceCommand{} |
| 26 | - controller.Unmarshal(updateDeviceCommand) | 26 | + Must(controller.Unmarshal(updateDeviceCommand)) |
| 27 | deviceId, _ := controller.GetInt(":deviceId") | 27 | deviceId, _ := controller.GetInt(":deviceId") |
| 28 | updateDeviceCommand.DeviceId = deviceId | 28 | updateDeviceCommand.DeviceId = deviceId |
| 29 | data, err := deviceService.UpdateDevice(updateDeviceCommand) | 29 | data, err := deviceService.UpdateDevice(updateDeviceCommand) |
| @@ -42,13 +42,21 @@ func (controller *DeviceController) GetDevice() { | @@ -42,13 +42,21 @@ func (controller *DeviceController) GetDevice() { | ||
| 42 | func (controller *DeviceController) RemoveDevice() { | 42 | func (controller *DeviceController) RemoveDevice() { |
| 43 | deviceService := service.NewDeviceService(nil) | 43 | deviceService := service.NewDeviceService(nil) |
| 44 | removeDeviceCommand := &command.RemoveDeviceCommand{} | 44 | removeDeviceCommand := &command.RemoveDeviceCommand{} |
| 45 | - controller.Unmarshal(removeDeviceCommand) | 45 | + Must(controller.Unmarshal(removeDeviceCommand)) |
| 46 | deviceId, _ := controller.GetInt(":deviceId") | 46 | deviceId, _ := controller.GetInt(":deviceId") |
| 47 | removeDeviceCommand.DeviceId = deviceId | 47 | removeDeviceCommand.DeviceId = deviceId |
| 48 | data, err := deviceService.RemoveDevice(removeDeviceCommand) | 48 | data, err := deviceService.RemoveDevice(removeDeviceCommand) |
| 49 | controller.Response(data, err) | 49 | controller.Response(data, err) |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | +func (controller *DeviceController) BatchRemoveDevice() { | ||
| 53 | + deviceService := service.NewDeviceService(nil) | ||
| 54 | + removeDeviceCommand := &command.BatchRemoveDeviceCommand{} | ||
| 55 | + Must(controller.Unmarshal(removeDeviceCommand)) | ||
| 56 | + data, err := deviceService.BatchRemoveDevice(removeDeviceCommand) | ||
| 57 | + controller.Response(data, err) | ||
| 58 | +} | ||
| 59 | + | ||
| 52 | func (controller *DeviceController) ListDevice() { | 60 | func (controller *DeviceController) ListDevice() { |
| 53 | deviceService := service.NewDeviceService(nil) | 61 | deviceService := service.NewDeviceService(nil) |
| 54 | listDeviceQuery := &query.ListDeviceQuery{} | 62 | listDeviceQuery := &query.ListDeviceQuery{} |
| @@ -63,7 +71,7 @@ func (controller *DeviceController) ListDevice() { | @@ -63,7 +71,7 @@ func (controller *DeviceController) ListDevice() { | ||
| 63 | func (controller *DeviceController) SearchDevice() { | 71 | func (controller *DeviceController) SearchDevice() { |
| 64 | deviceService := service.NewDeviceService(nil) | 72 | deviceService := service.NewDeviceService(nil) |
| 65 | listDeviceQuery := &query.SearchDeviceQuery{} | 73 | listDeviceQuery := &query.SearchDeviceQuery{} |
| 66 | - controller.Unmarshal(listDeviceQuery) | 74 | + Must(controller.Unmarshal(listDeviceQuery)) |
| 67 | total, data, err := deviceService.SearchDevice(ParseOperateInfo(controller.BaseController), listDeviceQuery) | 75 | total, data, err := deviceService.SearchDevice(ParseOperateInfo(controller.BaseController), listDeviceQuery) |
| 68 | ResponseGrid(controller.BaseController, total, data, err) | 76 | ResponseGrid(controller.BaseController, total, data, err) |
| 69 | } | 77 | } |
| @@ -14,7 +14,7 @@ type ProductCalendarController struct { | @@ -14,7 +14,7 @@ type ProductCalendarController struct { | ||
| 14 | func (controller *ProductCalendarController) CreateProductCalendar() { | 14 | func (controller *ProductCalendarController) CreateProductCalendar() { |
| 15 | productCalendarService := service.NewProductCalendarService(nil) | 15 | productCalendarService := service.NewProductCalendarService(nil) |
| 16 | createProductCalendarCommand := &command.CreateProductCalendarCommand{} | 16 | createProductCalendarCommand := &command.CreateProductCalendarCommand{} |
| 17 | - controller.Unmarshal(createProductCalendarCommand) | 17 | + Must(controller.Unmarshal(createProductCalendarCommand)) |
| 18 | data, err := productCalendarService.CreateProductCalendar(ParseOperateInfo(controller.BaseController), createProductCalendarCommand) | 18 | data, err := productCalendarService.CreateProductCalendar(ParseOperateInfo(controller.BaseController), createProductCalendarCommand) |
| 19 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| 20 | } | 20 | } |
| @@ -22,7 +22,7 @@ func (controller *ProductCalendarController) CreateProductCalendar() { | @@ -22,7 +22,7 @@ func (controller *ProductCalendarController) CreateProductCalendar() { | ||
| 22 | func (controller *ProductCalendarController) UpdateProductCalendar() { | 22 | func (controller *ProductCalendarController) UpdateProductCalendar() { |
| 23 | productCalendarService := service.NewProductCalendarService(nil) | 23 | productCalendarService := service.NewProductCalendarService(nil) |
| 24 | updateProductCalendarCommand := &command.UpdateProductCalendarCommand{} | 24 | updateProductCalendarCommand := &command.UpdateProductCalendarCommand{} |
| 25 | - controller.Unmarshal(updateProductCalendarCommand) | 25 | + Must(controller.Unmarshal(updateProductCalendarCommand)) |
| 26 | productCalendarId, _ := controller.GetInt(":productCalendarId") | 26 | productCalendarId, _ := controller.GetInt(":productCalendarId") |
| 27 | updateProductCalendarCommand.ProductCalendarId = productCalendarId | 27 | updateProductCalendarCommand.ProductCalendarId = productCalendarId |
| 28 | data, err := productCalendarService.UpdateProductCalendar(updateProductCalendarCommand) | 28 | data, err := productCalendarService.UpdateProductCalendar(updateProductCalendarCommand) |
| @@ -41,13 +41,21 @@ func (controller *ProductCalendarController) GetProductCalendar() { | @@ -41,13 +41,21 @@ func (controller *ProductCalendarController) GetProductCalendar() { | ||
| 41 | func (controller *ProductCalendarController) RemoveProductCalendar() { | 41 | func (controller *ProductCalendarController) RemoveProductCalendar() { |
| 42 | productCalendarService := service.NewProductCalendarService(nil) | 42 | productCalendarService := service.NewProductCalendarService(nil) |
| 43 | removeProductCalendarCommand := &command.RemoveProductCalendarCommand{} | 43 | removeProductCalendarCommand := &command.RemoveProductCalendarCommand{} |
| 44 | - controller.Unmarshal(removeProductCalendarCommand) | 44 | + Must(controller.Unmarshal(removeProductCalendarCommand)) |
| 45 | productCalendarId, _ := controller.GetInt(":productCalendarId") | 45 | productCalendarId, _ := controller.GetInt(":productCalendarId") |
| 46 | removeProductCalendarCommand.ProductCalendarId = productCalendarId | 46 | removeProductCalendarCommand.ProductCalendarId = productCalendarId |
| 47 | data, err := productCalendarService.RemoveProductCalendar(removeProductCalendarCommand) | 47 | data, err := productCalendarService.RemoveProductCalendar(removeProductCalendarCommand) |
| 48 | controller.Response(data, err) | 48 | controller.Response(data, err) |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | +func (controller *ProductCalendarController) BatchRemoveProductCalendar() { | ||
| 52 | + productCalendarService := service.NewProductCalendarService(nil) | ||
| 53 | + removeProductCalendarCommand := &command.BatchRemoveProductCalendarCommand{} | ||
| 54 | + Must(controller.Unmarshal(removeProductCalendarCommand)) | ||
| 55 | + data, err := productCalendarService.BatchRemoveProductCalendar(removeProductCalendarCommand) | ||
| 56 | + controller.Response(data, err) | ||
| 57 | +} | ||
| 58 | + | ||
| 51 | func (controller *ProductCalendarController) ListProductCalendar() { | 59 | func (controller *ProductCalendarController) ListProductCalendar() { |
| 52 | productCalendarService := service.NewProductCalendarService(nil) | 60 | productCalendarService := service.NewProductCalendarService(nil) |
| 53 | listProductCalendarQuery := &query.ListProductCalendarQuery{} | 61 | listProductCalendarQuery := &query.ListProductCalendarQuery{} |
| @@ -15,7 +15,7 @@ type ProductController struct { | @@ -15,7 +15,7 @@ type ProductController struct { | ||
| 15 | func (controller *ProductController) CreateProduct() { | 15 | func (controller *ProductController) CreateProduct() { |
| 16 | productService := service.NewProductService(nil) | 16 | productService := service.NewProductService(nil) |
| 17 | createProductCommand := &command.CreateProductCommand{} | 17 | createProductCommand := &command.CreateProductCommand{} |
| 18 | - controller.Unmarshal(createProductCommand) | 18 | + Must(controller.Unmarshal(createProductCommand)) |
| 19 | op := ParseOperateInfo(controller.BaseController) | 19 | op := ParseOperateInfo(controller.BaseController) |
| 20 | createProductCommand.CompanyId = op.CompanyId | 20 | createProductCommand.CompanyId = op.CompanyId |
| 21 | createProductCommand.OrgId = op.OrgId | 21 | createProductCommand.OrgId = op.OrgId |
| @@ -26,7 +26,7 @@ func (controller *ProductController) CreateProduct() { | @@ -26,7 +26,7 @@ func (controller *ProductController) CreateProduct() { | ||
| 26 | func (controller *ProductController) UpdateProduct() { | 26 | func (controller *ProductController) UpdateProduct() { |
| 27 | productService := service.NewProductService(nil) | 27 | productService := service.NewProductService(nil) |
| 28 | updateProductCommand := &command.UpdateProductCommand{} | 28 | updateProductCommand := &command.UpdateProductCommand{} |
| 29 | - controller.Unmarshal(updateProductCommand) | 29 | + Must(controller.Unmarshal(updateProductCommand)) |
| 30 | productId, _ := controller.GetInt(":productId") | 30 | productId, _ := controller.GetInt(":productId") |
| 31 | updateProductCommand.ProductId = productId | 31 | updateProductCommand.ProductId = productId |
| 32 | data, err := productService.UpdateProduct(updateProductCommand) | 32 | data, err := productService.UpdateProduct(updateProductCommand) |
| @@ -52,6 +52,14 @@ func (controller *ProductController) RemoveProduct() { | @@ -52,6 +52,14 @@ func (controller *ProductController) RemoveProduct() { | ||
| 52 | controller.Response(data, err) | 52 | controller.Response(data, err) |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | +func (controller *ProductController) BatchRemoveProduct() { | ||
| 56 | + productService := service.NewProductService(nil) | ||
| 57 | + removeProductCommand := &command.BatchRemoveProductCommand{} | ||
| 58 | + Must(controller.Unmarshal(removeProductCommand)) | ||
| 59 | + data, err := productService.BatchRemoveProduct(removeProductCommand) | ||
| 60 | + controller.Response(data, err) | ||
| 61 | +} | ||
| 62 | + | ||
| 55 | func (controller *ProductController) ListProduct() { | 63 | func (controller *ProductController) ListProduct() { |
| 56 | productService := service.NewProductService(nil) | 64 | productService := service.NewProductService(nil) |
| 57 | listProductQuery := &query.ListProductQuery{} | 65 | listProductQuery := &query.ListProductQuery{} |
| @@ -66,7 +74,7 @@ func (controller *ProductController) ListProduct() { | @@ -66,7 +74,7 @@ func (controller *ProductController) ListProduct() { | ||
| 66 | func (controller *ProductController) SearchProduct() { | 74 | func (controller *ProductController) SearchProduct() { |
| 67 | productService := service.NewProductService(nil) | 75 | productService := service.NewProductService(nil) |
| 68 | listProductQuery := &query.SearchProductQuery{} | 76 | listProductQuery := &query.SearchProductQuery{} |
| 69 | - controller.Unmarshal(listProductQuery) | 77 | + Must(controller.Unmarshal(listProductQuery)) |
| 70 | total, data, err := productService.SearchProduct(ParseOperateInfo(controller.BaseController), listProductQuery) | 78 | total, data, err := productService.SearchProduct(ParseOperateInfo(controller.BaseController), listProductQuery) |
| 71 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
| 72 | } | 80 | } |
| @@ -76,7 +84,7 @@ func (controller *ProductController) BatchAddProduct() { | @@ -76,7 +84,7 @@ func (controller *ProductController) BatchAddProduct() { | ||
| 76 | cmd := &struct { | 84 | cmd := &struct { |
| 77 | List []*domain.ImportProductItem `json:"list"` | 85 | List []*domain.ImportProductItem `json:"list"` |
| 78 | }{} | 86 | }{} |
| 79 | - controller.Unmarshal(cmd) | 87 | + Must(controller.Unmarshal(cmd)) |
| 80 | data, err := productService.BatchAddProduct(ParseOperateInfo(controller.BaseController), cmd.List) | 88 | data, err := productService.BatchAddProduct(ParseOperateInfo(controller.BaseController), cmd.List) |
| 81 | controller.Response(data, err) | 89 | controller.Response(data, err) |
| 82 | } | 90 | } |
| @@ -14,7 +14,7 @@ type ProductGroupController struct { | @@ -14,7 +14,7 @@ type ProductGroupController struct { | ||
| 14 | func (controller *ProductGroupController) CreateProductGroup() { | 14 | func (controller *ProductGroupController) CreateProductGroup() { |
| 15 | productGroupService := service.NewProductGroupService(nil) | 15 | productGroupService := service.NewProductGroupService(nil) |
| 16 | createProductGroupCommand := &command.CreateProductGroupCommand{} | 16 | createProductGroupCommand := &command.CreateProductGroupCommand{} |
| 17 | - controller.Unmarshal(createProductGroupCommand) | 17 | + Must(controller.Unmarshal(createProductGroupCommand)) |
| 18 | data, err := productGroupService.CreateProductGroup(ParseOperateInfo(controller.BaseController), createProductGroupCommand) | 18 | data, err := productGroupService.CreateProductGroup(ParseOperateInfo(controller.BaseController), createProductGroupCommand) |
| 19 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| 20 | } | 20 | } |
| @@ -22,7 +22,7 @@ func (controller *ProductGroupController) CreateProductGroup() { | @@ -22,7 +22,7 @@ func (controller *ProductGroupController) CreateProductGroup() { | ||
| 22 | func (controller *ProductGroupController) UpdateProductGroup() { | 22 | func (controller *ProductGroupController) UpdateProductGroup() { |
| 23 | productGroupService := service.NewProductGroupService(nil) | 23 | productGroupService := service.NewProductGroupService(nil) |
| 24 | updateProductGroupCommand := &command.UpdateProductGroupCommand{} | 24 | updateProductGroupCommand := &command.UpdateProductGroupCommand{} |
| 25 | - controller.Unmarshal(updateProductGroupCommand) | 25 | + Must(controller.Unmarshal(updateProductGroupCommand)) |
| 26 | productGroupId, _ := controller.GetInt(":productGroupId") | 26 | productGroupId, _ := controller.GetInt(":productGroupId") |
| 27 | updateProductGroupCommand.ProductGroupId = productGroupId | 27 | updateProductGroupCommand.ProductGroupId = productGroupId |
| 28 | data, err := productGroupService.UpdateProductGroup(updateProductGroupCommand) | 28 | data, err := productGroupService.UpdateProductGroup(updateProductGroupCommand) |
| @@ -48,6 +48,14 @@ func (controller *ProductGroupController) RemoveProductGroup() { | @@ -48,6 +48,14 @@ func (controller *ProductGroupController) RemoveProductGroup() { | ||
| 48 | controller.Response(data, err) | 48 | controller.Response(data, err) |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | +func (controller *ProductGroupController) BatchRemoveProductGroup() { | ||
| 52 | + productGroupService := service.NewProductGroupService(nil) | ||
| 53 | + removeProductGroupCommand := &command.BatchRemoveProductGroupCommand{} | ||
| 54 | + Must(controller.Unmarshal(removeProductGroupCommand)) | ||
| 55 | + data, err := productGroupService.BatchRemoveProductGroup(removeProductGroupCommand) | ||
| 56 | + controller.Response(data, err) | ||
| 57 | +} | ||
| 58 | + | ||
| 51 | func (controller *ProductGroupController) ListProductGroup() { | 59 | func (controller *ProductGroupController) ListProductGroup() { |
| 52 | productGroupService := service.NewProductGroupService(nil) | 60 | productGroupService := service.NewProductGroupService(nil) |
| 53 | listProductGroupQuery := &query.ListProductGroupQuery{} | 61 | listProductGroupQuery := &query.ListProductGroupQuery{} |
| @@ -62,7 +70,7 @@ func (controller *ProductGroupController) ListProductGroup() { | @@ -62,7 +70,7 @@ func (controller *ProductGroupController) ListProductGroup() { | ||
| 62 | func (controller *ProductGroupController) SearchProductGroup() { | 70 | func (controller *ProductGroupController) SearchProductGroup() { |
| 63 | productGroupService := service.NewProductGroupService(nil) | 71 | productGroupService := service.NewProductGroupService(nil) |
| 64 | listProductGroupQuery := &query.SearchProductGroupQuery{} | 72 | listProductGroupQuery := &query.SearchProductGroupQuery{} |
| 65 | - controller.Unmarshal(listProductGroupQuery) | 73 | + Must(controller.Unmarshal(listProductGroupQuery)) |
| 66 | total, data, err := productGroupService.SearchProductGroup(ParseOperateInfo(controller.BaseController), listProductGroupQuery) | 74 | total, data, err := productGroupService.SearchProductGroup(ParseOperateInfo(controller.BaseController), listProductGroupQuery) |
| 67 | ResponseGrid(controller.BaseController, total, data, err) | 75 | ResponseGrid(controller.BaseController, total, data, err) |
| 68 | } | 76 | } |
| @@ -14,7 +14,7 @@ type ProductJobController struct { | @@ -14,7 +14,7 @@ type ProductJobController struct { | ||
| 14 | func (controller *ProductJobController) CreateProductJob() { | 14 | func (controller *ProductJobController) CreateProductJob() { |
| 15 | productJobService := service.NewProductJobService(nil) | 15 | productJobService := service.NewProductJobService(nil) |
| 16 | createProductJobCommand := &command.CreateProductJobCommand{} | 16 | createProductJobCommand := &command.CreateProductJobCommand{} |
| 17 | - controller.Unmarshal(createProductJobCommand) | 17 | + Must(controller.Unmarshal(createProductJobCommand)) |
| 18 | data, err := productJobService.CreateProductJob(ParseOperateInfo(controller.BaseController), createProductJobCommand) | 18 | data, err := productJobService.CreateProductJob(ParseOperateInfo(controller.BaseController), createProductJobCommand) |
| 19 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| 20 | } | 20 | } |
| @@ -22,7 +22,7 @@ func (controller *ProductJobController) CreateProductJob() { | @@ -22,7 +22,7 @@ func (controller *ProductJobController) CreateProductJob() { | ||
| 22 | func (controller *ProductJobController) UpdateProductJob() { | 22 | func (controller *ProductJobController) UpdateProductJob() { |
| 23 | productJobService := service.NewProductJobService(nil) | 23 | productJobService := service.NewProductJobService(nil) |
| 24 | updateProductJobCommand := &command.UpdateProductJobCommand{} | 24 | updateProductJobCommand := &command.UpdateProductJobCommand{} |
| 25 | - controller.Unmarshal(updateProductJobCommand) | 25 | + Must(controller.Unmarshal(updateProductJobCommand)) |
| 26 | productJobId, _ := controller.GetInt(":productJobId") | 26 | productJobId, _ := controller.GetInt(":productJobId") |
| 27 | updateProductJobCommand.ProductJobId = productJobId | 27 | updateProductJobCommand.ProductJobId = productJobId |
| 28 | data, err := productJobService.UpdateProductJob(updateProductJobCommand) | 28 | data, err := productJobService.UpdateProductJob(updateProductJobCommand) |
| @@ -48,6 +48,14 @@ func (controller *ProductJobController) RemoveProductJob() { | @@ -48,6 +48,14 @@ func (controller *ProductJobController) RemoveProductJob() { | ||
| 48 | controller.Response(data, err) | 48 | controller.Response(data, err) |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | +func (controller *ProductJobController) BatchRemoveProductJob() { | ||
| 52 | + productJobService := service.NewProductJobService(nil) | ||
| 53 | + removeProductJobCommand := &command.BatchRemoveProductJobCommand{} | ||
| 54 | + Must(controller.Unmarshal(removeProductJobCommand)) | ||
| 55 | + data, err := productJobService.BatchRemoveProductJob(removeProductJobCommand) | ||
| 56 | + controller.Response(data, err) | ||
| 57 | +} | ||
| 58 | + | ||
| 51 | func (controller *ProductJobController) ListProductJob() { | 59 | func (controller *ProductJobController) ListProductJob() { |
| 52 | productJobService := service.NewProductJobService(nil) | 60 | productJobService := service.NewProductJobService(nil) |
| 53 | listProductJobQuery := &query.ListProductJobQuery{} | 61 | listProductJobQuery := &query.ListProductJobQuery{} |
| @@ -62,7 +70,7 @@ func (controller *ProductJobController) ListProductJob() { | @@ -62,7 +70,7 @@ func (controller *ProductJobController) ListProductJob() { | ||
| 62 | func (controller *ProductJobController) SearchProductJob() { | 70 | func (controller *ProductJobController) SearchProductJob() { |
| 63 | productJobService := service.NewProductJobService(nil) | 71 | productJobService := service.NewProductJobService(nil) |
| 64 | listProductJobQuery := &query.SearchProductJobQuery{} | 72 | listProductJobQuery := &query.SearchProductJobQuery{} |
| 65 | - controller.Unmarshal(listProductJobQuery) | 73 | + Must(controller.Unmarshal(listProductJobQuery)) |
| 66 | total, data, err := productJobService.SearchProductJob(ParseOperateInfo(controller.BaseController), listProductJobQuery) | 74 | total, data, err := productJobService.SearchProductJob(ParseOperateInfo(controller.BaseController), listProductJobQuery) |
| 67 | ResponseGrid(controller.BaseController, total, data, err) | 75 | ResponseGrid(controller.BaseController, total, data, err) |
| 68 | } | 76 | } |
| @@ -14,7 +14,7 @@ type ProductLineController struct { | @@ -14,7 +14,7 @@ type ProductLineController struct { | ||
| 14 | func (controller *ProductLineController) CreateProductLine() { | 14 | func (controller *ProductLineController) CreateProductLine() { |
| 15 | productLineService := service.NewProductLineService(nil) | 15 | productLineService := service.NewProductLineService(nil) |
| 16 | createProductLineCommand := &command.CreateProductLineCommand{} | 16 | createProductLineCommand := &command.CreateProductLineCommand{} |
| 17 | - controller.Unmarshal(createProductLineCommand) | 17 | + Must(controller.Unmarshal(createProductLineCommand)) |
| 18 | data, err := productLineService.CreateProductLine(createProductLineCommand) | 18 | data, err := productLineService.CreateProductLine(createProductLineCommand) |
| 19 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| 20 | } | 20 | } |
| @@ -22,7 +22,7 @@ func (controller *ProductLineController) CreateProductLine() { | @@ -22,7 +22,7 @@ func (controller *ProductLineController) CreateProductLine() { | ||
| 22 | func (controller *ProductLineController) UpdateProductLine() { | 22 | func (controller *ProductLineController) UpdateProductLine() { |
| 23 | productLineService := service.NewProductLineService(nil) | 23 | productLineService := service.NewProductLineService(nil) |
| 24 | updateProductLineCommand := &command.UpdateProductLineCommand{} | 24 | updateProductLineCommand := &command.UpdateProductLineCommand{} |
| 25 | - controller.Unmarshal(updateProductLineCommand) | 25 | + Must(controller.Unmarshal(updateProductLineCommand)) |
| 26 | lineId, _ := controller.GetInt(":lineId") | 26 | lineId, _ := controller.GetInt(":lineId") |
| 27 | updateProductLineCommand.LineId = lineId | 27 | updateProductLineCommand.LineId = lineId |
| 28 | data, err := productLineService.UpdateProductLine(updateProductLineCommand) | 28 | data, err := productLineService.UpdateProductLine(updateProductLineCommand) |
| @@ -14,7 +14,7 @@ type ProductSectionController struct { | @@ -14,7 +14,7 @@ type ProductSectionController struct { | ||
| 14 | func (controller *ProductSectionController) CreateProductSection() { | 14 | func (controller *ProductSectionController) CreateProductSection() { |
| 15 | productSectionService := service.NewProductSectionService(nil) | 15 | productSectionService := service.NewProductSectionService(nil) |
| 16 | createProductSectionCommand := &command.CreateProductSectionCommand{} | 16 | createProductSectionCommand := &command.CreateProductSectionCommand{} |
| 17 | - controller.Unmarshal(createProductSectionCommand) | 17 | + Must(controller.Unmarshal(createProductSectionCommand)) |
| 18 | data, err := productSectionService.CreateProductSection(createProductSectionCommand) | 18 | data, err := productSectionService.CreateProductSection(createProductSectionCommand) |
| 19 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| 20 | } | 20 | } |
| @@ -22,7 +22,7 @@ func (controller *ProductSectionController) CreateProductSection() { | @@ -22,7 +22,7 @@ func (controller *ProductSectionController) CreateProductSection() { | ||
| 22 | func (controller *ProductSectionController) UpdateProductSection() { | 22 | func (controller *ProductSectionController) UpdateProductSection() { |
| 23 | productSectionService := service.NewProductSectionService(nil) | 23 | productSectionService := service.NewProductSectionService(nil) |
| 24 | updateProductSectionCommand := &command.UpdateProductSectionCommand{} | 24 | updateProductSectionCommand := &command.UpdateProductSectionCommand{} |
| 25 | - controller.Unmarshal(updateProductSectionCommand) | 25 | + Must(controller.Unmarshal(updateProductSectionCommand)) |
| 26 | sectionId, _ := controller.GetInt(":sectionId") | 26 | sectionId, _ := controller.GetInt(":sectionId") |
| 27 | updateProductSectionCommand.SectionId = sectionId | 27 | updateProductSectionCommand.SectionId = sectionId |
| 28 | data, err := productSectionService.UpdateProductSection(updateProductSectionCommand) | 28 | data, err := productSectionService.UpdateProductSection(updateProductSectionCommand) |
| @@ -22,7 +22,7 @@ func (controller *UnitConversionController) CreateUnitConversion() { | @@ -22,7 +22,7 @@ func (controller *UnitConversionController) CreateUnitConversion() { | ||
| 22 | func (controller *UnitConversionController) UpdateUnitConversion() { | 22 | func (controller *UnitConversionController) UpdateUnitConversion() { |
| 23 | unitConversionService := service.NewUnitConversionService(nil) | 23 | unitConversionService := service.NewUnitConversionService(nil) |
| 24 | updateUnitConversionCommand := &command.UpdateUnitConversionCommand{} | 24 | updateUnitConversionCommand := &command.UpdateUnitConversionCommand{} |
| 25 | - controller.Unmarshal(updateUnitConversionCommand) | 25 | + Must(controller.Unmarshal(updateUnitConversionCommand)) |
| 26 | unitConversionId, _ := controller.GetInt(":unitConversionId") | 26 | unitConversionId, _ := controller.GetInt(":unitConversionId") |
| 27 | updateUnitConversionCommand.UnitConversionId = unitConversionId | 27 | updateUnitConversionCommand.UnitConversionId = unitConversionId |
| 28 | data, err := unitConversionService.UpdateUnitConversion(updateUnitConversionCommand) | 28 | data, err := unitConversionService.UpdateUnitConversion(updateUnitConversionCommand) |
| @@ -48,6 +48,14 @@ func (controller *UnitConversionController) RemoveUnitConversion() { | @@ -48,6 +48,14 @@ func (controller *UnitConversionController) RemoveUnitConversion() { | ||
| 48 | controller.Response(data, err) | 48 | controller.Response(data, err) |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | +func (controller *UnitConversionController) BatchRemoveUnitConversion() { | ||
| 52 | + unitConversionService := service.NewUnitConversionService(nil) | ||
| 53 | + removeUnitConversionCommand := &command.BatchRemoveUnitConversionCommand{} | ||
| 54 | + Must(controller.Unmarshal(removeUnitConversionCommand)) | ||
| 55 | + data, err := unitConversionService.BatchRemoveUnitConversion(removeUnitConversionCommand) | ||
| 56 | + controller.Response(data, err) | ||
| 57 | +} | ||
| 58 | + | ||
| 51 | func (controller *UnitConversionController) ListUnitConversion() { | 59 | func (controller *UnitConversionController) ListUnitConversion() { |
| 52 | unitConversionService := service.NewUnitConversionService(nil) | 60 | unitConversionService := service.NewUnitConversionService(nil) |
| 53 | listUnitConversionQuery := &query.ListUnitConversionQuery{} | 61 | listUnitConversionQuery := &query.ListUnitConversionQuery{} |
| @@ -62,7 +70,7 @@ func (controller *UnitConversionController) ListUnitConversion() { | @@ -62,7 +70,7 @@ func (controller *UnitConversionController) ListUnitConversion() { | ||
| 62 | func (controller *UnitConversionController) SearchUnitConversion() { | 70 | func (controller *UnitConversionController) SearchUnitConversion() { |
| 63 | unitConversionService := service.NewUnitConversionService(nil) | 71 | unitConversionService := service.NewUnitConversionService(nil) |
| 64 | listUnitConversionQuery := &query.SearchUnitConversionQuery{} | 72 | listUnitConversionQuery := &query.SearchUnitConversionQuery{} |
| 65 | - controller.Unmarshal(listUnitConversionQuery) | 73 | + Must(controller.Unmarshal(listUnitConversionQuery)) |
| 66 | total, data, err := unitConversionService.SearchUnitConversion(ParseOperateInfo(controller.BaseController), listUnitConversionQuery) | 74 | total, data, err := unitConversionService.SearchUnitConversion(ParseOperateInfo(controller.BaseController), listUnitConversionQuery) |
| 67 | ResponseGrid(controller.BaseController, total, data, err) | 75 | ResponseGrid(controller.BaseController, total, data, err) |
| 68 | } | 76 | } |
| @@ -14,7 +14,7 @@ type WorkshopController struct { | @@ -14,7 +14,7 @@ type WorkshopController struct { | ||
| 14 | func (controller *WorkshopController) CreateWorkshop() { | 14 | func (controller *WorkshopController) CreateWorkshop() { |
| 15 | workshopService := service.NewWorkshopService(nil) | 15 | workshopService := service.NewWorkshopService(nil) |
| 16 | createWorkshopCommand := &command.CreateWorkshopCommand{} | 16 | createWorkshopCommand := &command.CreateWorkshopCommand{} |
| 17 | - controller.Unmarshal(createWorkshopCommand) | 17 | + Must(controller.Unmarshal(createWorkshopCommand)) |
| 18 | data, err := workshopService.CreateWorkshop(ParseOperateInfo(controller.BaseController), createWorkshopCommand) | 18 | data, err := workshopService.CreateWorkshop(ParseOperateInfo(controller.BaseController), createWorkshopCommand) |
| 19 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| 20 | } | 20 | } |
| @@ -22,7 +22,7 @@ func (controller *WorkshopController) CreateWorkshop() { | @@ -22,7 +22,7 @@ func (controller *WorkshopController) CreateWorkshop() { | ||
| 22 | func (controller *WorkshopController) UpdateWorkshop() { | 22 | func (controller *WorkshopController) UpdateWorkshop() { |
| 23 | workshopService := service.NewWorkshopService(nil) | 23 | workshopService := service.NewWorkshopService(nil) |
| 24 | updateWorkshopCommand := &command.UpdateWorkshopCommand{} | 24 | updateWorkshopCommand := &command.UpdateWorkshopCommand{} |
| 25 | - controller.Unmarshal(updateWorkshopCommand) | 25 | + Must(controller.Unmarshal(updateWorkshopCommand)) |
| 26 | workshopId, _ := controller.GetInt(":workshopId") | 26 | workshopId, _ := controller.GetInt(":workshopId") |
| 27 | updateWorkshopCommand.WorkshopId = workshopId | 27 | updateWorkshopCommand.WorkshopId = workshopId |
| 28 | data, err := workshopService.UpdateWorkshop(updateWorkshopCommand) | 28 | data, err := workshopService.UpdateWorkshop(updateWorkshopCommand) |
| @@ -62,7 +62,7 @@ func (controller *WorkshopController) ListWorkshop() { | @@ -62,7 +62,7 @@ func (controller *WorkshopController) ListWorkshop() { | ||
| 62 | func (controller *WorkshopController) SearchWorkshop() { | 62 | func (controller *WorkshopController) SearchWorkshop() { |
| 63 | workshopService := service.NewWorkshopService(nil) | 63 | workshopService := service.NewWorkshopService(nil) |
| 64 | listWorkshopQuery := &query.SearchWorkshopQuery{} | 64 | listWorkshopQuery := &query.SearchWorkshopQuery{} |
| 65 | - controller.Unmarshal(listWorkshopQuery) | 65 | + Must(controller.Unmarshal(listWorkshopQuery)) |
| 66 | data, err := workshopService.SearchWorkshop(ParseOperateInfo(controller.BaseController), listWorkshopQuery) | 66 | data, err := workshopService.SearchWorkshop(ParseOperateInfo(controller.BaseController), listWorkshopQuery) |
| 67 | controller.Response(data, err) | 67 | controller.Response(data, err) |
| 68 | } | 68 | } |
| @@ -70,7 +70,7 @@ func (controller *WorkshopController) SearchWorkshop() { | @@ -70,7 +70,7 @@ func (controller *WorkshopController) SearchWorkshop() { | ||
| 70 | func (controller *WorkshopController) SelectorWorkshop() { | 70 | func (controller *WorkshopController) SelectorWorkshop() { |
| 71 | workshopService := service.NewWorkshopService(nil) | 71 | workshopService := service.NewWorkshopService(nil) |
| 72 | listWorkshopQuery := &query.SearchWorkshopQuery{} | 72 | listWorkshopQuery := &query.SearchWorkshopQuery{} |
| 73 | - controller.Unmarshal(listWorkshopQuery) | 73 | + Must(controller.Unmarshal(listWorkshopQuery)) |
| 74 | data, err := workshopService.SearchWorkshop(ParseOperateInfo(controller.BaseController), listWorkshopQuery) | 74 | data, err := workshopService.SearchWorkshop(ParseOperateInfo(controller.BaseController), listWorkshopQuery) |
| 75 | controller.Response(data, err) | 75 | controller.Response(data, err) |
| 76 | } | 76 | } |
| @@ -10,6 +10,7 @@ func init() { | @@ -10,6 +10,7 @@ func init() { | ||
| 10 | web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Put:UpdateDevice") | 10 | web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Put:UpdateDevice") |
| 11 | web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Get:GetDevice") | 11 | web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Get:GetDevice") |
| 12 | web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Delete:RemoveDevice") | 12 | web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Delete:RemoveDevice") |
| 13 | + web.Router("/devices/batch-remove", &controllers.DeviceController{}, "Post:BatchRemoveDevice") | ||
| 13 | web.Router("/devices/", &controllers.DeviceController{}, "Get:ListDevice") | 14 | web.Router("/devices/", &controllers.DeviceController{}, "Get:ListDevice") |
| 14 | web.Router("/devices/search", &controllers.DeviceController{}, "Post:SearchDevice") | 15 | web.Router("/devices/search", &controllers.DeviceController{}, "Post:SearchDevice") |
| 15 | web.Router("/devices/batch-add", &controllers.DeviceController{}, "Post:BatchAddDevice") | 16 | web.Router("/devices/batch-add", &controllers.DeviceController{}, "Post:BatchAddDevice") |
| @@ -10,6 +10,7 @@ func init() { | @@ -10,6 +10,7 @@ func init() { | ||
| 10 | web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Put:UpdateProductCalendar") | 10 | web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Put:UpdateProductCalendar") |
| 11 | web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Get:GetProductCalendar") | 11 | web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Get:GetProductCalendar") |
| 12 | web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Delete:RemoveProductCalendar") | 12 | web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Delete:RemoveProductCalendar") |
| 13 | + web.Router("/product-calendars/batch-remove", &controllers.ProductCalendarController{}, "Post:BatchRemoveProductCalendar") | ||
| 13 | web.Router("/product-calendars/", &controllers.ProductCalendarController{}, "Get:ListProductCalendar") | 14 | web.Router("/product-calendars/", &controllers.ProductCalendarController{}, "Get:ListProductCalendar") |
| 14 | 15 | ||
| 15 | web.Router("/product-calendars/search", &controllers.ProductCalendarController{}, "Post:SearchProductCalendar") | 16 | web.Router("/product-calendars/search", &controllers.ProductCalendarController{}, "Post:SearchProductCalendar") |
| @@ -10,6 +10,7 @@ func init() { | @@ -10,6 +10,7 @@ func init() { | ||
| 10 | web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Put:UpdateProductGroup") | 10 | web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Put:UpdateProductGroup") |
| 11 | web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Get:GetProductGroup") | 11 | web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Get:GetProductGroup") |
| 12 | web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Delete:RemoveProductGroup") | 12 | web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Delete:RemoveProductGroup") |
| 13 | + web.Router("/product-groups/batch-remove", &controllers.ProductGroupController{}, "Post:BatchRemoveProductGroup") | ||
| 13 | web.Router("/product-groups/", &controllers.ProductGroupController{}, "Get:ListProductGroup") | 14 | web.Router("/product-groups/", &controllers.ProductGroupController{}, "Get:ListProductGroup") |
| 14 | web.Router("/product-groups/search", &controllers.ProductGroupController{}, "Post:SearchProductGroup") | 15 | web.Router("/product-groups/search", &controllers.ProductGroupController{}, "Post:SearchProductGroup") |
| 15 | } | 16 | } |
| @@ -10,6 +10,7 @@ func init() { | @@ -10,6 +10,7 @@ func init() { | ||
| 10 | web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Put:UpdateProductJob") | 10 | web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Put:UpdateProductJob") |
| 11 | web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Get:GetProductJob") | 11 | web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Get:GetProductJob") |
| 12 | web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Delete:RemoveProductJob") | 12 | web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Delete:RemoveProductJob") |
| 13 | + web.Router("/product-jobs/batch-remove", &controllers.ProductJobController{}, "Post:BatchRemoveProductJob") | ||
| 13 | web.Router("/product-jobs/", &controllers.ProductJobController{}, "Get:ListProductJob") | 14 | web.Router("/product-jobs/", &controllers.ProductJobController{}, "Get:ListProductJob") |
| 14 | web.Router("/product-jobs/search", &controllers.ProductJobController{}, "Post:SearchProductJob") | 15 | web.Router("/product-jobs/search", &controllers.ProductJobController{}, "Post:SearchProductJob") |
| 15 | } | 16 | } |
| @@ -10,6 +10,7 @@ func init() { | @@ -10,6 +10,7 @@ func init() { | ||
| 10 | web.Router("/products/:productId", &controllers.ProductController{}, "Put:UpdateProduct") | 10 | web.Router("/products/:productId", &controllers.ProductController{}, "Put:UpdateProduct") |
| 11 | web.Router("/products/:productId", &controllers.ProductController{}, "Get:GetProduct") | 11 | web.Router("/products/:productId", &controllers.ProductController{}, "Get:GetProduct") |
| 12 | web.Router("/products/:productId", &controllers.ProductController{}, "Delete:RemoveProduct") | 12 | web.Router("/products/:productId", &controllers.ProductController{}, "Delete:RemoveProduct") |
| 13 | + web.Router("/products/batch-remove", &controllers.ProductController{}, "Post:BatchRemoveProduct") | ||
| 13 | web.Router("/products/", &controllers.ProductController{}, "Get:ListProduct") | 14 | web.Router("/products/", &controllers.ProductController{}, "Get:ListProduct") |
| 14 | web.Router("/products/search", &controllers.ProductController{}, "Post:SearchProduct") | 15 | web.Router("/products/search", &controllers.ProductController{}, "Post:SearchProduct") |
| 15 | web.Router("/products/batch-add", &controllers.ProductController{}, "Post:BatchAddProduct") | 16 | web.Router("/products/batch-add", &controllers.ProductController{}, "Post:BatchAddProduct") |
| @@ -10,6 +10,7 @@ func init() { | @@ -10,6 +10,7 @@ func init() { | ||
| 10 | web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Put:UpdateUnitConversion") | 10 | web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Put:UpdateUnitConversion") |
| 11 | web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Get:GetUnitConversion") | 11 | web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Get:GetUnitConversion") |
| 12 | web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Delete:RemoveUnitConversion") | 12 | web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Delete:RemoveUnitConversion") |
| 13 | + web.Router("/unit-conversions/batch-remove", &controllers.UnitConversionController{}, "Post:BatchRemoveUnitConversion") | ||
| 13 | web.Router("/unit-conversions/", &controllers.UnitConversionController{}, "Get:ListUnitConversion") | 14 | web.Router("/unit-conversions/", &controllers.UnitConversionController{}, "Get:ListUnitConversion") |
| 14 | web.Router("/unit-conversions/search", &controllers.UnitConversionController{}, "Post:SearchUnitConversion") | 15 | web.Router("/unit-conversions/search", &controllers.UnitConversionController{}, "Post:SearchUnitConversion") |
| 15 | } | 16 | } |
-
请 注册 或 登录 后发表评论