chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
@@ -0,0 +1,34 @@
package common
import (
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
"github.com/gogf/gf/v2/database/gdb"
)
// visibleBatchTypeModel always excludes internal prepare batches before applying
// an optional caller-provided batch type filter.
func visibleBatchTypeModel(mod *gdb.Model, column string, requested *int) *gdb.Model {
mod = mod.Where(column+" <> ?", consts.BatchTypePrepare)
if requested != nil {
mod = mod.Where(column, *requested)
}
return mod
}
func visibleBatchTypeMatches(actual int, requested *int) bool {
if actual == consts.BatchTypePrepare {
return false
}
return requested == nil || actual == *requested
}
// successListBatchTypeModel keeps export execution logs out of business batch selectors.
func successListBatchTypeModel(mod *gdb.Model, column string, requested *int) *gdb.Model {
mod = visibleBatchTypeModel(mod, column, requested)
return mod.Where(column+" <> ?", consts.BatchTypeExport)
}
func successListBatchTypeMatches(actual int, requested *int) bool {
return actual != consts.BatchTypeExport && visibleBatchTypeMatches(actual, requested)
}