<?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.usky.fire.mapper.ReservePlanMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.usky.fire.domain.ReservePlan">
        <id column="id" property="id"/>
        <result column="reserve_name" property="reserveName"/>
        <result column="reserve_type" property="reserveType"/>
        <result column="reserve_url" property="reserveUrl"/>
        <result column="company_id" property="companyId"/>
        <result column="creator" property="creator"/>
        <result column="create_time" property="createTime"/>
        <result column="update_person" property="updatePerson"/>
        <result column="update_time" property="updateTime"/>
        <result column="enable" property="enable"/>
    </resultMap>

    <select id="reservePlanCount" resultType="com.usky.fire.service.vo.DataCountVo">
        SELECT
        reserve_type as id,
        count(*) AS listCount
        FROM
        reserve_plan
        <where>
            enable=1
            <if test="companyId != null and companyId != '' ">
                AND company_id = #{companyId}
            </if>
        </where>
        GROUP BY
        reserve_type
    </select>

</mapper>
