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

    <sql id="Base_Column_List">
       a.*,
       b.user_name as "userName"
	</sql>
    <sql id="tableJoins">
    left join sys_user b on b.user_id = a.user_id
  </sql>
    <select
        id="selectPage"
        resultType="com.ruoyi.common.core.domain.entity.SysTenant">
        select
        <include refid="Base_Column_List"/>
        from sys_tenant a
        <include refid="tableJoins"/>
        <if test="ew.sqlSegment != '' and ew.sqlSegment != null">
            <if test="!ew.isEmptyOfWhere">
                <where>
                    ${ew.sqlSegment}
                </where>
            </if>
            <if test="ew.isEmptyOfWhere">
                ${ew.sqlSegment}
            </if>
        </if>
    </select>
    <select
        id="selectById"
        resultType="com.ruoyi.common.core.domain.entity.SysTenant">
        select
        <include refid="Base_Column_List"/>
        from sys_tenant a
        <include refid="tableJoins"/>
        where a.id = #{id}
    </select>
</mapper>
