feat:完善项目

This commit is contained in:
henry
2021-11-05 15:27:04 +08:00
parent 873ad8ea2c
commit d20ac3e09f
16 changed files with 465 additions and 13 deletions

View File

@ -0,0 +1,58 @@
package config
import (
model2 "ArmedPolice/app/common/model"
"ArmedPolice/app/controller/basic"
"ArmedPolice/app/model"
"ArmedPolice/app/service"
)
type Breakdown struct{ *service.Session }
type BreakdownHandle func(session *service.Session) *Breakdown
type BreakdownInfo struct {
basic.CommonIDString
*model2.SysBreakdown
}
func (c *Breakdown) List(title string, page, pageSize int) (*basic.PageDataResponse, error) {
mSysBreakdown := model.NewSysBreakdown()
out := make([]*model2.SysBreakdown, 0)
where := &model2.ModelWhereOrder{
Order: model2.NewOrder("id", model2.OrderModeToDesc),
}
if title != "" {
where.Where = model2.NewWhereLike("title", title)
}
var count int64
if err := model2.Pages(mSysBreakdown.SysBreakdown, &out, page, pageSize, &count, where); err != nil {
return nil, err
}
list := make([]*BreakdownInfo, 0)
for _, v := range out {
list = append(list, &BreakdownInfo{
CommonIDString: basic.CommonIDString{ID: v.GetEncodeID()},
SysBreakdown: v,
})
}
return &basic.PageDataResponse{Data: list, Count: count}, nil
}
func (c *Breakdown) Form(id uint64, title, remark string) error {
return nil
}
func (c *Breakdown) Delete(id uint64) error {
return nil
}
func NewBreakdown() BreakdownHandle {
return func(session *service.Session) *Breakdown {
return &Breakdown{session}
}
}

View File

@ -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 {