<?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.system.mapper.SysMobileTenantConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.usky.system.domain.SysMobileTenantConfig">
        <id column="id" property="id" />
        <result column="tenant_id" property="tenantId" />
        <result column="login_domain" property="loginDomain" />
        <result column="login_title" property="loginTitle" />
        <result column="login_logo" property="loginLogo" />
        <result column="login_back_url" property="loginBackUrl" />
        <result column="login_footer" property="loginFooter" />
        <result column="login_type" property="loginType" />
        <result column="middle_url" property="middleUrl" />
        <result column="home_logo" property="homeLogo" />
        <result column="home_layout" property="homeLayout" />
        <result column="home_style" property="homeStyle" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <select id="getAppTenantConfig" resultMap="BaseResultMap">
        select
        b.id, a.id AS tenant_id, b.login_domain, b.login_title, b.login_logo, b.login_back_url, b.login_footer, b.login_type, b.middle_url, b.home_logo, b.home_layout,
        b.home_style, b.create_by, b.create_time, b.update_by, b.update_time
        from
        sys_tenant AS a
        LEFT JOIN sys_mobile_tenant_config AS b ON a.id = b.tenant_id
        <where>
            a.status = 0
            and a.domain = #{url}
        </where>
    </select>

</mapper>
