feat:完善项目
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package work
|
||||
|
||||
import (
|
||||
model2 "ArmedPolice/app/common/model"
|
||||
"ArmedPolice/app/controller/basic"
|
||||
"ArmedPolice/app/model"
|
||||
"ArmedPolice/app/service"
|
||||
)
|
||||
|
||||
@ -9,8 +11,47 @@ type Instance struct{ *service.Session }
|
||||
|
||||
type InstanceHandle func(session *service.Session) *Instance
|
||||
|
||||
func (c *Instance) List() (*basic.ReturnPages, error) {
|
||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
||||
type (
|
||||
// InstanceInfo 基本信息
|
||||
InstanceInfo struct {
|
||||
basic.CommonIDString
|
||||
*model.WorkInstanceInfo
|
||||
}
|
||||
)
|
||||
|
||||
// List 列表信息
|
||||
func (c *Instance) List(materialID uint64, kind, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||
mWorkInstance := model.NewWorkInstance()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if materialID > 0 {
|
||||
where = append(where, model2.NewWhere("w.material_id", materialID))
|
||||
}
|
||||
if kind > 0 {
|
||||
where = append(where, model2.NewWhere("w.kind", kind))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mWorkInstance.Instances(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*InstanceInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
mWorkInstance.ID = v.ID
|
||||
|
||||
list = append(list, &InstanceInfo{
|
||||
CommonIDString: basic.CommonIDString{ID: mWorkInstance.GetEncodeID()}, WorkInstanceInfo: v,
|
||||
})
|
||||
}
|
||||
return &basic.PageDataResponse{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
func (c *Instance) ToDo() {
|
||||
|
||||
}
|
||||
|
||||
func (c *Instance) Form() error {
|
||||
|
Reference in New Issue
Block a user