From c0305be973254bd1b5a351064f8639d490564b30 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 18 八月 2023 10:13:09 +0800
Subject: [PATCH] 增加一些表的数据初始化
---
service/quotation.go | 30 +++++++++++++-----------------
1 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/service/quotation.go b/service/quotation.go
index 13b03b1..f0bbdbe 100644
--- a/service/quotation.go
+++ b/service/quotation.go
@@ -16,19 +16,6 @@
return ecode.OK
}
-func (QuotationService) DeleteQuotation(id int) int {
- _, err := model.NewQuotationSearch().SetId(id).Find()
- if err != nil {
- return ecode.QuotationNotExist
- }
-
- err = model.NewQuotationSearch().SetId(id).Delete()
- if err != nil {
- return ecode.QuotationNotExist
- }
- return ecode.OK
-}
-
func (QuotationService) UpdateQuotation(quotation *model.Quotation) int {
// check quotation exist
_, err := model.NewQuotationSearch().SetId(quotation.Id).Find()
@@ -44,11 +31,20 @@
return ecode.OK
}
-func (QuotationService) GetQuotationList(page, pageSize int, keyword string) ([]*model.Quotation, int) {
+func (QuotationService) GetQuotationList(page, pageSize int, data map[string]interface{}) ([]*model.Quotation, int64, int) {
// get contact list
- contacts, err := model.NewQuotationSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll()
+ contacts, total, err := model.NewQuotationSearch().SetPage(page, pageSize).SetSearchMap(data).FindAll()
if err != nil {
- return nil, ecode.QuotationListErr
+ return nil, 0, ecode.QuotationListErr
}
- return contacts, ecode.OK
+ return contacts, total, ecode.OK
+}
+
+func (QuotationService) DeleteQuotation(ids []int) int {
+ // delete client
+ err := model.NewQuotationSearch().SetIds(ids).Delete()
+ if err != nil {
+ return ecode.QuotationDeleteErr
+ }
+ return ecode.OK
}
--
Gitblit v1.8.0