Brak opisu

TLhzxStreetTreeMapper.xml 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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.moduleLhzx.road.mapper.TLhzxStreetTreeMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
  6. <id column="id" property="id" />
  7. <result column="yh_company_id" property="yhCompanyId" />
  8. <result column="yh_company_name" property="yhCompanyName" />
  9. <result column="section_id" property="sectionId" />
  10. <result column="section_name" property="sectionName" />
  11. <result column="road_id" property="roadId" />
  12. <result column="road_type" property="roadType" />
  13. <result column="road_plate" property="roadPlate" />
  14. <result column="tree_name" property="treeName" />
  15. <result column="extra_large_num" property="extraLargeNum" />
  16. <result column="large_num" property="largeNum" />
  17. <result column="medium_num" property="mediumNum" />
  18. <result column="small_num" property="smallNum" />
  19. <result column="help_stump" property="helpStump" />
  20. <result column="cover_plate" property="coverPlate" />
  21. <result column="grow_year" property="growYear" />
  22. <result column="grow_spacing" property="growSpacing" />
  23. <result column="growing" property="growing" />
  24. <result column="years" property="years" />
  25. <result column="remark" property="remark" />
  26. <result column="create_user_id" property="createUserId" />
  27. <result column="create_date" property="createDate" />
  28. <result column="update_user_id" property="updateUserId" />
  29. <result column="update_date" property="updateDate" />
  30. <result column="del_flg" property="delFlg" />
  31. </resultMap>
  32. <!-- 通用查询结果列 -->
  33. <sql id="Base_Column_List">
  34. id, yh_company_id, yh_company_name, section_id, section_name, road_id, road_type, road_plate, tree_name, extra_large_num, large_num, medium_num, small_num, help_stump, cover_plate, grow_year, grow_spacing, growing, years, remark, create_user_id, create_date, update_user_id, update_date, del_flg
  35. </sql>
  36. <select id="selectStreetTreeListByRoadId"
  37. resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
  38. select
  39. *,
  40. if(extra_large_num is null, 0, extra_large_num) +
  41. if(large_num is null, 0, large_num) +
  42. if(medium_num is null, 0, medium_num) +
  43. if(small_num is null, 0, small_num) as sumNum
  44. from
  45. T_Lhzx_Street_Tree
  46. where
  47. del_flg = 0
  48. and
  49. road_id = #{roadId}
  50. </select>
  51. <select id="pageByBean" resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
  52. select
  53. temp.*
  54. from
  55. (<include refid="page"/>) temp
  56. where
  57. temp.sumNum > 0
  58. </select>
  59. <select id="getSumTreeCount" resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
  60. select
  61. sum(temp.sumNum) as sumNum
  62. from
  63. (<include refid="page"/>) temp
  64. </select>
  65. <select id="selectStreetTreePage" resultType="com.yt.zhylplat.moduleLhzx.road.vo.TLhzxStreetTreeVO">
  66. select
  67. temp.section_name,
  68. temp.maintenance_company_name,
  69. temp.road_code,
  70. temp.road_name,
  71. temp.road_start_spot,
  72. temp.road_end_spot,
  73. temp.tree_name,
  74. temp.extra_large_num,
  75. temp.large_num,
  76. temp.medium_num,
  77. temp.small_num,
  78. temp.cover_plate,
  79. temp.road_type,
  80. temp.road_plate,
  81. temp.help_stump,
  82. temp.grow_year,
  83. temp.grow_spacing,
  84. temp.growing,
  85. temp.remark
  86. from
  87. (<include refid="page"/>) temp
  88. where
  89. temp.sumNum > 0
  90. </select>
  91. <select id="getByBean" resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
  92. select
  93. st.maintenance_company_id,
  94. st.section_id,
  95. st.road_id,
  96. r.road_code,
  97. r.road_name,
  98. r.road_start_spot,
  99. r.road_end_spot,
  100. sum(
  101. if(extra_large_num is null, 0, extra_large_num) +
  102. if(large_num is null, 0, large_num) +
  103. if(medium_num is null, 0, medium_num) +
  104. if(small_num is null, 0, small_num)
  105. ) as totalCount
  106. from
  107. T_Lhzx_Street_Tree st
  108. left join
  109. T_Lhzx_Road r on st.road_id = r.id
  110. where
  111. st.maintenance_company_id = #{maintenanceCompanyId}
  112. and
  113. st.section_id = #{sectionId}
  114. and
  115. st.road_id = #{roadId}
  116. and
  117. st.del_flg = 0
  118. group by
  119. st.maintenance_company_id,
  120. st.section_id,
  121. st.road_id,
  122. r.road_code,
  123. r.road_name,
  124. r.road_start_spot,
  125. r.road_end_spot
  126. </select>
  127. <!-- 查询分页sql -->
  128. <sql id="page">
  129. select
  130. st.*,
  131. r.road_code,
  132. r.road_name,
  133. if(st.extra_large_num is null, 0, st.extra_large_num) +
  134. if(st.large_num is null, 0, st.large_num) +
  135. if(st.medium_num is null, 0, st.medium_num) +
  136. if(st.small_num is null, 0, st.small_num) as sumNum
  137. from
  138. T_Lhzx_Street_Tree st
  139. left join
  140. T_Lhzx_Road r on st.road_id = r.id
  141. where
  142. st.del_flg = 0
  143. <if test="tLhzxStreetTree.sectionId != null">
  144. and st.section_id = #{tLhzxStreetTree.sectionId}
  145. </if>
  146. <if test="tLhzxStreetTree.sectionName != null and tLhzxStreetTree.sectionName != ''">
  147. and st.section_name like concat('%', #{tLhzxStreetTree.sectionName}, '%')
  148. </if>
  149. <if test="tLhzxStreetTree.maintenanceCompanyId != null">
  150. and st.maintenance_company_id = #{tLhzxStreetTree.maintenanceCompanyId}
  151. </if>
  152. <if test="tLhzxStreetTree.maintenanceCompanyName != null and tLhzxStreetTree.maintenanceCompanyName != ''">
  153. and st.maintenance_company_name like concat('%', #{tLhzxStreetTree.maintenanceCompanyName}, '%')
  154. </if>
  155. <if test="tLhzxStreetTree.roadId != null">
  156. and st.road_id = #{tLhzxStreetTree.roadId}
  157. </if>
  158. <if test="tLhzxStreetTree.roadCode != null and tLhzxStreetTree.roadCode != ''">
  159. and r.road_code like concat('%', #{tLhzxStreetTree.roadCode}, '%')
  160. </if>
  161. <if test="tLhzxStreetTree.roadName != null and tLhzxStreetTree.roadName != ''">
  162. and r.road_name like concat('%', #{tLhzxStreetTree.roadName}, '%')
  163. </if>
  164. <if test="tLhzxStreetTree.treeName != null and tLhzxStreetTree.treeName != ''">
  165. and st.tree_name like concat('%', #{tLhzxStreetTree.treeName}, '%')
  166. </if>
  167. order by
  168. st.section_id, st.maintenance_company_id
  169. </sql>
  170. </mapper>