소스 검색

fix:客户名称关键字查询

Roc 3 년 전
부모
커밋
bffa2bc9ce
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      models/tables/company_approval/company_approval.go

+ 2 - 2
models/tables/company_approval/company_approval.go

@@ -938,12 +938,12 @@ type CompanyNameList struct {
 }
 
 //获取客户名称列表数据
-func GetCompanyNameList(userId int, userRoleTypeCode, name string) (list []*CompanyNameList, err error) {
+func GetCompanyNameList(userId int, userRoleTypeCode, keyword string) (list []*CompanyNameList, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT a.company_name FROM company AS a
 			INNER JOIN company_product AS b ON a.company_id=b.company_id
 			INNER JOIN company_approval AS c ON b.company_id=c.company_id AND b.product_id=c.product_id
- 			WHERE (c.apply_user_id=? or ( (c.approve_user_id =?  or c.approve_user_id = 0) and approve_role_type_code=?)  ) and( a.company_name like '%` + name + `% or  a.credit_code like '%` + name + `%)' group by a.company_name order by c.modify_time DESC `
+ 			WHERE (c.apply_user_id=? or ( (c.approve_user_id =?  or c.approve_user_id = 0) and approve_role_type_code=?)  ) and( a.company_name like '%` + keyword + `%' or  a.credit_code like '%` + keyword + `%') group by a.company_name order by c.modify_time DESC `
 	_, err = o.Raw(sql, userId, userId, userRoleTypeCode).QueryRows(&list)
 	return
 }