first commit
This commit is contained in:
31
internal/service/budget/budget.go
Normal file
31
internal/service/budget/budget.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package budget
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
db "management/internal/db/sqlc"
|
||||
"management/internal/global"
|
||||
)
|
||||
|
||||
func AllBudgets(ctx context.Context, projectId int64) []*global.DataDict {
|
||||
pp, err := db.Engine.ListBudgets(ctx, projectId)
|
||||
if err != nil || len(pp) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var res []*global.DataDict
|
||||
res = append(res, &global.DataDict{
|
||||
Name: "请选择",
|
||||
Value: "0",
|
||||
})
|
||||
for _, v := range pp {
|
||||
item := global.DataDict{
|
||||
Name: v.Name,
|
||||
Value: strconv.Itoa(int(v.ID)),
|
||||
}
|
||||
res = append(res, &item)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user