All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor(common/utils): 重构concurrent_swiss_map使用官方sync.Map实现 - 替换原有的第三方并发map实现,改为基于标准库sync.Map的封装 - 保持完全的API兼容性,原有配置方法变为无实际作用的占位符 - 优化Range方法实现,移除goroutine/channel开销,避免潜在的死锁风险 - 移除依赖的外部库和
48 lines
938 B
Go
48 lines
938 B
Go
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).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
|
|
}
|