zhangqian
2023-08-18 c0305be973254bd1b5a351064f8639d490564b30
service/quotation.go
@@ -16,28 +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) GetQuotationList() ([]*model.Quotation, int) {
   list, err := model.NewQuotationSearch().FindAll()
   if err != nil {
      return nil, ecode.QuotationListErr
   }
   return list, ecode.OK
}
func (QuotationService) UpdateQuotation(quotation *model.Quotation) int {
   // check quotation exist
   _, err := model.NewQuotationSearch().SetId(quotation.Id).Find()
@@ -52,3 +30,21 @@
   return ecode.OK
}
func (QuotationService) GetQuotationList(page, pageSize int, data map[string]interface{}) ([]*model.Quotation, int64, int) {
   // get contact list
   contacts, total, err := model.NewQuotationSearch().SetPage(page, pageSize).SetSearchMap(data).FindAll()
   if err != nil {
      return nil, 0, ecode.QuotationListErr
   }
   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
}