BusSdtzMapper.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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.BusSdtzMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BusSdtz">
  6. <result column="id" property="id"/>
  7. <result column="dept_id" property="deptId"/>
  8. <result column="dept_name" property="deptName"/>
  9. <result column="line_id" property="lineId"/>
  10. <result column="line_name" property="lineName"/>
  11. <result column="station_id" property="stationId"/>
  12. <result column="station_name" property="stationName"/>
  13. <result column="dept_station_id" property="deptStationId"/>
  14. <result column="sdmc" property="sdmc"/>
  15. <result column="lcgh" property="lcgh"/>
  16. <result column="start_marker" property="startMarker"/>
  17. <result column="end_marker" property="endMarker"/>
  18. <result column="center_marker" property="centerMarker"/>
  19. <result column="sdcd" property="sdcd"/>
  20. <result column="del_flag" property="delFlag"/>
  21. <result column="create_by" property="createBy"/>
  22. <result column="create_time" property="createTime"/>
  23. <result column="update_by" property="updateBy"/>
  24. <result column="update_time" property="updateTime"/>
  25. </resultMap>
  26. <sql id="Base_Column_List">
  27. t.id,
  28. v.dept_id,
  29. v.dept_name,
  30. v.line_id,
  31. v.line_name,
  32. v.station_name as station_name,
  33. v.station_id,
  34. t.dept_station_id,
  35. t.sdmc,
  36. t.lcgh,
  37. t.start_marker,
  38. t.end_marker,
  39. t.center_marker,
  40. t.sdcd,
  41. t.del_flag,
  42. t.create_by,
  43. t.create_time,
  44. t.update_by,
  45. t.update_time
  46. </sql>
  47. <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BusSdtz">
  48. <selectKey keyProperty="id" order="AFTER" resultType="Long">
  49. select @@IDENTITY as id
  50. </selectKey>
  51. INSERT INTO base_sdtz
  52. <trim prefix="(" suffix=")" suffixOverrides=",">
  53. <if test='null != deptStationId'>
  54. dept_station_id,
  55. </if>
  56. <if test='null != sdmc'>
  57. sdmc,
  58. </if>
  59. <if test='null != lcgh'>
  60. lcgh,
  61. </if>
  62. <if test='null != startMarker'>
  63. start_marker,
  64. </if>
  65. <if test='null != endMarker'>
  66. end_marker,
  67. </if>
  68. <if test='null != centerMarker'>
  69. center_marker,
  70. </if>
  71. <if test='null != sdcd'>
  72. sdcd,
  73. </if>
  74. <if test='null != delFlag'>
  75. del_flag,
  76. </if>
  77. <if test='null != createBy'>
  78. create_by,
  79. </if>
  80. <if test='null != createTime'>
  81. create_time,
  82. </if>
  83. <if test='null != updateBy'>
  84. update_by,
  85. </if>
  86. <if test='null != updateTime'>
  87. update_time
  88. </if>
  89. </trim>
  90. <trim prefix="values (" suffix=")" suffixOverrides=",">
  91. <if test='null != deptStationId'>
  92. #{deptStationId},
  93. </if>
  94. <if test='null != sdmc'>
  95. #{sdmc},
  96. </if>
  97. <if test='null != lcgh'>
  98. #{lcgh},
  99. </if>
  100. <if test='null != startMarker'>
  101. #{startMarker},
  102. </if>
  103. <if test='null != endMarker'>
  104. #{endMarker},
  105. </if>
  106. <if test='null != centerMarker'>
  107. #{centerMarker},
  108. </if>
  109. <if test='null != sdcd'>
  110. #{sdcd},
  111. </if>
  112. <if test='null != delFlag'>
  113. #{delFlag},
  114. </if>
  115. <if test='null != createBy'>
  116. #{createBy},
  117. </if>
  118. <if test='null != createTime'>
  119. #{createTime},
  120. </if>
  121. <if test='null != updateBy'>
  122. #{updateBy},
  123. </if>
  124. <if test='null != updateTime'>
  125. #{updateTime}
  126. </if>
  127. </trim>
  128. </insert>
  129. <delete id="delete">
  130. UPDATE base_sdtz
  131. set del_flag='1'
  132. WHERE id = #{id}
  133. </delete>
  134. <update id="update" parameterType="com.railway.business.baseinfo.domain.BusSdtz">
  135. UPDATE base_sdtz
  136. <set>
  137. <if test='null != deptStationId'>dept_station_id = #{deptStationId},</if>
  138. <if test='null != sdmc'>sdmc = #{sdmc},</if>
  139. <if test='null != lcgh'>lcgh = #{lcgh},</if>
  140. <if test='null != startMarker'>start_marker = #{startMarker},</if>
  141. <if test='null != endMarker'>end_marker = #{endMarker},</if>
  142. <if test='null != centerMarker'>center_marker = #{centerMarker},</if>
  143. <if test='null != sdcd'>sdcd = #{sdcd},</if>
  144. <if test='null != delFlag'>del_flag = #{delFlag},</if>
  145. <if test='null != updateBy'>update_by = #{updateBy},</if>
  146. <if test='null != updateTime'>update_time = #{updateTime}</if>
  147. </set>
  148. WHERE id = #{id}
  149. </update>
  150. <select id="getInfo" resultMap="BaseResultMap">
  151. SELECT
  152. <include refid="Base_Column_List"/>
  153. FROM base_sdtz t
  154. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  155. WHERE t.del_flag='0' and t.id = #{id}
  156. </select>
  157. <select id="getList" resultMap="BaseResultMap">
  158. SELECT
  159. <include refid="Base_Column_List"/>
  160. FROM base_sdtz t
  161. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  162. <where>
  163. t.del_flag='0'
  164. <if test="deptId!=null and deptId!=''">
  165. and v.dept_id=#{deptId}
  166. </if>
  167. <if test="lineId!=null and lineId!=''">
  168. and v.line_id=#{lineId}
  169. </if>
  170. <if test="stationId!=null and stationId!=''">
  171. and v.station_id=#{stationId}
  172. </if>
  173. <if test="sdmc!=null and sdmc!=''">
  174. and t.sdmc=#{sdmc}
  175. </if>
  176. <if test="lcgh!=null and lcgh!=''">
  177. and t.lcgh=#{lcgh}
  178. </if>
  179. <if test="startMarker!=null and startMarker!=''">
  180. and t.start_marker=#{startMarker}
  181. </if>
  182. <if test="endMarker!=null and endMarker!=''">
  183. and t.end_marker=#{endMarker}
  184. </if>
  185. <if test="centerMarker!=null and centerMarker!=''">
  186. and t.center_marker=#{centerMarker}
  187. </if>
  188. <if test="sdcd!=null and sdcd!=''">
  189. and t.sdcd=#{sdcd}
  190. </if>
  191. <if test="delFlag!=null and delFlag!=''">
  192. and t.del_flag=#{delFlag}
  193. </if>
  194. <if test="createBy!=null and createBy!=''">
  195. and t.create_by=#{createBy}
  196. </if>
  197. <if test="createTime!=null">
  198. and DATE_FORMAT(t.create_time, '%Y-%m-%d') = #{createTime}
  199. </if>
  200. <if test="updateBy!=null and updateBy!=''">
  201. and t.update_by=#{updateBy}
  202. </if>
  203. <if test="updateTime!=null">
  204. and DATE_FORMAT(t.update_time, '%Y-%m-%d') = #{updateTime}
  205. </if>
  206. </where>
  207. </select>
  208. <select id="smartQuery" resultMap="BaseResultMap">
  209. SELECT
  210. <include refid="Base_Column_List"/>
  211. from base_sdtz t
  212. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  213. <where>
  214. t.del_flag='0'
  215. <if test="deptId!=null and deptId!=''">
  216. and v.dept_id=#{deptId}
  217. </if>
  218. <if test="lineId!=null and lineId!=''">
  219. and v.line_id=#{lineId}
  220. </if>
  221. <if test="stationId!=null and stationId!=''">
  222. and v.station_id=#{stationId}
  223. </if>
  224. <if test="marker!=null and marker!=''">
  225. AND (
  226. (#{marker} + 0.0) - (#{pillarArea} + 0.0) BETWEEN (t.start_marker + 0.0) and (t.end_marker + 0.0)
  227. or
  228. (#{marker} + 0.0) + (#{pillarArea} + 0.0) BETWEEN (t.start_marker + 0.0) and (t.end_marker + 0.0)
  229. or
  230. (#{marker} + 0.0) BETWEEN (t.start_marker + 0.0) and (t.end_marker + 0.0)
  231. or
  232. (
  233. (t.start_marker + 0.0) &gt;= (#{marker} + 0.0) - (#{pillarArea} + 0.0)
  234. and
  235. (t.start_marker + 0.0) &lt;= (#{marker} + 0.0) + (#{pillarArea} + 0.0)
  236. )
  237. )
  238. </if>
  239. </where>
  240. </select>
  241. </mapper>