<?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.qiaoba.module.tenant.mapper.SysTenantDatasourceMapper">
    <select id="selectTenantIds" resultType="string">
        SELECT tenant_id FROM sys_tenant_datasource GROUP BY tenant_id
    </select>

    <update id="setBackupDatasourceExcludeId">
        update sys_tenant_datasource set is_primary = #{code} where tenant_id = #{tenantId} and datasource_id != #{excludeId}
    </update>

</mapper>
