<?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.tourism.common.report.dao.ReportPageGroupMapper">
    <resultMap id="BaseResultMap" type="com.tourism.common.report.model.ReportPageGroup">
        <id column="group_id" jdbcType="BIGINT" property="groupId"/>
        <result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
        <result column="app_code" jdbcType="VARCHAR" property="appCode"/>
        <result column="group_name" jdbcType="VARCHAR" property="groupName"/>
        <result column="parent_id" jdbcType="BIGINT" property="parentId"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
    </resultMap>

    <select id="getReportPageGroupList" resultMap="BaseResultMap"
            parameterType="com.tourism.common.report.model.ReportPageGroup">
        SELECT * FROM zz_report_page_group
        <where>
            <if test="reportPageGroupFilter.tenantId == null">
                AND zz_report_page_group.tenant_id IS NULL
            </if>
            <if test="reportPageGroupFilter.tenantId != null">
                AND zz_report_page_group.tenant_id = #{reportPageGroupFilter.tenantId}
            </if>
            <if test="reportPageGroupFilter.appCode == null">
                AND zz_report_page_group.app_code IS NULL
            </if>
            <if test="reportPageGroupFilter.appCode != null">
                AND zz_report_page_group.app_code = #{reportPageGroupFilter.appCode}
            </if>
        </where>
        <if test="orderBy != null and orderBy != ''">
            ORDER BY ${orderBy}
        </if>
    </select>
</mapper>
