<?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.dayou.mapper.SortedDepartmentMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dayou.entity.SortedDepartment">
        <result column="id" property="id" />
        <result column="created" property="created" />
        <result column="modified" property="modified" />
        <result column="deleted" property="deleted" />
        <result column="department_id" property="departmentId" />
        <result column="business_type" property="businessType" />
        <result column="sorted_index" property="sortedIndex" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,
        created,
        modified,
        deleted,
        department_id, business_type, sorted_index
    </sql>

    <select id="simpleAll" parameterType="java.lang.String" resultType="com.dayou.common.PullDownModel">
            select sd.department_id as id,d.name from sorted_department sd left join department d
                    on d.id = sd.department_id where d.deleted =0 and sd.deleted = 0
                        and sd.business_type = #{businessType}
    </select>
</mapper>
