<?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="org.jeecg.modules.adweb.seo.mapper.SeoPlanSubscriptionMapper">
    <select id="getKeywordStandard" resultType="java.lang.Integer">
        SELECT
            IF(COUNT(*) = 0 OR t1.target IS NULL, 10, t1.target)
        FROM
            subscribe_plan t1,
            seo_plan_subscription t2,
            adweb_site t3
        WHERE
            t2.`status` = 1
          AND t1.id = t2.plan_id
          AND t2.site_id = t3.id
          AND t3.`code` = #{siteCode}
        GROUP BY t1.target
    </select>
</mapper>