...
|
...
|
@@ -127,7 +127,9 @@ func (repository *ProductGroupRepository) FindOne(queryOptions map[string]interf |
|
|
query.SetWhereByQueryOption("work_station->>'workStationId'=?", "workStationId")
|
|
|
query.SetWhereByQueryOption("work_station->>'workshopId'='?'", "workshopId")
|
|
|
query.SetWhereByQueryOption("work_station->>'lineId'='?'", "lineId")
|
|
|
query.AllWithDeleted()
|
|
|
if v, ok := queryOptions["includeDeleted"]; ok && v.(bool) {
|
|
|
query.AllWithDeleted()
|
|
|
}
|
|
|
if err := query.First(); err != nil {
|
|
|
if err.Error() == "pg: no rows in result set" {
|
|
|
return nil, fmt.Errorf("没有此资源")
|
...
|
...
|
@@ -146,6 +148,11 @@ func (repository *ProductGroupRepository) Find(queryOptions map[string]interface |
|
|
var productGroupModels []*models.ProductGroup
|
|
|
productGroups := make([]*domain.ProductGroup, 0)
|
|
|
query := sqlbuilder.BuildQuery(tx.Model(&productGroupModels), queryOptions)
|
|
|
query.SetWhereByQueryOption("company_id = ?", "companyId")
|
|
|
query.SetWhereByQueryOption("org_id = ?", "orgId")
|
|
|
if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 {
|
|
|
query.Where(`org_id in (?)`, pg.In(v))
|
|
|
}
|
|
|
query.SetOffsetAndLimit(20)
|
|
|
query.SetOrderDirect("product_group_id", "DESC")
|
|
|
if count, err := query.SelectAndCount(); err != nil {
|
...
|
...
|
|