feat:完善项目

This commit is contained in:
henry
2021-11-03 10:24:37 +08:00
parent 09ef8a7885
commit 565b683d7e
9 changed files with 45 additions and 32 deletions

View File

@ -1,4 +1,4 @@
package supplier
package manage
import (
model2 "ArmedPolice/app/common/model"
@ -9,18 +9,18 @@ import (
"time"
)
type Instance struct{ *service.Session }
type Supplier struct{ *service.Session }
type InstanceHandle func(session *service.Session) *Instance
type SupplierHandle func(session *service.Session) *Supplier
type (
// InstanceInfo 基本信息
InstanceInfo struct {
// SupplierInfo 基本信息
SupplierInfo struct {
ID string `json:"id"`
*model2.ManageSupplier
}
// InstanceParams 参数信息
InstanceParams struct {
// SupplierParams 参数信息
SupplierParams struct {
ID uint64
Name, Mobile, Address, Remark string
Kind model2.ManageSupplierKind
@ -28,7 +28,7 @@ type (
)
// List 列表信息
func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, page, pageSize int) (*basic.PageDataResponse, error) {
func (c *Supplier) List(name, mobile string, kind model2.ManageSupplierKind, page, pageSize int) (*basic.PageDataResponse, error) {
mManageSupplier := model.NewManageSupplier()
out := make([]*model2.ManageSupplier, 0)
@ -62,10 +62,10 @@ func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, pag
if err := model2.Pages(mManageSupplier.ManageSupplier, &out, page, pageSize, &count, where...); err != nil {
return nil, err
}
list := make([]*InstanceInfo, 0)
list := make([]*SupplierInfo, 0)
for _, v := range out {
list = append(list, &InstanceInfo{
list = append(list, &SupplierInfo{
ID: v.GetEncodeID(), ManageSupplier: v,
})
}
@ -73,7 +73,7 @@ func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, pag
}
// Form 数据处理
func (c *Instance) Form(params *InstanceParams) error {
func (c *Supplier) Form(params *SupplierParams) error {
mManageSupplier := model.NewManageSupplier()
if params.ID > 0 {
@ -103,7 +103,7 @@ func (c *Instance) Form(params *InstanceParams) error {
}
// Delete 删除操作
func (c *Instance) Delete(id uint64) error {
func (c *Supplier) Delete(id uint64) error {
mManageSupplier := model.NewManageSupplier()
mManageSupplier.ID = id
@ -113,8 +113,8 @@ func (c *Instance) Delete(id uint64) error {
return nil
}
func NewInstance() InstanceHandle {
return func(session *service.Session) *Instance {
return &Instance{session}
func NewSupplier() SupplierHandle {
return func(session *service.Session) *Supplier {
return &Supplier{session}
}
}

View File

@ -11,16 +11,17 @@ type Instance struct{ *service.Session }
type InstanceHandle func(session *service.Session) *Instance
func (c *Instance) List(name string, page, pageSize int) (*basic.ReturnPages, error) {
func (c *Instance) List(name string, page, pageSize int) (*basic.PageDataResponse, error) {
mSysTenant := model.NewSysTenant()
out := make([]*model2.SysTenant, 0)
var count int64
model2.Pages(mSysTenant.SysTenant, &out, page, pageSize, &count)
return &basic.ReturnPages{Data: nil, Count: 0}, nil
if err := model2.Pages(mSysTenant.SysTenant, &out, page, pageSize, &count); err != nil {
return nil, err
}
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
}
func (c *Instance) Form() error {

View File

@ -9,8 +9,8 @@ type Role struct{ *service.Session }
type RoleHandle func(session *service.Session) *Role
func (c *Role) List() (*basic.ReturnPages, error) {
return &basic.ReturnPages{Data: nil, Count: 0}, nil
func (c *Role) List() (*basic.PageDataResponse, error) {
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
}
func (c *Role) Form() error {