_,err:=r.o.Raw("select P.id,p.title,IFNULL(k.count,0) as count FROM platform p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `knowledge_base` GROUP BY platform) k ON k.platform = p.id").Values(&maps)
_,err:=r.o.Raw("SELECT P.id,p.title,IFNULL(k.count,0) as count FROM platform p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `knowledge_base` GROUP BY platform) k ON k.platform = p.id").Values(&maps)
iferr!=nil{
iferr!=nil{
logs.Warn("GetKnowledgeBasePlatformsTotal get Group count------------",err)
logs.Warn("GetKnowledgeBasePlatformsTotal get Group count------------",err)
ifcounter,err:=r.o.Raw("SELECT s.id, s.user_account, s.service_account,s.create_at,s.is_reception, s.transfer_account,s.platform,u.nickname FROM services_statistical AS s INNER JOIN (SELECT * FROM `user` ) AS u ON s.user_account = u.id AND s.service_account = ? AND s.create_at > ? AND s.create_at < ? AND is_reception IN("+INReception+") "+addSQL1+" ORDER BY s.create_at DESC LIMIT ?,?",request.Cid,startDate.Unix(),endDate.Unix(),(request.PageOn-1)*request.PageSize,request.PageSize).Values(¶ms);counter<=0{
ifcounter,err:=r.o.Raw("SELECT s.id, s.user_account, s.service_account,s.create_at,s.is_reception, s.transfer_account,s.platform,u.nickname FROM services_statistical AS s INNER JOIN (SELECT * FROM `user` ) AS u ON s.user_account = u.id AND s.service_account = ? AND s.create_at > ? AND s.create_at < ? AND is_reception IN("+INReception+") "+addSQL1+" ORDER BY s.create_at DESC LIMIT ?,?",request.Cid,startDate.Unix(),endDate.Unix(),(request.PageOn-1)*request.PageSize,request.PageSize).Values(¶ms);counter<=0{
logs.Warn("GetCustomerServiceList get Customer Service List2------------",err)
logs.Warn("GetCustomerServiceList get Customer Service List2------------",err)
_,err:=r.o.Raw("SELECT p.id platform,p.title, IFNULL(u.count,0) AS `count` FROM platform as p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `user` WHERE last_activity BETWEEN ? AND ? GROUP BY platform) u ON p.id = u.platform",dateStart.Unix(),dateEnd.Unix()).Values(&statisticalData)
_,err:=r.o.Raw("SELECT p.id platform,p.title, IFNULL(u.count,0) AS `count` FROM platform as p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `user` WHERE last_activity BETWEEN ? AND ? GROUP BY platform) u ON p.id = u.platform",dateStart.Unix(),dateEnd.Unix()).Values(&statisticalData)
iferr!=nil{
iferr!=nil{
logs.Warn("GetTodayActionStatistical get Today Action Statistical------------",err)
logs.Warn("GetFlowStatistical get Today Action Statistical------------",err)
_,err:=r.o.Raw("SELECT t.*,IFNULL(w.count,0) as `count` FROM work_order_type t LEFT JOIN (SELECT t_i_d,COUNT(*) AS `count` FROM `work_order` WHERE `delete` = 0 GROUP BY `t_i_d`) w ON t.id = w.t_i_d").QueryRows(&workOrderTypes)
iferr!=nil{
logs.Warn("GetWorkOrderTypes get all------------",err)