浏览代码

修改sql语句

renjiaojiao 3 年之前
父节点
当前提交
9aef8ce56b
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/customerService/customService.go

+ 4 - 4
src/customerService/customService.go

@@ -227,9 +227,9 @@ func MyCustomerService(state, updateTimeStart, updateTimeEnd, companyName, phone
 	salesperson := util.CusTiDb.FindOne("jy_salesperson_info", map[string]interface{}{"phone": adminPhone}, "seatNumber", "")
 	if salesperson != nil && len(*salesperson) > 0 {
 		code := qutil.ObjToString((*salesperson)["seatNumber"])
-		sql := "SELECT company,id,phone,status999,lastUpdateTime FROM customer where owner = '" + code + "' "
+		sql := "SELECT company,id,phone,status999,lastUpdateTime FROM customer where owner in (" + code + ") "
 		str := ""
-		sqlc := "SELECT COUNt(id) FROM customer where owner = '" + code + "' "
+		sqlc := "SELECT COUNT(*) FROM customer where owner in (" + code + ") "
 
 		if state != "" {
 			str += " and status999 = '" + state + "'"
@@ -246,11 +246,11 @@ func MyCustomerService(state, updateTimeStart, updateTimeEnd, companyName, phone
 		if phone != "" {
 			str += " and phone like '%" + phone + "%'"
 		}
-		log.Println(sql, sqlc)
 		if str != "" {
-			sql += str + " order by id desc limit " + fmt.Sprint(offSet) + " " + "," + " " + fmt.Sprint(pageSize)
+			sql += str
 			sqlc += str
 		}
+		sql += " order by lastUpdateTime desc limit " + fmt.Sprint(offSet) + " " + "," + " " + fmt.Sprint(pageSize)
 		log.Println("sql:", sql)
 		log.Println("sqlc:", sqlc)
 		count = util.CusTiDb.CountBySql(sqlc)