<?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="cn.com.countrygarden.bi.main.dao.twerp.hm.TbSysDepartmentMapper">
    <sql id="selectAll">
    <![CDATA[
        select d.DepCode,d.SortDepCode,d.Depname
        from [HM_wygl_new_1853].[dbo].[Tb_Sys_Department] as d
        where d.rentid=1853
        ]]>
    </sql>

    <select id="findAll" resultType="cn.com.countrygarden.bi.main.model.twerp.hm.TbSysDepartment">
        <include refid="selectAll"/>
        <![CDATA[
          WHERE (d.IsDelete is null OR d.IsDelete!='1')
          ORDER BY d.SortDepCode ASC
        ]]>
    </select>

    <select id="findSysDepartment" resultType="cn.com.countrygarden.bi.main.model.twerp.hm.TbSysDepartment">
        select d.DepCode,d.SortDepCode,d.Depname
        from [HM_wygl_new_1853].[dbo].[Tb_Sys_Department] as d
          WHERE 1 = 1 AND (d.IsDelete is null OR d.IsDelete!='1')
          <if test="depName!=null and depName!=''">
              AND d.Depname = #{depName}
          </if>
          ORDER BY d.SortDepCode ASC
    </select>


</mapper>