正在显示
32 个修改的文件
包含
132 行增加
和
41 行删除
| @@ -17,7 +17,9 @@ type SearchDeviceQuery struct { | @@ -17,7 +17,9 @@ type SearchDeviceQuery struct { | ||
| 17 | // 当前公司 | 17 | // 当前公司 |
| 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` |
| 19 | // 当前登录的组织 | 19 | // 当前登录的组织 |
| 20 | - OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" valid:"Required"` | 20 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` |
| 21 | + // 匹配多个组织 | ||
| 22 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" valid:"Required"` | ||
| 21 | // 页码 | 23 | // 页码 |
| 22 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
| 23 | // 页数 | 25 | // 页数 |
| @@ -316,8 +316,6 @@ func (deviceService *DeviceService) UpdateDevice(cmd *command.UpdateDeviceComman | @@ -316,8 +316,6 @@ func (deviceService *DeviceService) UpdateDevice(cmd *command.UpdateDeviceComman | ||
| 316 | 316 | ||
| 317 | // 返回设备服务列表 | 317 | // 返回设备服务列表 |
| 318 | func (deviceService *DeviceService) SearchDevice(operateInfo *domain.OperateInfo, listDeviceQuery *query.SearchDeviceQuery) (int64, interface{}, error) { | 318 | func (deviceService *DeviceService) SearchDevice(operateInfo *domain.OperateInfo, listDeviceQuery *query.SearchDeviceQuery) (int64, interface{}, error) { |
| 319 | - listDeviceQuery.OrgId = operateInfo.OrgId | ||
| 320 | - listDeviceQuery.CompanyId = operateInfo.CompanyId | ||
| 321 | if err := listDeviceQuery.ValidateQuery(); err != nil { | 319 | if err := listDeviceQuery.ValidateQuery(); err != nil { |
| 322 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 320 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 323 | } | 321 | } |
| @@ -17,7 +17,9 @@ type SearchProductQuery struct { | @@ -17,7 +17,9 @@ type SearchProductQuery struct { | ||
| 17 | // 当前公司 | 17 | // 当前公司 |
| 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` |
| 19 | // 当前登录的组织 | 19 | // 当前登录的组织 |
| 20 | - OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" valid:"Required"` | 20 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` |
| 21 | + // 匹配多个组织 | ||
| 22 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" valid:"Required"` | ||
| 21 | // 页码 | 23 | // 页码 |
| 22 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
| 23 | // 页数 | 25 | // 页数 |
| @@ -298,8 +298,6 @@ func (productService *ProductService) UpdateProduct(updateProductCommand *comman | @@ -298,8 +298,6 @@ func (productService *ProductService) UpdateProduct(updateProductCommand *comman | ||
| 298 | 298 | ||
| 299 | // 返回产品服务列表 | 299 | // 返回产品服务列表 |
| 300 | func (productService *ProductService) SearchProduct(operateInfo *domain.OperateInfo, listProductQuery *query.SearchProductQuery) (int64, interface{}, error) { | 300 | func (productService *ProductService) SearchProduct(operateInfo *domain.OperateInfo, listProductQuery *query.SearchProductQuery) (int64, interface{}, error) { |
| 301 | - listProductQuery.OrgId = operateInfo.OrgId | ||
| 302 | - listProductQuery.CompanyId = operateInfo.CompanyId | ||
| 303 | if err := listProductQuery.ValidateQuery(); err != nil { | 301 | if err := listProductQuery.ValidateQuery(); err != nil { |
| 304 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 302 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 305 | } | 303 | } |
| @@ -17,7 +17,9 @@ type SearchProductCalendarQuery struct { | @@ -17,7 +17,9 @@ type SearchProductCalendarQuery struct { | ||
| 17 | // 当前公司 | 17 | // 当前公司 |
| 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` |
| 19 | // 当前登录的组织 | 19 | // 当前登录的组织 |
| 20 | - OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" valid:"Required"` | 20 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` |
| 21 | + // 匹配多个组织 | ||
| 22 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" valid:"Required"` | ||
| 21 | // 页码 | 23 | // 页码 |
| 22 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
| 23 | // 页数 | 25 | // 页数 |
| @@ -323,8 +323,6 @@ func (productCalendarService *ProductCalendarService) UpdateProductCalendar(cmd | @@ -323,8 +323,6 @@ func (productCalendarService *ProductCalendarService) UpdateProductCalendar(cmd | ||
| 323 | 323 | ||
| 324 | // 返回工厂日历服务列表 | 324 | // 返回工厂日历服务列表 |
| 325 | func (productCalendarService *ProductCalendarService) SearchProductCalendar(operateInfo *domain.OperateInfo, listProductCalendarQuery *query.SearchProductCalendarQuery) (int64, interface{}, error) { | 325 | func (productCalendarService *ProductCalendarService) SearchProductCalendar(operateInfo *domain.OperateInfo, listProductCalendarQuery *query.SearchProductCalendarQuery) (int64, interface{}, error) { |
| 326 | - listProductCalendarQuery.OrgId = operateInfo.OrgId | ||
| 327 | - listProductCalendarQuery.CompanyId = operateInfo.CompanyId | ||
| 328 | if err := listProductCalendarQuery.ValidateQuery(); err != nil { | 326 | if err := listProductCalendarQuery.ValidateQuery(); err != nil { |
| 329 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 327 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 330 | } | 328 | } |
| @@ -16,7 +16,9 @@ type SearchProductGroupQuery struct { | @@ -16,7 +16,9 @@ type SearchProductGroupQuery struct { | ||
| 16 | // 当前公司 | 16 | // 当前公司 |
| 17 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | 17 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` |
| 18 | // 当前登录的组织 | 18 | // 当前登录的组织 |
| 19 | - OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" valid:"Required"` | 19 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` |
| 20 | + // 匹配多个组织 | ||
| 21 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" valid:"Required"` | ||
| 20 | // 页码 | 22 | // 页码 |
| 21 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 23 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
| 22 | // 页数 | 24 | // 页数 |
| @@ -324,8 +324,6 @@ func (productGroupService *ProductGroupService) UpdateProductGroup(cmd *command. | @@ -324,8 +324,6 @@ func (productGroupService *ProductGroupService) UpdateProductGroup(cmd *command. | ||
| 324 | 324 | ||
| 325 | // 返回生产班组服务列表 | 325 | // 返回生产班组服务列表 |
| 326 | func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo *domain.OperateInfo, q *query.SearchProductGroupQuery) (int64, interface{}, error) { | 326 | func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo *domain.OperateInfo, q *query.SearchProductGroupQuery) (int64, interface{}, error) { |
| 327 | - q.OrgId = operateInfo.OrgId | ||
| 328 | - q.CompanyId = operateInfo.CompanyId | ||
| 329 | if err := q.ValidateQuery(); err != nil { | 327 | if err := q.ValidateQuery(); err != nil { |
| 330 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 328 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 331 | } | 329 | } |
| @@ -26,11 +26,19 @@ type ProductJobDto struct { | @@ -26,11 +26,19 @@ type ProductJobDto struct { | ||
| 26 | //// 负责人 (用户对象) | 26 | //// 负责人 (用户对象) |
| 27 | //Principal *domain.User `json:"principal,omitempty"` | 27 | //Principal *domain.User `json:"principal,omitempty"` |
| 28 | *domain.WorkStation | 28 | *domain.WorkStation |
| 29 | + // 组织名称 | ||
| 30 | + //OrgName string `json:"orgName"` | ||
| 31 | + // 权限标识 (当前登录组织匹配为true,否则false) | ||
| 32 | + //AuthFlag bool `json:"authFlag"` | ||
| 29 | } | 33 | } |
| 30 | 34 | ||
| 31 | -func (m *ProductJobDto) LoadDto(job *domain.ProductJob) { | ||
| 32 | - m.ProductJobId = job.ProductJobId | ||
| 33 | - m.JobName = job.JobName | ||
| 34 | - m.ProcessName = job.ProcessName | ||
| 35 | - m.WorkStation = job.WorkStation | 35 | +func (d *ProductJobDto) LoadDto(job *domain.ProductJob, orgId int) { |
| 36 | + d.ProductJobId = job.ProductJobId | ||
| 37 | + d.JobName = job.JobName | ||
| 38 | + d.ProcessName = job.ProcessName | ||
| 39 | + d.WorkStation = job.WorkStation | ||
| 40 | + //d.AuthFlag = domain.CheckOrgAuth(orgId, job.OrgId) | ||
| 41 | + //if job.Ext != nil { | ||
| 42 | + // d.OrgName = job.Ext.OrgName | ||
| 43 | + //} | ||
| 36 | } | 44 | } |
| @@ -17,7 +17,9 @@ type SearchProductJobQuery struct { | @@ -17,7 +17,9 @@ type SearchProductJobQuery struct { | ||
| 17 | // 当前公司 | 17 | // 当前公司 |
| 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` |
| 19 | // 当前登录的组织 | 19 | // 当前登录的组织 |
| 20 | - OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" valid:"Required"` | 20 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" ` |
| 21 | + // 匹配多个组织 | ||
| 22 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" ` | ||
| 21 | // 页码 | 23 | // 页码 |
| 22 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
| 23 | // 页数 | 25 | // 页数 |
| @@ -95,7 +95,7 @@ func (productJobService *ProductJobService) GetProductJob(getProductJobQuery *qu | @@ -95,7 +95,7 @@ func (productJobService *ProductJobService) GetProductJob(getProductJobQuery *qu | ||
| 95 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 95 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 96 | } | 96 | } |
| 97 | newJobDto := &dto.ProductJobDto{} | 97 | newJobDto := &dto.ProductJobDto{} |
| 98 | - newJobDto.LoadDto(productJob) | 98 | + newJobDto.LoadDto(productJob, 0) |
| 99 | return newJobDto, nil | 99 | return newJobDto, nil |
| 100 | } | 100 | } |
| 101 | 101 | ||
| @@ -280,8 +280,6 @@ func (productJobService *ProductJobService) UpdateProductJob(cmd *command.Update | @@ -280,8 +280,6 @@ func (productJobService *ProductJobService) UpdateProductJob(cmd *command.Update | ||
| 280 | 280 | ||
| 281 | // 搜索工位服务列表 | 281 | // 搜索工位服务列表 |
| 282 | func (productJobService *ProductJobService) SearchProductJob(operateInfo *domain.OperateInfo, listProductJobQuery *query.SearchProductJobQuery) (int64, interface{}, error) { | 282 | func (productJobService *ProductJobService) SearchProductJob(operateInfo *domain.OperateInfo, listProductJobQuery *query.SearchProductJobQuery) (int64, interface{}, error) { |
| 283 | - listProductJobQuery.OrgId = operateInfo.OrgId | ||
| 284 | - listProductJobQuery.CompanyId = operateInfo.CompanyId | ||
| 285 | if err := listProductJobQuery.ValidateQuery(); err != nil { | 283 | if err := listProductJobQuery.ValidateQuery(); err != nil { |
| 286 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 284 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 287 | } | 285 | } |
| @@ -312,7 +310,7 @@ func (productJobService *ProductJobService) SearchProductJob(operateInfo *domain | @@ -312,7 +310,7 @@ func (productJobService *ProductJobService) SearchProductJob(operateInfo *domain | ||
| 312 | for i := range productJobs { | 310 | for i := range productJobs { |
| 313 | item := productJobs[i] | 311 | item := productJobs[i] |
| 314 | newJobDto := &dto.ProductJobDto{} | 312 | newJobDto := &dto.ProductJobDto{} |
| 315 | - newJobDto.LoadDto(item) | 313 | + newJobDto.LoadDto(item, operateInfo.OrgId) |
| 316 | result = append(result, newJobDto) | 314 | result = append(result, newJobDto) |
| 317 | } | 315 | } |
| 318 | return count, result, nil | 316 | return count, result, nil |
| @@ -17,7 +17,9 @@ type SearchUnitConversionQuery struct { | @@ -17,7 +17,9 @@ type SearchUnitConversionQuery struct { | ||
| 17 | // 当前公司 | 17 | // 当前公司 |
| 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` | 18 | CompanyId int `cname:"当前公司" json:"companyId,omitempty" valid:"Required"` |
| 19 | // 当前登录的组织 | 19 | // 当前登录的组织 |
| 20 | - OrgId int `cname:"当前登录的组织" json:"orgId,omitempty" valid:"Required"` | 20 | + OrgId int `cname:"当前登录的组织" json:"orgId,omitempty"` |
| 21 | + // 匹配多个组织 | ||
| 22 | + InOrgIds []int `cname:"匹配多个组织" json:"inOrgIds,omitempty" valid:"Required"` | ||
| 21 | // 页码 | 23 | // 页码 |
| 22 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` | 24 | PageNumber int `cname:"页码" json:"pageNumber,omitempty"` |
| 23 | // 页数 | 25 | // 页数 |
| @@ -275,8 +275,6 @@ func (unitConversionService *UnitConversionService) UpdateUnitConversion(cmd *co | @@ -275,8 +275,6 @@ func (unitConversionService *UnitConversionService) UpdateUnitConversion(cmd *co | ||
| 275 | 275 | ||
| 276 | // 返回单位换算服务列表 | 276 | // 返回单位换算服务列表 |
| 277 | func (unitConversionService *UnitConversionService) SearchUnitConversion(operateInfo *domain.OperateInfo, listUnitConversionQuery *query.SearchUnitConversionQuery) (int64, interface{}, error) { | 277 | func (unitConversionService *UnitConversionService) SearchUnitConversion(operateInfo *domain.OperateInfo, listUnitConversionQuery *query.SearchUnitConversionQuery) (int64, interface{}, error) { |
| 278 | - listUnitConversionQuery.OrgId = operateInfo.OrgId | ||
| 279 | - listUnitConversionQuery.CompanyId = operateInfo.CompanyId | ||
| 280 | if err := listUnitConversionQuery.ValidateQuery(); err != nil { | 278 | if err := listUnitConversionQuery.ValidateQuery(); err != nil { |
| 281 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 279 | return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 282 | } | 280 | } |
| @@ -31,6 +31,7 @@ const CUSTOMER_ACCOUNT_DELIMITER = "," | @@ -31,6 +31,7 @@ const CUSTOMER_ACCOUNT_DELIMITER = "," | ||
| 31 | const HeaderCompanyId = "companyId" | 31 | const HeaderCompanyId = "companyId" |
| 32 | const HeaderUserId = "userId" | 32 | const HeaderUserId = "userId" |
| 33 | const HeaderOrgId = "orgId" | 33 | const HeaderOrgId = "orgId" |
| 34 | +const HeaderOrgIds = "orgIds" | ||
| 34 | 35 | ||
| 35 | func init() { | 36 | func init() { |
| 36 | if os.Getenv("LOG_LEVEL") != "" { | 37 | if os.Getenv("LOG_LEVEL") != "" { |
| @@ -46,6 +46,8 @@ type OperateInfo struct { | @@ -46,6 +46,8 @@ type OperateInfo struct { | ||
| 46 | OrgId int | 46 | OrgId int |
| 47 | // 菜单模块 | 47 | // 菜单模块 |
| 48 | MenuCode string | 48 | MenuCode string |
| 49 | + // 匹配多个组织 | ||
| 50 | + OrgIds []int | ||
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | func NewCheckOptions(optUser, org int) OperateInfo { | 53 | func NewCheckOptions(optUser, org int) OperateInfo { |
| @@ -143,6 +143,9 @@ func (repository *DeviceRepository) FindOne(queryOptions map[string]interface{}) | @@ -143,6 +143,9 @@ func (repository *DeviceRepository) FindOne(queryOptions map[string]interface{}) | ||
| 143 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 143 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 144 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 144 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 145 | query.SetWhereByQueryOption("device_code = ?", "deviceCode") | 145 | query.SetWhereByQueryOption("device_code = ?", "deviceCode") |
| 146 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 147 | + query.AllWithDeleted() | ||
| 148 | + } | ||
| 146 | if err := query.First(); err != nil { | 149 | if err := query.First(); err != nil { |
| 147 | if err.Error() == "pg: no rows in result set" { | 150 | if err.Error() == "pg: no rows in result set" { |
| 148 | return nil, fmt.Errorf("没有此资源") | 151 | return nil, fmt.Errorf("没有此资源") |
| @@ -165,6 +168,9 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i | @@ -165,6 +168,9 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i | ||
| 165 | query.SetOrderDirect("device_id", "DESC") | 168 | query.SetOrderDirect("device_id", "DESC") |
| 166 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 169 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 167 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 170 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 171 | + if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | ||
| 172 | + query.Where(`org_id in (?)`, pg.In(v)) | ||
| 173 | + } | ||
| 168 | query.SetWhereByQueryOption("device_code = ?", "deviceCode") | 174 | query.SetWhereByQueryOption("device_code = ?", "deviceCode") |
| 169 | query.SetWhereByQueryOption("device_status = ?", "deviceStatus") | 175 | query.SetWhereByQueryOption("device_status = ?", "deviceStatus") |
| 170 | if v, ok := queryOptions["deviceName"]; ok && len(v.(string)) > 0 { | 176 | if v, ok := queryOptions["deviceName"]; ok && len(v.(string)) > 0 { |
| @@ -148,6 +148,9 @@ func (repository *ProductAttendanceRecordRepository) FindOne(queryOptions map[st | @@ -148,6 +148,9 @@ func (repository *ProductAttendanceRecordRepository) FindOne(queryOptions map[st | ||
| 148 | productAttendanceRecordModel := new(models.ProductAttendanceRecord) | 148 | productAttendanceRecordModel := new(models.ProductAttendanceRecord) |
| 149 | query := sqlbuilder.BuildQuery(tx.Model(productAttendanceRecordModel), queryOptions) | 149 | query := sqlbuilder.BuildQuery(tx.Model(productAttendanceRecordModel), queryOptions) |
| 150 | query.SetWhereByQueryOption("product_attendance_record.product_attendance_record_id = ?", "productAttendanceRecordId") | 150 | query.SetWhereByQueryOption("product_attendance_record.product_attendance_record_id = ?", "productAttendanceRecordId") |
| 151 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 152 | + query.AllWithDeleted() | ||
| 153 | + } | ||
| 151 | if err := query.First(); err != nil { | 154 | if err := query.First(); err != nil { |
| 152 | if err.Error() == "pg: no rows in result set" { | 155 | if err.Error() == "pg: no rows in result set" { |
| 153 | return nil, fmt.Errorf("没有此资源") | 156 | return nil, fmt.Errorf("没有此资源") |
| @@ -133,6 +133,9 @@ func (repository *ProductCalendarRepository) FindOne(queryOptions map[string]int | @@ -133,6 +133,9 @@ func (repository *ProductCalendarRepository) FindOne(queryOptions map[string]int | ||
| 133 | productCalendarModel := new(models.ProductCalendar) | 133 | productCalendarModel := new(models.ProductCalendar) |
| 134 | query := sqlbuilder.BuildQuery(tx.Model(productCalendarModel), queryOptions) | 134 | query := sqlbuilder.BuildQuery(tx.Model(productCalendarModel), queryOptions) |
| 135 | query.SetWhereByQueryOption("product_calendar.product_calendar_id = ?", "productCalendarId") | 135 | query.SetWhereByQueryOption("product_calendar.product_calendar_id = ?", "productCalendarId") |
| 136 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 137 | + query.AllWithDeleted() | ||
| 138 | + } | ||
| 136 | if err := query.First(); err != nil { | 139 | if err := query.First(); err != nil { |
| 137 | if err.Error() == "pg: no rows in result set" { | 140 | if err.Error() == "pg: no rows in result set" { |
| 138 | return nil, fmt.Errorf("没有此资源") | 141 | return nil, fmt.Errorf("没有此资源") |
| @@ -153,6 +156,9 @@ func (repository *ProductCalendarRepository) Find(queryOptions map[string]interf | @@ -153,6 +156,9 @@ func (repository *ProductCalendarRepository) Find(queryOptions map[string]interf | ||
| 153 | query := sqlbuilder.BuildQuery(tx.Model(&productCalendarModels), queryOptions) | 156 | query := sqlbuilder.BuildQuery(tx.Model(&productCalendarModels), queryOptions) |
| 154 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 157 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 155 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 158 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 159 | + if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | ||
| 160 | + query.Where(`org_id in (?)`, pg.In(v)) | ||
| 161 | + } | ||
| 156 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") | 162 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") |
| 157 | query.SetWhereByQueryOption("work_on & ? >0", "workOn") | 163 | query.SetWhereByQueryOption("work_on & ? >0", "workOn") |
| 158 | if v, ok := queryOptions["workshopName"]; ok && len(v.(string)) > 0 { | 164 | if v, ok := queryOptions["workshopName"]; ok && len(v.(string)) > 0 { |
| @@ -127,7 +127,9 @@ func (repository *ProductGroupRepository) FindOne(queryOptions map[string]interf | @@ -127,7 +127,9 @@ func (repository *ProductGroupRepository) FindOne(queryOptions map[string]interf | ||
| 127 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") | 127 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") |
| 128 | query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") | 128 | query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") |
| 129 | query.SetWhereByQueryOption("work_station->>'lineId'='?'", "lineId") | 129 | query.SetWhereByQueryOption("work_station->>'lineId'='?'", "lineId") |
| 130 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 130 | query.AllWithDeleted() | 131 | query.AllWithDeleted() |
| 132 | + } | ||
| 131 | if err := query.First(); err != nil { | 133 | if err := query.First(); err != nil { |
| 132 | if err.Error() == "pg: no rows in result set" { | 134 | if err.Error() == "pg: no rows in result set" { |
| 133 | return nil, fmt.Errorf("没有此资源") | 135 | return nil, fmt.Errorf("没有此资源") |
| @@ -146,6 +148,11 @@ func (repository *ProductGroupRepository) Find(queryOptions map[string]interface | @@ -146,6 +148,11 @@ func (repository *ProductGroupRepository) Find(queryOptions map[string]interface | ||
| 146 | var productGroupModels []*models.ProductGroup | 148 | var productGroupModels []*models.ProductGroup |
| 147 | productGroups := make([]*domain.ProductGroup, 0) | 149 | productGroups := make([]*domain.ProductGroup, 0) |
| 148 | query := sqlbuilder.BuildQuery(tx.Model(&productGroupModels), queryOptions) | 150 | query := sqlbuilder.BuildQuery(tx.Model(&productGroupModels), queryOptions) |
| 151 | + query.SetWhereByQueryOption("company_id = ?", "companyId") | ||
| 152 | + query.SetWhereByQueryOption("org_id = ?", "orgId") | ||
| 153 | + if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | ||
| 154 | + query.Where(`org_id in (?)`, pg.In(v)) | ||
| 155 | + } | ||
| 149 | query.SetOffsetAndLimit(20) | 156 | query.SetOffsetAndLimit(20) |
| 150 | query.SetOrderDirect("product_group_id", "DESC") | 157 | query.SetOrderDirect("product_group_id", "DESC") |
| 151 | if count, err := query.SelectAndCount(); err != nil { | 158 | if count, err := query.SelectAndCount(); err != nil { |
| @@ -122,7 +122,9 @@ func (repository *ProductJobRepository) FindOne(queryOptions map[string]interfac | @@ -122,7 +122,9 @@ func (repository *ProductJobRepository) FindOne(queryOptions map[string]interfac | ||
| 122 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 122 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 123 | query.SetWhereByQueryOption("job_name=?", "jobName") | 123 | query.SetWhereByQueryOption("job_name=?", "jobName") |
| 124 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") | 124 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") |
| 125 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 125 | query.AllWithDeleted() | 126 | query.AllWithDeleted() |
| 127 | + } | ||
| 126 | if err := query.First(); err != nil { | 128 | if err := query.First(); err != nil { |
| 127 | if err.Error() == "pg: no rows in result set" { | 129 | if err.Error() == "pg: no rows in result set" { |
| 128 | return nil, fmt.Errorf("没有此资源") | 130 | return nil, fmt.Errorf("没有此资源") |
| @@ -144,6 +146,9 @@ func (repository *ProductJobRepository) Find(queryOptions map[string]interface{} | @@ -144,6 +146,9 @@ func (repository *ProductJobRepository) Find(queryOptions map[string]interface{} | ||
| 144 | 146 | ||
| 145 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 147 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 146 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 148 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 149 | + if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | ||
| 150 | + query.Where(`org_id in (?)`, pg.In(v)) | ||
| 151 | + } | ||
| 147 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") | 152 | query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId") |
| 148 | 153 | ||
| 149 | query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") | 154 | query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId") |
| @@ -158,6 +158,9 @@ func (repository *ProductPlanRepository) FindOne(queryOptions map[string]interfa | @@ -158,6 +158,9 @@ func (repository *ProductPlanRepository) FindOne(queryOptions map[string]interfa | ||
| 158 | productPlanModel := new(models.ProductPlan) | 158 | productPlanModel := new(models.ProductPlan) |
| 159 | query := sqlbuilder.BuildQuery(tx.Model(productPlanModel), queryOptions) | 159 | query := sqlbuilder.BuildQuery(tx.Model(productPlanModel), queryOptions) |
| 160 | query.SetWhereByQueryOption("product_plan.product_plan_id = ?", "productPlanId") | 160 | query.SetWhereByQueryOption("product_plan.product_plan_id = ?", "productPlanId") |
| 161 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 162 | + query.AllWithDeleted() | ||
| 163 | + } | ||
| 161 | if err := query.First(); err != nil { | 164 | if err := query.First(); err != nil { |
| 162 | if err.Error() == "pg: no rows in result set" { | 165 | if err.Error() == "pg: no rows in result set" { |
| 163 | return nil, fmt.Errorf("没有此资源") | 166 | return nil, fmt.Errorf("没有此资源") |
| @@ -128,6 +128,9 @@ func (repository *ProductRecordRepository) FindOne(queryOptions map[string]inter | @@ -128,6 +128,9 @@ func (repository *ProductRecordRepository) FindOne(queryOptions map[string]inter | ||
| 128 | productRecordModel := new(models.ProductRecord) | 128 | productRecordModel := new(models.ProductRecord) |
| 129 | query := sqlbuilder.BuildQuery(tx.Model(productRecordModel), queryOptions) | 129 | query := sqlbuilder.BuildQuery(tx.Model(productRecordModel), queryOptions) |
| 130 | query.SetWhereByQueryOption("product_record.product_record_id = ?", "productRecordId") | 130 | query.SetWhereByQueryOption("product_record.product_record_id = ?", "productRecordId") |
| 131 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 132 | + query.AllWithDeleted() | ||
| 133 | + } | ||
| 131 | if err := query.First(); err != nil { | 134 | if err := query.First(); err != nil { |
| 132 | if err.Error() == "pg: no rows in result set" { | 135 | if err.Error() == "pg: no rows in result set" { |
| 133 | return nil, fmt.Errorf("没有此资源") | 136 | return nil, fmt.Errorf("没有此资源") |
| @@ -125,7 +125,9 @@ func (repository *ProductRepository) FindOne(queryOptions map[string]interface{} | @@ -125,7 +125,9 @@ func (repository *ProductRepository) FindOne(queryOptions map[string]interface{} | ||
| 125 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 125 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 126 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 126 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 127 | query.SetWhereByQueryOption("product_code = ?", "productCode") | 127 | query.SetWhereByQueryOption("product_code = ?", "productCode") |
| 128 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 128 | query.AllWithDeleted() | 129 | query.AllWithDeleted() |
| 130 | + } | ||
| 129 | if err := query.First(); err != nil { | 131 | if err := query.First(); err != nil { |
| 130 | if err.Error() == "pg: no rows in result set" { | 132 | if err.Error() == "pg: no rows in result set" { |
| 131 | return nil, fmt.Errorf("没有此资源") | 133 | return nil, fmt.Errorf("没有此资源") |
| @@ -146,6 +148,9 @@ func (repository *ProductRepository) Find(queryOptions map[string]interface{}) ( | @@ -146,6 +148,9 @@ func (repository *ProductRepository) Find(queryOptions map[string]interface{}) ( | ||
| 146 | query := sqlbuilder.BuildQuery(tx.Model(&productModels), queryOptions) | 148 | query := sqlbuilder.BuildQuery(tx.Model(&productModels), queryOptions) |
| 147 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 149 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 148 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 150 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 151 | + if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | ||
| 152 | + query.Where(`org_id in (?)`, pg.In(v)) | ||
| 153 | + } | ||
| 149 | if v, ok := queryOptions["productName"]; ok && len(v.(string)) > 0 { | 154 | if v, ok := queryOptions["productName"]; ok && len(v.(string)) > 0 { |
| 150 | query.Where(fmt.Sprintf(`product_name like '%%%v%%'`, v)) | 155 | query.Where(fmt.Sprintf(`product_name like '%%%v%%'`, v)) |
| 151 | } | 156 | } |
| @@ -123,6 +123,9 @@ func (repository *UnitConversionRepository) FindOne(queryOptions map[string]inte | @@ -123,6 +123,9 @@ func (repository *UnitConversionRepository) FindOne(queryOptions map[string]inte | ||
| 123 | unitConversionModel := new(models.UnitConversion) | 123 | unitConversionModel := new(models.UnitConversion) |
| 124 | query := sqlbuilder.BuildQuery(tx.Model(unitConversionModel), queryOptions) | 124 | query := sqlbuilder.BuildQuery(tx.Model(unitConversionModel), queryOptions) |
| 125 | query.SetWhereByQueryOption("unit_conversion.unit_conversion_id = ?", "unitConversionId") | 125 | query.SetWhereByQueryOption("unit_conversion.unit_conversion_id = ?", "unitConversionId") |
| 126 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 127 | + query.AllWithDeleted() | ||
| 128 | + } | ||
| 126 | if err := query.First(); err != nil { | 129 | if err := query.First(); err != nil { |
| 127 | if err.Error() == "pg: no rows in result set" { | 130 | if err.Error() == "pg: no rows in result set" { |
| 128 | return nil, fmt.Errorf("没有此资源") | 131 | return nil, fmt.Errorf("没有此资源") |
| @@ -143,6 +146,9 @@ func (repository *UnitConversionRepository) Find(queryOptions map[string]interfa | @@ -143,6 +146,9 @@ func (repository *UnitConversionRepository) Find(queryOptions map[string]interfa | ||
| 143 | query := sqlbuilder.BuildQuery(tx.Model(&unitConversionModels), queryOptions) | 146 | query := sqlbuilder.BuildQuery(tx.Model(&unitConversionModels), queryOptions) |
| 144 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 147 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 145 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 148 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 149 | + if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | ||
| 150 | + query.Where(`org_id in (?)`, pg.In(v)) | ||
| 151 | + } | ||
| 146 | query.SetWhereByQueryOption("intelligent_weighing_flag = ?", "intelligentWeighingFlag") | 152 | query.SetWhereByQueryOption("intelligent_weighing_flag = ?", "intelligentWeighingFlag") |
| 147 | if v, ok := queryOptions["materialName"]; ok && len(v.(string)) > 0 { | 153 | if v, ok := queryOptions["materialName"]; ok && len(v.(string)) > 0 { |
| 148 | query.Where(fmt.Sprintf(`material->>'materialName' like '%%%v%%'`, v)) | 154 | query.Where(fmt.Sprintf(`material->>'materialName' like '%%%v%%'`, v)) |
| @@ -112,11 +112,13 @@ func (repository *WorkshopRepository) FindOne(queryOptions map[string]interface{ | @@ -112,11 +112,13 @@ func (repository *WorkshopRepository) FindOne(queryOptions map[string]interface{ | ||
| 112 | tx := repository.transactionContext.PgTx | 112 | tx := repository.transactionContext.PgTx |
| 113 | workshopModel := new(models.Workshop) | 113 | workshopModel := new(models.Workshop) |
| 114 | query := sqlbuilder.BuildQuery(tx.Model(workshopModel), queryOptions) | 114 | query := sqlbuilder.BuildQuery(tx.Model(workshopModel), queryOptions) |
| 115 | - query.AllWithDeleted() | ||
| 116 | query.SetWhereByQueryOption("workshop_id = ?", "workshopId") | 115 | query.SetWhereByQueryOption("workshop_id = ?", "workshopId") |
| 117 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 116 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
| 118 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 117 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
| 119 | query.SetWhereByQueryOption("workshop_name=?", "workshopName") | 118 | query.SetWhereByQueryOption("workshop_name=?", "workshopName") |
| 119 | + if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) { | ||
| 120 | + query.AllWithDeleted() | ||
| 121 | + } | ||
| 120 | if err := query.First(); err != nil { | 122 | if err := query.First(); err != nil { |
| 121 | if err.Error() == "pg: no rows in result set" { | 123 | if err.Error() == "pg: no rows in result set" { |
| 122 | return nil, fmt.Errorf("没有此资源") | 124 | return nil, fmt.Errorf("没有此资源") |
| @@ -8,6 +8,7 @@ import ( | @@ -8,6 +8,7 @@ import ( | ||
| 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" |
| 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log" |
| 10 | "strconv" | 10 | "strconv" |
| 11 | + "strings" | ||
| 11 | ) | 12 | ) |
| 12 | 13 | ||
| 13 | func ResponseGrid(c beego.BaseController, total int64, data interface{}, err error) { | 14 | func ResponseGrid(c beego.BaseController, total int64, data interface{}, err error) { |
| @@ -45,6 +46,15 @@ func ParseOperateInfo(c beego.BaseController) *domain.OperateInfo { | @@ -45,6 +46,15 @@ func ParseOperateInfo(c beego.BaseController) *domain.OperateInfo { | ||
| 45 | opt.UserId = header(c, constant.HeaderUserId) | 46 | opt.UserId = header(c, constant.HeaderUserId) |
| 46 | opt.CompanyId = header(c, constant.HeaderCompanyId) | 47 | opt.CompanyId = header(c, constant.HeaderCompanyId) |
| 47 | opt.OrgId = header(c, constant.HeaderOrgId) | 48 | opt.OrgId = header(c, constant.HeaderOrgId) |
| 49 | + orgIdList := c.Ctx.Input.Header(constant.HeaderOrgIds) | ||
| 50 | + splitOrgIdList := strings.Split(orgIdList, constant.CUSTOMER_ACCOUNT_DELIMITER) | ||
| 51 | + for i := range splitOrgIdList { | ||
| 52 | + orgId, _ := strconv.Atoi(splitOrgIdList[i]) | ||
| 53 | + if orgId == 0 { | ||
| 54 | + continue | ||
| 55 | + } | ||
| 56 | + opt.OrgIds = append(opt.OrgIds, orgId) | ||
| 57 | + } | ||
| 48 | // 默认公司组织 | 58 | // 默认公司组织 |
| 49 | //if opt.CompanyId == 0 { | 59 | //if opt.CompanyId == 0 { |
| 50 | // opt.CompanyId = 1 | 60 | // opt.CompanyId = 1 |
| @@ -70,9 +70,13 @@ func (controller *DeviceController) ListDevice() { | @@ -70,9 +70,13 @@ func (controller *DeviceController) ListDevice() { | ||
| 70 | 70 | ||
| 71 | func (controller *DeviceController) SearchDevice() { | 71 | func (controller *DeviceController) SearchDevice() { |
| 72 | deviceService := service.NewDeviceService(nil) | 72 | deviceService := service.NewDeviceService(nil) |
| 73 | - listDeviceQuery := &query.SearchDeviceQuery{} | ||
| 74 | - Must(controller.Unmarshal(listDeviceQuery)) | ||
| 75 | - total, data, err := deviceService.SearchDevice(ParseOperateInfo(controller.BaseController), listDeviceQuery) | 73 | + cmd := &query.SearchDeviceQuery{} |
| 74 | + Must(controller.Unmarshal(cmd)) | ||
| 75 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 76 | + //cmd.OrgId = operateInfo.OrgId | ||
| 77 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 78 | + cmd.InOrgIds = operateInfo.OrgIds | ||
| 79 | + total, data, err := deviceService.SearchDevice(ParseOperateInfo(controller.BaseController), cmd) | ||
| 76 | ResponseGrid(controller.BaseController, total, data, err) | 80 | ResponseGrid(controller.BaseController, total, data, err) |
| 77 | } | 81 | } |
| 78 | 82 |
| @@ -71,6 +71,10 @@ func (controller *ProductCalendarController) SearchProductCalendar() { | @@ -71,6 +71,10 @@ func (controller *ProductCalendarController) SearchProductCalendar() { | ||
| 71 | productCalendarService := service.NewProductCalendarService(nil) | 71 | productCalendarService := service.NewProductCalendarService(nil) |
| 72 | cmd := &query.SearchProductCalendarQuery{} | 72 | cmd := &query.SearchProductCalendarQuery{} |
| 73 | Must(controller.Unmarshal(cmd)) | 73 | Must(controller.Unmarshal(cmd)) |
| 74 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 75 | + //cmd.OrgId = operateInfo.OrgId | ||
| 76 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 77 | + cmd.InOrgIds = operateInfo.OrgIds | ||
| 74 | total, data, err := productCalendarService.SearchProductCalendar(ParseOperateInfo(controller.BaseController), cmd) | 78 | total, data, err := productCalendarService.SearchProductCalendar(ParseOperateInfo(controller.BaseController), cmd) |
| 75 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
| 76 | } | 80 | } |
| @@ -73,9 +73,13 @@ func (controller *ProductController) ListProduct() { | @@ -73,9 +73,13 @@ func (controller *ProductController) ListProduct() { | ||
| 73 | 73 | ||
| 74 | func (controller *ProductController) SearchProduct() { | 74 | func (controller *ProductController) SearchProduct() { |
| 75 | productService := service.NewProductService(nil) | 75 | productService := service.NewProductService(nil) |
| 76 | - listProductQuery := &query.SearchProductQuery{} | ||
| 77 | - Must(controller.Unmarshal(listProductQuery)) | ||
| 78 | - total, data, err := productService.SearchProduct(ParseOperateInfo(controller.BaseController), listProductQuery) | 76 | + cmd := &query.SearchProductQuery{} |
| 77 | + Must(controller.Unmarshal(cmd)) | ||
| 78 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 79 | + //cmd.OrgId = operateInfo.OrgId | ||
| 80 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 81 | + cmd.InOrgIds = operateInfo.OrgIds | ||
| 82 | + total, data, err := productService.SearchProduct(ParseOperateInfo(controller.BaseController), cmd) | ||
| 79 | ResponseGrid(controller.BaseController, total, data, err) | 83 | ResponseGrid(controller.BaseController, total, data, err) |
| 80 | } | 84 | } |
| 81 | 85 |
| @@ -69,8 +69,12 @@ func (controller *ProductGroupController) ListProductGroup() { | @@ -69,8 +69,12 @@ func (controller *ProductGroupController) ListProductGroup() { | ||
| 69 | 69 | ||
| 70 | func (controller *ProductGroupController) SearchProductGroup() { | 70 | func (controller *ProductGroupController) SearchProductGroup() { |
| 71 | productGroupService := service.NewProductGroupService(nil) | 71 | productGroupService := service.NewProductGroupService(nil) |
| 72 | - listProductGroupQuery := &query.SearchProductGroupQuery{} | ||
| 73 | - Must(controller.Unmarshal(listProductGroupQuery)) | ||
| 74 | - total, data, err := productGroupService.SearchProductGroup(ParseOperateInfo(controller.BaseController), listProductGroupQuery) | 72 | + cmd := &query.SearchProductGroupQuery{} |
| 73 | + Must(controller.Unmarshal(cmd)) | ||
| 74 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 75 | + //cmd.OrgId = operateInfo.OrgId | ||
| 76 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 77 | + cmd.InOrgIds = operateInfo.OrgIds | ||
| 78 | + total, data, err := productGroupService.SearchProductGroup(ParseOperateInfo(controller.BaseController), cmd) | ||
| 75 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
| 76 | } | 80 | } |
| @@ -69,8 +69,12 @@ func (controller *ProductJobController) ListProductJob() { | @@ -69,8 +69,12 @@ func (controller *ProductJobController) ListProductJob() { | ||
| 69 | 69 | ||
| 70 | func (controller *ProductJobController) SearchProductJob() { | 70 | func (controller *ProductJobController) SearchProductJob() { |
| 71 | productJobService := service.NewProductJobService(nil) | 71 | productJobService := service.NewProductJobService(nil) |
| 72 | - listProductJobQuery := &query.SearchProductJobQuery{} | ||
| 73 | - Must(controller.Unmarshal(listProductJobQuery)) | ||
| 74 | - total, data, err := productJobService.SearchProductJob(ParseOperateInfo(controller.BaseController), listProductJobQuery) | 72 | + cmd := &query.SearchProductJobQuery{} |
| 73 | + Must(controller.Unmarshal(cmd)) | ||
| 74 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 75 | + cmd.OrgId = operateInfo.OrgId | ||
| 76 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 77 | + //cmd.InOrgIds = operateInfo.OrgIds | ||
| 78 | + total, data, err := productJobService.SearchProductJob(operateInfo, cmd) | ||
| 75 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
| 76 | } | 80 | } |
| @@ -69,8 +69,12 @@ func (controller *UnitConversionController) ListUnitConversion() { | @@ -69,8 +69,12 @@ func (controller *UnitConversionController) ListUnitConversion() { | ||
| 69 | 69 | ||
| 70 | func (controller *UnitConversionController) SearchUnitConversion() { | 70 | func (controller *UnitConversionController) SearchUnitConversion() { |
| 71 | unitConversionService := service.NewUnitConversionService(nil) | 71 | unitConversionService := service.NewUnitConversionService(nil) |
| 72 | - listUnitConversionQuery := &query.SearchUnitConversionQuery{} | ||
| 73 | - Must(controller.Unmarshal(listUnitConversionQuery)) | ||
| 74 | - total, data, err := unitConversionService.SearchUnitConversion(ParseOperateInfo(controller.BaseController), listUnitConversionQuery) | 72 | + cmd := &query.SearchUnitConversionQuery{} |
| 73 | + Must(controller.Unmarshal(cmd)) | ||
| 74 | + operateInfo := ParseOperateInfo(controller.BaseController) | ||
| 75 | + //cmd.OrgId = operateInfo.OrgId | ||
| 76 | + cmd.CompanyId = operateInfo.CompanyId | ||
| 77 | + cmd.InOrgIds = operateInfo.OrgIds | ||
| 78 | + total, data, err := unitConversionService.SearchUnitConversion(ParseOperateInfo(controller.BaseController), cmd) | ||
| 75 | ResponseGrid(controller.BaseController, total, data, err) | 79 | ResponseGrid(controller.BaseController, total, data, err) |
| 76 | } | 80 | } |
-
请 注册 或 登录 后发表评论