<?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.lutao.cloud.admin.mapper.SysTenantMapper">

	<resultMap id="sysTenantMap" type="com.lutao.cloud.admin.api.entity.SysTenant">
		<id property="id" column="id"/>
		<result property="name" column="name"/>
		<result property="code" column="code"/>
		<result property="startTime" column="start_time"/>
		<result property="endTime" column="end_time"/>
		<result property="status" column="status"/>
		<result property="delFlag" column="del_flag"/>
		<result property="createTime" column="create_time"/>
		<result property="updateTime" column="update_time"/>
	</resultMap>

	<select id="getTenantVOPage" resultType="com.lutao.cloud.admin.api.vo.TenantVO"
			parameterType="com.lutao.cloud.admin.api.vo.TenantVO">
		SELECT
			st.id, st.name, st.code, st.start_time, st.end_time, st.status, st.del_flag, st.create_time, st.update_time,
			stc.max_user, stc.max_online, stc.max_install, stc.tenant_type, stc.app_id, stc.email, stc.phone, stc.app_secret,
			stc.rtc_id, stc.max_disk, stc.max_time
		FROM sys_tenant st
		left join sys_tenant_config stc on st.id = stc.tenant_id
		<if test="query.name != null and query.name != ''">
			AND st.name like concat('%',#{query.name},'%')
		</if>
		<if test="query.status != null and query.status != ''">
			AND st.status = #{query.status}
		</if>
		ORDER BY st.create_time DESC
	</select>
</mapper>
