59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
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}
|
|
}
|
|
}
|