<?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="com.ruoyi.madridmark.mapper.CMadridmarkMapper">


<delete id="clearData"    >
	truncate table c_madridmark  
	</delete>
	

<select id="listReport" resultType="map">
  	select 
  	<if test="cityCode != null  and cityCode != ''">
  		city modify_city
  	</if>
  	<if test="cityCode == null  or cityCode == ''">
  		province modify_city 
  	</if>
  	,reg_year ,count(*) total_cnt from c_madridmark 
	where 1=1 
	<if test="cityCode != null  and cityCode != ''">
  		and city is not null and city !=''  
  	</if>
  	<if test="cityCode == null  or cityCode == ''">
  		and province is not null and province !=''  
  	</if>
	and reg_year is not null and reg_year !='' and reg_date is not null and reg_date!='' 
	<if test="beginDate != null  and beginDate != ''">
		and reg_date <![CDATA[>=]]>#{beginDate}
	</if>
	<if test="endDate != null  and endDate != ''">
		and reg_date <![CDATA[<=]]>#{endDate}
	</if>
	<if test="cityCode != null  and cityCode != ''">
  		and city_code = #{cityCode}
  	</if>
	group by <if test="cityCode != null  and cityCode != ''">
  		city
  	</if>
  	<if test="cityCode == null  or cityCode == ''">
  		province
  	</if>,reg_year 
  </select>

</mapper>