| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- <?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.yt.zhylplat.moduleMap.mapper.TMapPolygonPropertiesMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
- <id column="polygon_id" property="polygonId" />
- <result column="polygon_geometry_id" property="polygonGeometryId" />
- <result column="maintenance_company_id" property="maintenanceCompanyId" />
- <result column="maintenance_company_name" property="maintenanceCompanyName" />
- <result column="section_id" property="sectionId" />
- <result column="section_name" property="sectionName" />
- <result column="road_id" property="roadId" />
- <result column="road_name" property="roadName" />
- <result column="road_scope" property="roadScope" />
- <result column="road_start_spot" property="roadStartSpot" />
- <result column="road_end_spot" property="roadEndSpot" />
- <result column="type" property="type" />
- <result column="object_id" property="objectId" />
- <result column="S1" property="s1" />
- <result column="road_bid" property="roadBid" />
- <result column="road_section" property="roadSection" />
- <result column="man_road_section" property="manRoadSection" />
- <result column="management" property="management" />
- <result column="green_space_type" property="greenSpaceType" />
- <result column="green_space_level" property="greenSpaceLevel" />
- <result column="green_space_area" property="greenSpaceArea" />
- <result column="del_flg" property="delFlg" />
- <result column="remark" property="remark" />
- </resultMap>
- <resultMap id="PolygonPropertiesMap" type="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
- <!--地图道路信息-->
- <id column="polygon_id" property="polygonId" />
- <result column="polygon_geometry_id" property="polygonGeometryId" />
- <result column="maintenance_company_id" property="maintenanceCompanyId" />
- <result column="maintenance_company_name" property="maintenanceCompanyName" />
- <result column="section_id" property="sectionId" />
- <result column="section_name" property="sectionName" />
- <result column="road_id" property="roadId" />
- <result column="road_name" property="roadName" />
- <result column="road_scope" property="roadScope" />
- <result column="road_start_spot" property="roadStartSpot" />
- <result column="road_end_spot" property="roadEndSpot" />
- <result column="type" property="type" />
- <result column="object_id" property="objectId" />
- <result column="S1" property="s1" />
- <result column="road_bid" property="roadBid" />
- <result column="road_section" property="roadSection" />
- <result column="man_road_section" property="manRoadSection" />
- <result column="management" property="management" />
- <result column="green_space_type" property="greenSpaceType" />
- <result column="green_space_level" property="greenSpaceLevel" />
- <result column="green_space_area" property="greenSpaceArea" />
- <result column="del_flg" property="delFlg" />
- <result column="remark" property="remark" />
- <!--基础道路信息-特色道路-->
- <result property="specialRoadDate" column="special_road_date"/>
- <result property="specialRoadFlg" column="special_road_flg"/>
- <result property="projectManager" column="project_manager"/>
- <result property="projectManagerTel" column="project_manager_tel"/>
- <!--绿地属性-->
- <collection property="tMapGreenSpaceProperties"
- ofType="com.yt.zhylplat.moduleMap.entity.TMapGreenSpaceProperty">
- <id column="gpy_id" property="id" />
- <result column="gpy_polygon_id" property="polygonId" />
- <result column="gpy_road_start_spot" property="roadStartSpot" />
- <result column="gpy_road_end_spot" property="roadEndSpot" />
- <result column="gpy_green_space_type" property="greenSpaceType" />
- <result column="gpy_green_space_level" property="greenSpaceLevel" />
- <result column="gpy_green_space_area" property="greenSpaceArea" />
- <result column="gpy_del_flg" property="delFlg" />
- <result column="gpy_feature_variety_name" property="featureVarietyName" />
- <result column="gpy_feature_variety_number" property="featureVarietyNumber" />
- <result column="gpy_update_date" property="updateDate" />
- </collection>
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- polygon_id,polygon_geometry_id,maintenance_company_id,maintenance_company_name,section_id,section_name,road_id,road_name,road_scope,road_start_spot,road_end_spot,type,object_id,S1,road_bid,road_section,man_road_section,management,green_space_type,green_space_level,green_space_area,del_flg,remark
- </sql>
- <!-- 绿地属性查询结果列 -->
- <sql id="GreenSpaceProperty_Column_List">
- gpy.id as gpy_id, gpy.polygon_id as gpy_polygon_id, gpy.road_start_spot as gpy_road_start_spot, gpy.road_end_spot as gpy_road_end_spot, gpy.green_space_type as gpy_green_space_type, gpy.green_space_level as gpy_green_space_level, gpy.green_space_area as gpy_green_space_area, gpy.special_variety as gpy_special_variety, gpy.special_variety_count as gpy_special_variety_count, gpy.del_flg as gpy_del_flg, gpy.feature_variety_name as gpy_feature_variety_name, gpy.feature_variety_number as gpy_feature_variety_number,gpy.update_date as gpy_update_date
- </sql>
- <select id="selectTMapPolygonProperties"
- resultType="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
- select
- pp.polygon_id,
- pp.type as type,
- pg.type as geometryType,
- pg.coordinates as coordinates
- from
- T_Map_Polygon_Properties pp
- left join
- T_Map_Polygon_Geometry pg on pp.polygon_id = pg.polygon_id
- <where>
- and pp.del_flg = 0
- <if test="polygonId != null">
- and pp.polygon_id = #{polygonId}
- </if>
- <if test="maintenanceCompanyId != null">
- and pp.maintenance_company_id = #{maintenanceCompanyId}
- </if>
- <if test="maintenanceCompanyName != null and maintenanceCompanyName != ''">
- and pp.maintenance_company_name = #{maintenanceCompanyName}
- </if>
- <if test="sectionId != null">
- and pp.section_id = #{sectionId}
- </if>
- <if test="sectionName != null and sectionName != ''">
- and pp.section_name = #{sectionName}
- </if>
- <if test="roadId != null">
- and pp.road_id = #{roadId}
- </if>
- <if test="roadIds != null and roadIds != ''">
- and find_in_set(pp.road_id, #{roadIds})
- </if>
- <if test="roadName != null and roadName != ''">
- and pp.road_name like concat('%', #{roadName}, '%')
- </if>
- <if test="roadScope != null and roadScope != ''">
- and pp.road_scope = #{roadScope}
- </if>
- <if test="roadStartSpot != null and roadStartSpot != ''">
- and pp.road_start_spot = #{roadStartSpot}
- </if>
- <if test="roadEndSpot != null and roadEndSpot != ''">
- and pp.road_end_spot = #{roadEndSpot}
- </if>
- <if test="objectId != null">
- and pp.object_id = #{objectId}
- </if>
- <if test="S1 != null">
- and pp.S1 = #{S1}
- </if>
- <if test="roadSection != null">
- and pp.road_section = #{roadSection}
- </if>
- <if test="manRoadSection != null">
- and pp.man_road_section = #{manRoadSection}
- </if>
- <if test="management != null">
- and pp.management = #{management}
- </if>
- <if test="roadBid != null and roadBid != ''">
- or ((pp.road_bid = #{roadBid} or pp.road_name = #{roadBid}) and pp.maintenance_company_id is null and pp.section_id is null and pp.road_id is null and pp.del_flg = 0)
- </if>
- </where>
- </select>
- <select id="selectPolygonCompleteState"
- resultType="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
- SELECT
- pp.polygon_id,
- IF(temp.state is null, 0, temp.state) as state,
- pp.type,
- pg.type as geometryType,
- pg.coordinates,
- temp.road_id
- FROM (
- SELECT DISTINCT
- wpd.road_id,
- IF(wpdi.state is null, 0, wpdi.state) as state
- FROM
- T_Lhgy_Green_Work_Plan_Detail wpd
- LEFT JOIN (
- SELECT
- road_id,
- CASE
- WHEN SUM(IF(complete_rate is null, 0, complete_rate)) <![CDATA[ >= ]]> 100 then 2
- WHEN SUM(IF(complete_rate is null, 0, complete_rate)) = 0 THEN 0
- WHEN SUM(IF(complete_rate is null, 0, complete_rate)) <![CDATA[ < ]]> 100 THEN 1
- ELSE 0
- end as state
- FROM
- T_Lhgy_Green_Work_Plan_Detail_Item
- WHERE
- delete_flag = 0
- GROUP BY
- road_id
- ) wpdi on wpd.road_id = wpdi.road_id
- WHERE wpd.delete_flag = 0 and DATE_FORMAT(wpd.create_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
- ) temp
- LEFT JOIN T_Map_Polygon_Properties pp on temp.road_id = pp.road_id
- LEFT JOIN T_Map_Polygon_Geometry pg on pp.polygon_id = pg.polygon_id
- WHERE
- pp.del_flg = 0
- <if test="sectionId != null">
- and pp.section_id = #{sectionId}
- </if>
- <if test="maintenanceCompanyId != null">
- and pp.maintenance_company_id = #{maintenanceCompanyId}
- </if>
- <if test="roadId != null">
- and pp.road_id = #{roadId}
- </if>
- </select>
- <update id="updatePolygonProperties" parameterType="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
- update T_Map_Polygon_Properties
- <set>
- <if test="maintenanceCompanyId != null">
- maintenance_company_id = #{maintenanceCompanyId},
- </if>
- <if test="maintenanceCompanyName != null and maintenanceCompanyName != ''">
- maintenance_company_name = #{maintenanceCompanyName},
- </if>
- <if test="sectionId != null">
- section_id = #{sectionId},
- </if>
- <if test="sectionName != null and sectionName != ''">
- section_name = #{sectionName},
- </if>
- <if test="roadId != null">
- road_id = #{roadId},
- </if>
- <if test="roadName != null and roadName != ''">
- road_name = #{roadName},
- </if>
- <if test="roadScope != null and roadScope != ''">
- road_scope = #{roadScope},
- </if>
- <if test="roadStartSpot != null and roadStartSpot != ''">
- road_start_spot = #{roadStartSpot},
- </if>
- <if test="roadEndSpot != null and roadEndSpot != ''">
- road_end_spot = #{roadEndSpot},
- </if>
- <if test="type != null and type != ''">
- type = #{type},
- </if>
- <if test="delFlg != null">
- del_flg = #{delFlg},
- </if>
- <if test="objectId != null">
- object_id = #{objectId},
- </if>
- <if test="S1 != null and S1 != ''">
- S1 = #{S1},
- </if>
- <if test="roadBid != null and roadBid != ''">
- road_bid = #{roadBid},
- </if>
- <if test="greenSpaceType != null">
- green_space_type = #{greenSpaceType},
- </if>
- <if test="greenSpaceLevel != null">
- green_space_level = #{greenSpaceLevel},
- </if>
- <if test="greenSpaceArea != null">
- green_space_area = #{greenSpaceArea},
- </if>
- <if test="roadSection != null and roadSection != ''">
- road_section = #{roadSection},
- </if>
- <if test="remark != null and remark != ''">
- remark = #{remark},
- </if>
- <if test="manRoadSection != null and manRoadSection != ''">
- man_road_section = #{manRoadSection},
- </if>
- <if test="management != null and management != ''">
- management = #{management},
- </if>
- </set>
- where
- polygon_id = #{polygonId}
- </update>
- <!--查询绿地属性以及道路是否为特色道路-->
- <select id="selectByPolygonId" resultMap="PolygonPropertiesMap">
- SELECT
- <include refid="GreenSpaceProperty_Column_List"/>,
- mpp.*,tlr.special_road_date,tlr.special_road_flg,rsmc.project_manager,rsmc.project_manager_tel
- FROM (SELECT
- <include refid="Base_Column_List"/>
- FROM T_Map_Polygon_Properties WHERE polygon_id = #{polygonId}) mpp
- LEFT JOIN T_Lhzx_Road tlr ON mpp.road_id = tlr.id
- LEFT JOIN T_Map_Green_Space_Property gpy ON gpy.polygon_id = mpp.polygon_id
- left join T_Lhzx_Road_Section_Maintenance_Company rsmc on mpp.road_id = rsmc.road_id
- </select>
- <select id="selectListByBean" resultMap="PolygonPropertiesMap">
- select
- <include refid="GreenSpaceProperty_Column_List"/>,
- mpp.*,tlr.special_road_date,tlr.special_road_flg
- from
- T_Map_Polygon_Properties mpp
- LEFT JOIN
- T_Lhzx_Road tlr ON mpp.road_id = tlr.id
- LEFT JOIN
- T_Map_Green_Space_Property gpy ON gpy.polygon_id = mpp.polygon_id
- <where>
- and mpp.del_flg = 0
- <if test="polygonId != null">
- and mpp.polygon_id = #{polygonId}
- </if>
- <if test="maintenanceCompanyId != null">
- and mpp.maintenance_company_id = #{maintenanceCompanyId}
- </if>
- <if test="maintenanceCompanyName != null and maintenanceCompanyName != ''">
- and mpp.maintenance_company_name = #{maintenanceCompanyName}
- </if>
- <if test="sectionId != null">
- and mpp.section_id = #{sectionId}
- </if>
- <if test="sectionName != null and sectionName != ''">
- and mpp.section_name = #{sectionName}
- </if>
- <if test="roadId != null">
- and mpp.road_id = #{roadId}
- </if>
- <if test="roadName != null and roadName != ''">
- and mpp.road_name = #{roadName}
- </if>
- <if test="roadScope != null and roadScope != ''">
- and mpp.road_scope = #{roadScope}
- </if>
- <if test="roadStartSpot != null and roadStartSpot != ''">
- and mpp.road_start_spot = #{roadStartSpot}
- </if>
- <if test="roadEndSpot != null and roadEndSpot != ''">
- and mpp.road_end_spot = #{roadEndSpot}
- </if>
- <if test="objectId != null">
- and mpp.object_id = #{objectId}
- </if>
- <if test="S1 != null">
- and mpp.S1 = #{S1}
- </if>
- <if test="roadSection != null">
- and mpp.road_section = #{roadSection}
- </if>
- <if test="manRoadSection != null">
- and mpp.man_road_section = #{manRoadSection}
- </if>
- <if test="management != null">
- and mpp.management = #{management}
- </if>
- <if test="roadBid != null and roadBid != ''">
- or ((mpp.road_bid = #{roadBid} or mpp.road_name = #{roadBid}) and mpp.maintenance_company_id is null and mpp.section_id is null and mpp.road_id is null and mpp.del_flg = 0)
- </if>
- </where>
- ORDER BY mpp.update_date desc
- </select>
- </mapper>
|