Нет описания

TMapPolygonPropertiesMapper.xml 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yt.zhylplat.moduleMap.mapper.TMapPolygonPropertiesMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
  6. <id column="polygon_id" property="polygonId" />
  7. <result column="polygon_geometry_id" property="polygonGeometryId" />
  8. <result column="maintenance_company_id" property="maintenanceCompanyId" />
  9. <result column="maintenance_company_name" property="maintenanceCompanyName" />
  10. <result column="section_id" property="sectionId" />
  11. <result column="section_name" property="sectionName" />
  12. <result column="road_id" property="roadId" />
  13. <result column="road_name" property="roadName" />
  14. <result column="road_scope" property="roadScope" />
  15. <result column="road_start_spot" property="roadStartSpot" />
  16. <result column="road_end_spot" property="roadEndSpot" />
  17. <result column="type" property="type" />
  18. <result column="object_id" property="objectId" />
  19. <result column="S1" property="s1" />
  20. <result column="road_bid" property="roadBid" />
  21. <result column="road_section" property="roadSection" />
  22. <result column="man_road_section" property="manRoadSection" />
  23. <result column="management" property="management" />
  24. <result column="green_space_type" property="greenSpaceType" />
  25. <result column="green_space_level" property="greenSpaceLevel" />
  26. <result column="green_space_area" property="greenSpaceArea" />
  27. <result column="del_flg" property="delFlg" />
  28. <result column="remark" property="remark" />
  29. </resultMap>
  30. <resultMap id="PolygonPropertiesMap" type="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
  31. <!--地图道路信息-->
  32. <id column="polygon_id" property="polygonId" />
  33. <result column="polygon_geometry_id" property="polygonGeometryId" />
  34. <result column="maintenance_company_id" property="maintenanceCompanyId" />
  35. <result column="maintenance_company_name" property="maintenanceCompanyName" />
  36. <result column="section_id" property="sectionId" />
  37. <result column="section_name" property="sectionName" />
  38. <result column="road_id" property="roadId" />
  39. <result column="road_name" property="roadName" />
  40. <result column="road_scope" property="roadScope" />
  41. <result column="road_start_spot" property="roadStartSpot" />
  42. <result column="road_end_spot" property="roadEndSpot" />
  43. <result column="type" property="type" />
  44. <result column="object_id" property="objectId" />
  45. <result column="S1" property="s1" />
  46. <result column="road_bid" property="roadBid" />
  47. <result column="road_section" property="roadSection" />
  48. <result column="man_road_section" property="manRoadSection" />
  49. <result column="management" property="management" />
  50. <result column="green_space_type" property="greenSpaceType" />
  51. <result column="green_space_level" property="greenSpaceLevel" />
  52. <result column="green_space_area" property="greenSpaceArea" />
  53. <result column="del_flg" property="delFlg" />
  54. <result column="remark" property="remark" />
  55. <!--基础道路信息-特色道路-->
  56. <result property="specialRoadDate" column="special_road_date"/>
  57. <result property="specialRoadFlg" column="special_road_flg"/>
  58. <result property="projectManager" column="project_manager"/>
  59. <result property="projectManagerTel" column="project_manager_tel"/>
  60. <!--绿地属性-->
  61. <collection property="tMapGreenSpaceProperties"
  62. ofType="com.yt.zhylplat.moduleMap.entity.TMapGreenSpaceProperty">
  63. <id column="gpy_id" property="id" />
  64. <result column="gpy_polygon_id" property="polygonId" />
  65. <result column="gpy_road_start_spot" property="roadStartSpot" />
  66. <result column="gpy_road_end_spot" property="roadEndSpot" />
  67. <result column="gpy_green_space_type" property="greenSpaceType" />
  68. <result column="gpy_green_space_level" property="greenSpaceLevel" />
  69. <result column="gpy_green_space_area" property="greenSpaceArea" />
  70. <result column="gpy_del_flg" property="delFlg" />
  71. <result column="gpy_feature_variety_name" property="featureVarietyName" />
  72. <result column="gpy_feature_variety_number" property="featureVarietyNumber" />
  73. <result column="gpy_update_date" property="updateDate" />
  74. </collection>
  75. </resultMap>
  76. <!-- 通用查询结果列 -->
  77. <sql id="Base_Column_List">
  78. 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
  79. </sql>
  80. <!-- 绿地属性查询结果列 -->
  81. <sql id="GreenSpaceProperty_Column_List">
  82. 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
  83. </sql>
  84. <select id="selectTMapPolygonProperties"
  85. resultType="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
  86. select
  87. pp.polygon_id,
  88. pp.type as type,
  89. pg.type as geometryType,
  90. pg.coordinates as coordinates
  91. from
  92. T_Map_Polygon_Properties pp
  93. left join
  94. T_Map_Polygon_Geometry pg on pp.polygon_id = pg.polygon_id
  95. <where>
  96. and pp.del_flg = 0
  97. <if test="polygonId != null">
  98. and pp.polygon_id = #{polygonId}
  99. </if>
  100. <if test="maintenanceCompanyId != null">
  101. and pp.maintenance_company_id = #{maintenanceCompanyId}
  102. </if>
  103. <if test="maintenanceCompanyName != null and maintenanceCompanyName != ''">
  104. and pp.maintenance_company_name = #{maintenanceCompanyName}
  105. </if>
  106. <if test="sectionId != null">
  107. and pp.section_id = #{sectionId}
  108. </if>
  109. <if test="sectionName != null and sectionName != ''">
  110. and pp.section_name = #{sectionName}
  111. </if>
  112. <if test="roadId != null">
  113. and pp.road_id = #{roadId}
  114. </if>
  115. <if test="roadIds != null and roadIds != ''">
  116. and find_in_set(pp.road_id, #{roadIds})
  117. </if>
  118. <if test="roadName != null and roadName != ''">
  119. and pp.road_name like concat('%', #{roadName}, '%')
  120. </if>
  121. <if test="roadScope != null and roadScope != ''">
  122. and pp.road_scope = #{roadScope}
  123. </if>
  124. <if test="roadStartSpot != null and roadStartSpot != ''">
  125. and pp.road_start_spot = #{roadStartSpot}
  126. </if>
  127. <if test="roadEndSpot != null and roadEndSpot != ''">
  128. and pp.road_end_spot = #{roadEndSpot}
  129. </if>
  130. <if test="objectId != null">
  131. and pp.object_id = #{objectId}
  132. </if>
  133. <if test="S1 != null">
  134. and pp.S1 = #{S1}
  135. </if>
  136. <if test="roadSection != null">
  137. and pp.road_section = #{roadSection}
  138. </if>
  139. <if test="manRoadSection != null">
  140. and pp.man_road_section = #{manRoadSection}
  141. </if>
  142. <if test="management != null">
  143. and pp.management = #{management}
  144. </if>
  145. <if test="roadBid != null and roadBid != ''">
  146. 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)
  147. </if>
  148. </where>
  149. </select>
  150. <select id="selectPolygonCompleteState"
  151. resultType="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
  152. SELECT
  153. pp.polygon_id,
  154. IF(temp.state is null, 0, temp.state) as state,
  155. pp.type,
  156. pg.type as geometryType,
  157. pg.coordinates,
  158. temp.road_id
  159. FROM (
  160. SELECT DISTINCT
  161. wpd.road_id,
  162. IF(wpdi.state is null, 0, wpdi.state) as state
  163. FROM
  164. T_Lhgy_Green_Work_Plan_Detail wpd
  165. LEFT JOIN (
  166. SELECT
  167. road_id,
  168. CASE
  169. WHEN SUM(IF(complete_rate is null, 0, complete_rate)) <![CDATA[ >= ]]> 100 then 2
  170. WHEN SUM(IF(complete_rate is null, 0, complete_rate)) = 0 THEN 0
  171. WHEN SUM(IF(complete_rate is null, 0, complete_rate)) <![CDATA[ < ]]> 100 THEN 1
  172. ELSE 0
  173. end as state
  174. FROM
  175. T_Lhgy_Green_Work_Plan_Detail_Item
  176. WHERE
  177. delete_flag = 0
  178. GROUP BY
  179. road_id
  180. ) wpdi on wpd.road_id = wpdi.road_id
  181. WHERE wpd.delete_flag = 0 and DATE_FORMAT(wpd.create_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
  182. ) temp
  183. LEFT JOIN T_Map_Polygon_Properties pp on temp.road_id = pp.road_id
  184. LEFT JOIN T_Map_Polygon_Geometry pg on pp.polygon_id = pg.polygon_id
  185. WHERE
  186. pp.del_flg = 0
  187. <if test="sectionId != null">
  188. and pp.section_id = #{sectionId}
  189. </if>
  190. <if test="maintenanceCompanyId != null">
  191. and pp.maintenance_company_id = #{maintenanceCompanyId}
  192. </if>
  193. <if test="roadId != null">
  194. and pp.road_id = #{roadId}
  195. </if>
  196. </select>
  197. <update id="updatePolygonProperties" parameterType="com.yt.zhylplat.moduleMap.entity.TMapPolygonProperties">
  198. update T_Map_Polygon_Properties
  199. <set>
  200. <if test="maintenanceCompanyId != null">
  201. maintenance_company_id = #{maintenanceCompanyId},
  202. </if>
  203. <if test="maintenanceCompanyName != null and maintenanceCompanyName != ''">
  204. maintenance_company_name = #{maintenanceCompanyName},
  205. </if>
  206. <if test="sectionId != null">
  207. section_id = #{sectionId},
  208. </if>
  209. <if test="sectionName != null and sectionName != ''">
  210. section_name = #{sectionName},
  211. </if>
  212. <if test="roadId != null">
  213. road_id = #{roadId},
  214. </if>
  215. <if test="roadName != null and roadName != ''">
  216. road_name = #{roadName},
  217. </if>
  218. <if test="roadScope != null and roadScope != ''">
  219. road_scope = #{roadScope},
  220. </if>
  221. <if test="roadStartSpot != null and roadStartSpot != ''">
  222. road_start_spot = #{roadStartSpot},
  223. </if>
  224. <if test="roadEndSpot != null and roadEndSpot != ''">
  225. road_end_spot = #{roadEndSpot},
  226. </if>
  227. <if test="type != null and type != ''">
  228. type = #{type},
  229. </if>
  230. <if test="delFlg != null">
  231. del_flg = #{delFlg},
  232. </if>
  233. <if test="objectId != null">
  234. object_id = #{objectId},
  235. </if>
  236. <if test="S1 != null and S1 != ''">
  237. S1 = #{S1},
  238. </if>
  239. <if test="roadBid != null and roadBid != ''">
  240. road_bid = #{roadBid},
  241. </if>
  242. <if test="greenSpaceType != null">
  243. green_space_type = #{greenSpaceType},
  244. </if>
  245. <if test="greenSpaceLevel != null">
  246. green_space_level = #{greenSpaceLevel},
  247. </if>
  248. <if test="greenSpaceArea != null">
  249. green_space_area = #{greenSpaceArea},
  250. </if>
  251. <if test="roadSection != null and roadSection != ''">
  252. road_section = #{roadSection},
  253. </if>
  254. <if test="remark != null and remark != ''">
  255. remark = #{remark},
  256. </if>
  257. <if test="manRoadSection != null and manRoadSection != ''">
  258. man_road_section = #{manRoadSection},
  259. </if>
  260. <if test="management != null and management != ''">
  261. management = #{management},
  262. </if>
  263. </set>
  264. where
  265. polygon_id = #{polygonId}
  266. </update>
  267. <!--查询绿地属性以及道路是否为特色道路-->
  268. <select id="selectByPolygonId" resultMap="PolygonPropertiesMap">
  269. SELECT
  270. <include refid="GreenSpaceProperty_Column_List"/>,
  271. mpp.*,tlr.special_road_date,tlr.special_road_flg,rsmc.project_manager,rsmc.project_manager_tel
  272. FROM (SELECT
  273. <include refid="Base_Column_List"/>
  274. FROM T_Map_Polygon_Properties WHERE polygon_id = #{polygonId}) mpp
  275. LEFT JOIN T_Lhzx_Road tlr ON mpp.road_id = tlr.id
  276. LEFT JOIN T_Map_Green_Space_Property gpy ON gpy.polygon_id = mpp.polygon_id
  277. left join T_Lhzx_Road_Section_Maintenance_Company rsmc on mpp.road_id = rsmc.road_id
  278. </select>
  279. <select id="selectListByBean" resultMap="PolygonPropertiesMap">
  280. select
  281. <include refid="GreenSpaceProperty_Column_List"/>,
  282. mpp.*,tlr.special_road_date,tlr.special_road_flg
  283. from
  284. T_Map_Polygon_Properties mpp
  285. LEFT JOIN
  286. T_Lhzx_Road tlr ON mpp.road_id = tlr.id
  287. LEFT JOIN
  288. T_Map_Green_Space_Property gpy ON gpy.polygon_id = mpp.polygon_id
  289. <where>
  290. and mpp.del_flg = 0
  291. <if test="polygonId != null">
  292. and mpp.polygon_id = #{polygonId}
  293. </if>
  294. <if test="maintenanceCompanyId != null">
  295. and mpp.maintenance_company_id = #{maintenanceCompanyId}
  296. </if>
  297. <if test="maintenanceCompanyName != null and maintenanceCompanyName != ''">
  298. and mpp.maintenance_company_name = #{maintenanceCompanyName}
  299. </if>
  300. <if test="sectionId != null">
  301. and mpp.section_id = #{sectionId}
  302. </if>
  303. <if test="sectionName != null and sectionName != ''">
  304. and mpp.section_name = #{sectionName}
  305. </if>
  306. <if test="roadId != null">
  307. and mpp.road_id = #{roadId}
  308. </if>
  309. <if test="roadName != null and roadName != ''">
  310. and mpp.road_name = #{roadName}
  311. </if>
  312. <if test="roadScope != null and roadScope != ''">
  313. and mpp.road_scope = #{roadScope}
  314. </if>
  315. <if test="roadStartSpot != null and roadStartSpot != ''">
  316. and mpp.road_start_spot = #{roadStartSpot}
  317. </if>
  318. <if test="roadEndSpot != null and roadEndSpot != ''">
  319. and mpp.road_end_spot = #{roadEndSpot}
  320. </if>
  321. <if test="objectId != null">
  322. and mpp.object_id = #{objectId}
  323. </if>
  324. <if test="S1 != null">
  325. and mpp.S1 = #{S1}
  326. </if>
  327. <if test="roadSection != null">
  328. and mpp.road_section = #{roadSection}
  329. </if>
  330. <if test="manRoadSection != null">
  331. and mpp.man_road_section = #{manRoadSection}
  332. </if>
  333. <if test="management != null">
  334. and mpp.management = #{management}
  335. </if>
  336. <if test="roadBid != null and roadBid != ''">
  337. 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)
  338. </if>
  339. </where>
  340. ORDER BY mpp.update_date desc
  341. </select>
  342. </mapper>