<?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.victorysoft.business.sys.dao.SysFieldinfoDao">

  <select id="selectByUnit" parameterType="java.lang.String" resultType="SysFieldinfo">
    select distinct sf.FIELDCODE, sf.FIELDNAME
      from SYS_FIELDINFO sf, water_well_basic wb
    where sf.fieldcode = wb.fieldcode
      and wb.unitcode in (select unitcode
      from SYS_UNITINFO
      start with UNITCODE = #{value}
      connect by prior UNITCODE = P_UNITCODE)
    order by sf.FIELDCODE
  </select>
</mapper>