From cddf1d93735052590755460f4b3c8264e0d57399 Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期一, 07 八月 2023 09:39:20 +0800 Subject: [PATCH] fix --- service/orderManage.go | 100 +++++++++++++++++++++++++------------------------- 1 files changed, 50 insertions(+), 50 deletions(-) diff --git a/service/orderManage.go b/service/orderManage.go index f33f3b9..2bcff81 100644 --- a/service/orderManage.go +++ b/service/orderManage.go @@ -1,50 +1,50 @@ -package service - -import ( - "aps_crm/model" - "aps_crm/pkg/ecode" -) - -type OrderManageService struct{} - -func (OrderManageService) AddOrderManage(orderManage *model.OrderManage) int { - err := model.NewOrderManageSearch().Create(orderManage) - if err != nil { - return ecode.OrderManageExist - } - - return ecode.OK -} - -func (OrderManageService) UpdateOrderManage(orderManage *model.OrderManage) int { - // check orderManage exist - _, err := model.NewOrderManageSearch().SetId(orderManage.Id).Find() - if err != nil { - return ecode.OrderManageNotExist - } - - err = model.NewOrderManageSearch().SetId(orderManage.Id).Update(orderManage) - if err != nil { - return ecode.OrderManageSetErr - } - - return ecode.OK -} - -func (OrderManageService) GetOrderManageList(page, pageSize int, keyword string) ([]*model.OrderManage, int64, int) { - // get contact list - contacts, total, err := model.NewOrderManageSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll() - if err != nil { - return nil, 0, ecode.OrderManageListErr - } - return contacts, total, ecode.OK -} - -func (OrderManageService) DeleteOrderManage(ids []int) int { - // delete client - err := model.NewOrderManageSearch().SetIds(ids).Delete() - if err != nil { - return ecode.OrderManageDeleteErr - } - return ecode.OK -} +package service + +import ( + "aps_crm/model" + "aps_crm/pkg/ecode" +) + +type OrderManageService struct{} + +func (OrderManageService) AddOrderManage(orderManage *model.OrderManage) int { + err := model.NewOrderManageSearch().Create(orderManage) + if err != nil { + return ecode.OrderManageExist + } + + return ecode.OK +} + +func (OrderManageService) UpdateOrderManage(orderManage *model.OrderManage) int { + // check orderManage exist + _, err := model.NewOrderManageSearch().SetId(orderManage.Id).Find() + if err != nil { + return ecode.OrderManageNotExist + } + + err = model.NewOrderManageSearch().SetId(orderManage.Id).Update(orderManage) + if err != nil { + return ecode.OrderManageSetErr + } + + return ecode.OK +} + +func (OrderManageService) GetOrderManageList(page, pageSize int, keyword string) ([]*model.OrderManage, int64, int) { + // get contact list + contacts, total, err := model.NewOrderManageSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll() + if err != nil { + return nil, 0, ecode.OrderManageListErr + } + return contacts, total, ecode.OK +} + +func (OrderManageService) DeleteOrderManage(ids []int) int { + // delete client + err := model.NewOrderManageSearch().SetIds(ids).Delete() + if err != nil { + return ecode.OrderManageDeleteErr + } + return ecode.OK +} -- Gitblit v1.8.0