Files
bl/modules/config/service/boss.go

49 lines
1007 B
Go
Raw Normal View History

package service
import (
"blazing/cool"
"blazing/modules/config/model"
)
type BossService struct {
*cool.Service
}
func NewBossService() *BossService {
return &BossService{
&cool.Service{
Model: model.NewBossConfig(),
PageQueryOp: &cool.QueryOp{
KeyWordField: []string{"desc"},
FieldEQ: []string{"map_id"},
},
ListQueryOp: &cool.QueryOp{
KeyWordField: []string{"desc"},
FieldEQ: []string{"map_id", "parentId"},
},
},
}
}
func (s *BossService) Get(id uint32) []model.BossConfig {
if id == 0 {
return nil
}
var item []model.BossConfig
dbm_notenable(s.Model).Where("id", id).WhereOr("parentId", id).OrderAsc("ordernum").Scan(&item)
return item
}
// func (s *BossService) GetList(id uint32) []model.BossConfig {
// var ret []model.BossConfig
// // 执行 Raw SQL 并扫描返回值
// dbm_nocache_noenable(s.Model).
// Wheref(`map_id @> ARRAY[?]::integer[]`, id).WhereOrf(`map_id @> ARRAY[?]::integer[]`, 0).Scan(&ret)
// return ret
// }