| | |
| | | <if test="phone != null and phone.trim() != ''"> |
| | | AND c.contact_phone LIKE CONCAT('%', #{phone}, '%') |
| | | </if> |
| | | <if test="agentName != null and agentName.trim() != ''"> |
| | | AND pa.agent_name LIKE CONCAT('%', #{agentName}, '%') |
| | | </if> |
| | | <if test="createdFrom != null"> |
| | | AND c.created_at >= #{createdFrom} |
| | | </if> |
| | |
| | | ELSE NULL |
| | | END AS regionName, |
| | | c.status, |
| | | pa.agent_name AS agentName, |
| | | COUNT(u.id) AS userCount, |
| | | c.created_at AS createdAt, |
| | | c.business_license_url AS businessLicenseUrl |
| | | FROM tcm_clinic c |
| | | LEFT JOIN tcm_provincial_agent pa ON pa.id = c.agent_id AND pa.deleted = 0 |
| | | LEFT JOIN tcm_app_user u ON u.clinic_id = c.id AND u.deleted = 0 |
| | | <include refid="ClinicWhere"/> |
| | | GROUP BY |
| | |
| | | c.city_name, |
| | | c.district_name, |
| | | c.status, |
| | | pa.agent_name, |
| | | c.created_at, |
| | | c.business_license_url |
| | | ORDER BY c.id DESC |
| | |
| | | ELSE NULL |
| | | END AS regionName, |
| | | c.status, |
| | | pa.agent_name AS agentName, |
| | | COUNT(u.id) AS userCount, |
| | | c.created_at AS createdAt, |
| | | c.business_license_url AS businessLicenseUrl |
| | | FROM tcm_clinic c |
| | | LEFT JOIN tcm_provincial_agent pa ON pa.id = c.agent_id AND pa.deleted = 0 |
| | | LEFT JOIN tcm_app_user u ON u.clinic_id = c.id AND u.deleted = 0 |
| | | <include refid="ClinicWhere"/> |
| | | GROUP BY |
| | |
| | | c.city_name, |
| | | c.district_name, |
| | | c.status, |
| | | pa.agent_name, |
| | | c.created_at, |
| | | c.business_license_url |
| | | ORDER BY c.id DESC |