12345678910111213141516171819202122232425262728293031323334 |
- package api
- import (
- "box-cost/db/model"
- "box-cost/db/repo"
- "box-cost/log"
- "errors"
- "fmt"
- "time"
- "github.com/gin-gonic/gin"
- )
- // 更新生产计划
- func DiffUpdatePlanTest(c *gin.Context, apictx *ApiSession) (interface{}, error) {
- var plan model.ProductPlan
- err := c.ShouldBindJSON(&plan)
- if err != nil {
- fmt.Println(err)
- log.Error(err)
- return nil, errors.New("参数错误")
- }
- if plan.Id.Hex() == "" {
- return nil, errors.New("id的为空")
- }
- plan.UpdateTime = time.Now()
- // 查询更新前数据
- // oldPlan := &model.ProductPlan{}
- // repo.RepoSeachDoc(apictx.CreateRepoCtx(),&repo.DocSearchOptions{},oldPlan)
- return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), "product-plan_copy1", plan.Id.Hex(), &plan)
- // 查询更新后数据
- // 差异比较
- // 记录到数据库中
- }
|