<?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.common.mapper.AnalysisGroupByWindowMapper">

    <resultMap id="BaseResultMap" type="com.common.entity.AnalysisGroupByWindow">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="group_by_id" property="groupById" jdbcType="INTEGER"/>
        <result column="window_type" property="windowType" jdbcType="VARCHAR"/>
        <result column="tumble_window_time_type" property="tumbleWindowTimeType" jdbcType="VARCHAR"/>
        <result column="tumble_window_size" property="tumbleWindowSize" jdbcType="INTEGER"/>
        <result column="tumble_window_size_unit" property="tumbleWindowSizeUnit" jdbcType="VARCHAR"/>
        <result column="hop_window_time_type" property="hopWindowTimeType" jdbcType="VARCHAR"/>
        <result column="hop_window_size" property="hopWindowSize" jdbcType="INTEGER"/>
        <result column="hop_window_size_unit" property="hopWindowSizeUnit" jdbcType="VARCHAR"/>
        <result column="hop_window_slide" property="hopWindowSlide" jdbcType="INTEGER"/>
        <result column="hop_window_slide_unit" property="hopWindowSlideUnit" jdbcType="VARCHAR"/>
        <result column="hop_window_alarm_once_per_window" property="hopWindowAlarmOncePerWindow" jdbcType="BOOLEAN"/>
        <result column="session_window_time_type" property="sessionWindowTimeType" jdbcType="VARCHAR"/>
        <result column="session_window_size" property="sessionWindowSize" jdbcType="INTEGER"/>
        <result column="session_window_size_unit" property="sessionWindowSizeUnit" jdbcType="VARCHAR"/>
        <result column="create_dept" property="createDept" jdbcType="BIGINT"/>
        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="create_by" property="createBy" jdbcType="BIGINT"/>
        <result column="update_by" property="updateBy" jdbcType="BIGINT"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
        <result column="tenant_id" property="tenantId" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, group_by_id, window_type,
        tumble_window_time_type, tumble_window_size, tumble_window_size_unit,
        hop_window_time_type, hop_window_size, hop_window_size_unit,
        hop_window_slide, hop_window_slide_unit, hop_window_alarm_once_per_window,
        session_window_time_type, session_window_size, session_window_size_unit,
        create_dept, del_flag, create_time, update_time, create_by, update_by,
        remark, tenant_id
    </sql>

    <select id="selectByGroupById" resultMap="BaseResultMap">
        SELECT
            <include refid="Base_Column_List"/>
        FROM analysis_group_by_window
        WHERE group_by_id = #{groupById, jdbcType=INTEGER}
          AND del_flag = '0'
        LIMIT 1
    </select>

</mapper>
