<?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="org.sky.system.mapper.TenantMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="tenantResultMap" type="org.sky.system.pojo.entity.Tenant">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="tenant_name" property="tenantName"/>
        <result column="domain_url" property="domainUrl"/>
        <result column="background_url" property="backgroundUrl"/>
        <result column="linkman" property="linkman"/>
        <result column="contact_number" property="contactNumber"/>
        <result column="address" property="address"/>
        <result column="account_number" property="accountNumber"/>
        <result column="expire_time" property="expireTime"/>
        <result column="license_key" property="licenseKey"/>
        <result column="short_name" property="shortName"/>
        <result column="uscc" property="uscc"/>
        <result column="province_code" property="provinceCode"/>
        <result column="city_code" property="cityCode"/>
        <result column="district_code" property="districtCode"/>
        <result column="vip_years" property="vipYears"/>
        <result column="saleman" property="saleman"/>
    </resultMap>


    <select id="selectTenantPage" resultMap="tenantResultMap">
        select * from kd_tenant
        <where>
            <if test="ew.tenantId!=null and ew.tenantId!=''">and tenant_id like concat('%',#{ew.tenantId},'%')</if>
            <if test="ew.tenantName!=null and ew.tenantName!=''">and tenant_name like concat('%',#{ew.tenantName},'%')</if>
            <if test="ew.uscc!=null and ew.uscc!=''">and uscc like concat('%',#{ew.uscc},'%')</if>
            <if test="ew.linkman!=null and ew.linkman!=''">and linkman like concat('%',#{ew.linkman},'%')</if>
        </where>
    </select>

</mapper>
