feat:优化信息

This commit is contained in:
henry
2021-11-23 09:12:49 +08:00
parent f825e8d1f6
commit 7eacb35ae8
2 changed files with 17 additions and 4 deletions

View File

@ -42,6 +42,12 @@ func (c *Supplier) List(name, mobile string, kind model2.ManageSupplierKind, pag
Where: nil, Where: nil,
Order: model2.NewOrder("id", model2.OrderModeToDesc), Order: model2.NewOrder("id", model2.OrderModeToDesc),
}} }}
if kind != model2.ManageSupplierKindForManufacturer && !c.IsAdmin {
where = append(where, &model2.ModelWhereOrder{
Where: model2.NewWhere("tenant_id", c.TenantID),
})
}
if c.TenantID > 0 { if c.TenantID > 0 {
// TODO因不支持此写法故删除此写法 // TODO因不支持此写法故删除此写法
// 根据单位由下往上查看信息 // 根据单位由下往上查看信息
@ -94,12 +100,19 @@ func (c *Supplier) List(name, mobile string, kind model2.ManageSupplierKind, pag
func (c *Supplier) Select(kind int) ([]*SupplierBasic, error) { func (c *Supplier) Select(kind int) ([]*SupplierBasic, error) {
out := make([]*model2.ManageSupplier, 0) out := make([]*model2.ManageSupplier, 0)
if err := model2.ScanFields(model.NewManageSupplier().ManageSupplier, &out, []string{"id", "name"}, where := []*model2.ModelWhereOrder{
&model2.ModelWhereOrder{ &model2.ModelWhereOrder{
Where: model2.NewWhere("kind", kind), Where: model2.NewWhere("kind", kind),
}, &model2.ModelWhereOrder{ },
}
if model2.ManageSupplierKind(kind) != model2.ManageSupplierKindForManufacturer {
where = append(where, &model2.ModelWhereOrder{
Where: model2.NewWhere("tenant_id", c.TenantID), Where: model2.NewWhere("tenant_id", c.TenantID),
}); err != nil { })
}
if err := model2.ScanFields(model.NewManageSupplier().ManageSupplier, &out, []string{"id", "name"},
where...); err != nil {
return nil, err return nil, err
} }
list := make([]*SupplierBasic, 0) list := make([]*SupplierBasic, 0)

View File

@ -28,5 +28,5 @@ func (m *SysBreakdown) BreakdownTitle(breakdown string) string {
} }
func NewSysBreakdown() *SysBreakdown { func NewSysBreakdown() *SysBreakdown {
return &SysBreakdown{} return &SysBreakdown{model.NewSysBreakdown()}
} }