package api import ( "box-cost/db/repo" "errors" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson" ) func PrintDiff(c *gin.Context, apictx *ApiSession) (interface{}, error) { // id := c.Query("id") // CollectionMaterial = "material" // CollectionCraft = "craft" // CollectionProduct = "product" // CollectionSupplier = "supplier" // CollectionSupplierPrice = "supplier-price" // CollectionPack = "pack" // CollectionProductPlan = "product-plan" // 计划 // CollectionBillPurchase = "bill-purchase" // 材料采购单 // CollectionBillProduce = "bill-produce" // 工艺采购单 // CollectionBillProduct = "bill-product" // 成品采购单 // CollectionSupplierMatprice = "supplier-mats" // CollectionSupplierCraftprice = "supplier-crafts" // CollectionSupplierProductprice = "supplier-product" // 成品采购 // CollectionIncrement = "increment" // CollectionSignature = "signature" // CollectionUsers = "users" // // 更改日志记录 // CollectionLogs = "logs" // CollectionRequestLogs = "request-logs" // CollectionPlanTrack = "plan-track" // ?query={"targetId":"","collection":""} page, size, query := UtilQueryPageSize(c) if _, ok := query["targetId"]; !ok { return errors.New("目标id不能为空"), nil } if _, ok := query["collection"]; !ok { return errors.New("目标类型不能为空"), nil } return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{ CollectName: repo.CollectionLogs, Query: query, Page: page, Size: size, Sort: bson.M{"createTime": -1}, }) }