<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.timer.api.dao.crm.CrmClientDataMapper"> <select id="crmCartogram" resultType="cn.timer.api.dto.crm.CrmCartogramDto"> SELECT province_id,province as provinceName,count(province_id) num FROM crm_client_data WHERE org_code = #{orgCode} <if test='null != belongUser and belongUser !=""'>AND belong_user = #{belongUser} </if> <if test='null != belongGroup and belongGroup !=""'>AND belong_group = #{belongGroup} </if> <if test='null != startCreateTime and startCreateTime !=""'>AND create_time <![CDATA[>=]]> #{startCreateTime} </if> <if test='null != endCreateTime and endCreateTime !=""'>AND create_time <![CDATA[<=]]> #{endCreateTime} </if> GROUP BY province_id </select> </mapper>