<?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.elephant.framework.galaxy.aroad.module.zhjs.mapper.ZhjsGcxmShapeMapper">

  <resultMap id="zhjsGcxmShapeMap" type="com.elephant.framework.galaxy.aroad.module.zhjs.entity.ZhjsGcxmShape">
        <id property="id" column="id"/>
        <result property="code" column="code"/>
        <result property="proname" column="proname"/>
        <result property="reportitemname" column="reportItemName"/>
        <result property="proabbreviation" column="proabbreviation"/>
        <result property="attribute" column="attribute"/>
        <result property="property" column="property"/>
        <result property="level" column="level"/>
        <result property="constructionunit" column="constructionunit"/>
        <result property="designunit" column="designunit"/>
        <result property="planstartdate" column="planstartdate"/>
        <result property="planenddate" column="planenddate"/>
        <result property="startdate" column="startdate"/>
        <result property="enddate" column="enddate"/>
        <result property="quantities" column="quantities"/>
        <result property="bid" column="bid"/>
        <result property="provinceinvest" column="provinceinvest"/>
        <result property="centreinvest" column="centreinvest"/>
        <result property="estimate" column="estimate"/>
        <result property="planno" column="planno"/>
        <result property="branched" column="branched"/>
        <result property="address" column="address"/>
        <result property="structure" column="structure"/>
        <result property="proinfo" column="proinfo"/>
        <result property="sort" column="sort"/>
        <result property="managesorgid" column="managesOrgId"/>
        <result property="managesorgname" column="managesOrgName"/>
        <result property="city" column="city"/>
        <result property="startstation" column="startStation"/>
        <result property="endstation" column="endStation"/>
        <result property="xy" column="xy"/>
        <result property="invmodel" column="invmodel"/>
        <result property="mileage" column="mileage"/>
        <result property="remark" column="remark"/>
        <result property="introduce" column="introduce"/>
        <result property="type" column="type"/>
        <result property="legalperson" column="legalperson"/>
        <result property="spanlength" column="spanlength"/>
        <result property="shape" column="shape"/>
  </resultMap>
      <select id="getJYlsForQS" resultMap="zhjsGcxmShapeMap">
          select * from v_zhjs_gcxm_shape
        <where>
            <if test="lxbh !=null and lxbh !=''">
                  locate(#{lxbh},proname)
            </if>
            <if test="zxzh !=null">
                  and startStation <![CDATA[ <= ]]>#{zxzh} and endStation <![CDATA[ >= ]]>#{zxzh}
            </if>
        </where>
        order by startdate
      </select>
    <select id="getJYlsForRoad" resultMap="zhjsGcxmShapeMap">
        select * from v_zhjs_gcxm_shape
        <where>
            <if test="lxbh !=null and lxbh !=''">
                locate(#{lxbh},proname)
            </if>
            <if test="qdzh !=null and zdzh != 0">
                and(startStation <![CDATA[ <= ]]>#{qdzh} and endStation <![CDATA[ >= ]]>#{qdzh}) or (startStation <![CDATA[ <= ]]>#{zdzh} and endStation <![CDATA[ >= ]]>#{zdzh})
            </if>
        </where>
        order by startdate

    </select>
</mapper>
