<?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.yunzhi.marketing.mapper.TaEventPropertiesMapper">
    <select id="isEventExist" resultType="java.lang.Integer">
        SELECT
			COUNT(1)
		FROM
			ta_event_properties t
		WHERE
			( ( t.target_id IS NULL AND #{targetId} IS NULL ) OR t.target_id	= #{targetId} )
			AND ( ( t.event_type IS NULL AND #{eventType} IS NULL ) OR t.event_type = #{eventType} )
			AND ( ( t.property_code IS NULL AND #{activity} IS NULL ) OR t.property_code = #{activity} )
			<if test="orgId != null">
				and t.org_id = #{orgId}
			</if>

    </select>

</mapper>
