<?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="io.dataease.base.mapper.ext.ExtWorkspaceMapper">

    <select id="getWorkspaceWithOrg" resultType="io.dataease.dto.WorkspaceDTO">
        select w.id, w.name, w.organization_id as organizationId, w.description, o.name as organizationName
          from workspace w join organization o on w.organization_id = o.id
          <where>
              <if test="request.name != null and request.name != ''">
                  AND w.name LIKE #{request.name,jdbcType=VARCHAR}
              </if>
          </where>
          order by w.update_time desc
    </select>

    <select id="getWorkspaceIdsByOrgId" resultType="java.lang.String">
        select id from workspace
        where organization_id = #{orgId}
    </select>

</mapper>
