BusPreventMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.railway.business.baseinfo.mapper.BusPreventMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BusPrevent">
  6. <result column="prevent_id" property="preventId"/>
  7. <result column="prevent_type" property="preventType"/>
  8. <result column="dept_id" property="deptId"/>
  9. <result column="dept_name" property="deptName"/>
  10. <result column="line_id" property="lineId"/>
  11. <result column="line_name" property="lineName"/>
  12. <result column="xingbie" property="xingbie"/>
  13. <result column="xingbie_text" property="xingbieText"/>
  14. <result column="station_id" property="stationId"/>
  15. <result column="station_name" property="stationName"/>
  16. <result column="dept_station_id" property="deptStationId"/>
  17. <result column="pillar_code" property="pillarCode"/>
  18. <result column="marker" property="marker"/>
  19. <result column="risk_source" property="riskSource"/>
  20. <result column="measures" property="measures"/>
  21. <result column="remark" property="remark"/>
  22. <result column="fill_date" property="fillDate"/>
  23. <result column="fill_user" property="fillUser"/>
  24. <result column="pillar_area" property="pillarArea"/>
  25. <result column="pillar_count" property="pillarCount"/>
  26. <result column="line_type" property="lineType"/>
  27. <result column="rust_position" property="rustPosition"/>
  28. <result column="pillar_type" property="pillarType"/>
  29. <result column="terrain" property="terrain"/>
  30. <result column="iftransform" property="iftransform"/>
  31. <result column="specification" property="specification"/>
  32. <result column="display_num" property="displayNum"/>
  33. <result column="count" property="count"/>
  34. <result column="distance_horizontal" property="distanceHorizontal"/>
  35. <result column="distance_vertical" property="distanceVertical"/>
  36. <result column="kind" property="kind"/>
  37. <result column="severity" property="severity"/>
  38. <result column="property_rights" property="propertyRights"/>
  39. <result column="inquirer" property="inquirer"/>
  40. <result column="start_marker" property="startMarker"/>
  41. <result column="end_marker" property="endMarker"/>
  42. </resultMap>
  43. <!-- <sql id="Base_Column_List">
  44. prevent_id,
  45. prevent_type,
  46. dept_id,
  47. dept_name,
  48. line_id,
  49. line_name
  50. xingbie,
  51. station_id,
  52. station_name,
  53. pillar_code,
  54. marker,
  55. risk_source,
  56. measures,
  57. remark,
  58. fill_date,
  59. fill_user,
  60. pillar_area,
  61. pillar_count,
  62. line_type,
  63. rust_position,
  64. pillar_type,
  65. terrain,
  66. iftransform,
  67. specification,
  68. display_num,
  69. count,
  70. distance_horizontal,
  71. distance_vertical,
  72. kind,
  73. severity,
  74. property_rights.
  75. inquirer
  76. </sql>-->
  77. <select id="smartQuery" resultMap="BaseResultMap">
  78. SELECT
  79. v.prevent_id,
  80. v.prevent_type,
  81. v1.dept_id,
  82. v1.dept_name,
  83. v1.line_id,
  84. v1.line_name,
  85. v.xingbie,
  86. dict.dict_label xingbie_text,
  87. v1.station_id,
  88. v1.station_name,
  89. v.pillar_code,
  90. v.marker,
  91. v.risk_source,
  92. v.measures,
  93. v.remark,
  94. v.fill_date,
  95. v.fill_user,
  96. v.pillar_area,
  97. v.pillar_count,
  98. v.line_type,
  99. v.rust_position,
  100. v.pillar_type,
  101. v.terrain,
  102. v.iftransform,
  103. v.specification,
  104. v.display_num,
  105. v.count,
  106. v.distance_horizontal,
  107. v.distance_vertical,
  108. v.kind,
  109. v.severity,
  110. v.property_rights,
  111. v.inquirer,
  112. v.start_marker,
  113. v.end_marker
  114. FROM
  115. v_prevent v
  116. left join v_station v1 on v.dept_station_id = v1.dept_station_id
  117. LEFT JOIN sys_dict_data dict ON (v.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
  118. <where>
  119. <if test="deptId!=null and deptId!=''">
  120. and v1.dept_id=#{deptId}
  121. </if>
  122. <if test="lineId!=null and lineId!=''">
  123. and v1.line_id=#{lineId}
  124. </if>
  125. <if test="xingbie!=null and xingbie!=''">
  126. and (v.xingbie=#{xingbie} or v.xingbie is null or v.xingbie='')
  127. </if>
  128. <if test="stationId!=null and stationId!=''">
  129. and v1.station_id=#{stationId}
  130. </if>
  131. <!-- <if test="pillarCode!=null and pillarCode!=''">
  132. and v.pillar_code=#{pillarCode}
  133. </if>-->
  134. <if test="marker != null and marker != ''">
  135. AND (
  136. (#{marker} + 0.0) - (#{pillarArea} + 0.0) BETWEEN (v.start_marker + 0.0) and (v.end_marker + 0.0)
  137. or
  138. (#{marker} + 0.0) + (#{pillarArea} + 0.0) BETWEEN (v.start_marker + 0.0) and (v.end_marker + 0.0)
  139. or
  140. (#{marker} + 0.0) BETWEEN (v.start_marker + 0.0) and (v.end_marker + 0.0)
  141. or
  142. (
  143. (v.start_marker + 0.0) &gt;= (#{marker} + 0.0) - (#{pillarArea} + 0.0)
  144. and
  145. (v.start_marker + 0.0) &lt;= (#{marker} + 0.0) + (#{pillarArea} + 0.0)
  146. )
  147. )
  148. </if>
  149. </where>
  150. </select>
  151. </mapper>