BusSdtzMapper.xml 7.0 KB

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