Переглянути джерело

客户联系人添加联系人搜索条件

wangxingcheng 3 роки тому
батько
коміт
29a1905013

+ 2 - 1
opms_parent/app/model/cust/cust_customer_contact.go

@@ -37,7 +37,8 @@ type UpdateCustCustomerContactSeq struct {
 
 //客户联系人信息
 type ContactSeq struct {
-	CustId int ` p:"custId"  json:"custId"      v:"required#custId不能为空" `
+	CustId   int    ` p:"custId"  json:"custId"      v:"required#custId不能为空" `
+	CuctName string ` p:"cuctName"  json:"cuctName"       `
 	request.PageReq
 }
 

+ 0 - 1
opms_parent/app/service/cust/cust_customer.go

@@ -259,7 +259,6 @@ func (s *CustomerService) MoveToPubic(Ids []int64) (err error) {
 		_, err = s.Dao.Data(g.Map{
 			"is_public":    isPublic,
 			"sales_id":     0,
-			"sales_name":   "",
 			"dept_id":      0,
 			"dept_name":    "",
 			"create_time":  currentTime,

+ 7 - 2
opms_parent/app/service/cust/cust_customer_contact.go

@@ -75,12 +75,17 @@ func (s *CustomercontactService) UpdateById(req *model.UpdateCustCustomerContact
 
 //获取联系人信息
 func (s *CustomercontactService) GetList(req *model.ContactSeq) (total int, list []*model.CustCustomerContactInfo, err error) {
-	err = s.Dao.Where("cust_id = ", req.CustId).Scan(&list)
+	contactDao := s.Dao.M.Where("cust_id = ", req.CustId)
+
+	if req.CuctName != "" {
+		contactDao = contactDao.Where("cuct_name "+" like ?", "%"+req.CuctName+"%")
+	}
+	err = contactDao.Order(" id desc ").Scan(&list)
 	if err != nil {
 		g.Log().Error(err)
 		return
 	}
-	total, err = s.Dao.Count()
+	total, err = contactDao.Count()
 	if err != nil {
 		g.Log().Error(err)
 		return