BaseStationMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.BaseStationMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.vo.BaseStationVo">
  6. <result column="station_id" property="stationId"/>
  7. <result column="line_id" property="lineId"/>
  8. <result column="line_name" property="lineName"/>
  9. <result column="station_name" property="stationName"/>
  10. <result column="station_type" property="stationType"/>
  11. <result column="station_type_text" property="stationTypeText"/>
  12. <result column="order_num" property="orderNum"/>
  13. <result column="start_marker" property="startMarker"/>
  14. <result column="end_marker" property="endMarker"/>
  15. <result column="del_flag" property="delFlag"/>
  16. <result column="create_by" property="createBy"/>
  17. <result column="create_time" property="createTime"/>
  18. <result column="update_by" property="updateBy"/>
  19. <result column="update_time" property="updateTime"/>
  20. </resultMap>
  21. <sql id="Base_Column_List">
  22. t.station_id,
  23. t.line_id,
  24. t.station_name,
  25. t.station_type,
  26. t.order_num,
  27. t.start_marker,
  28. t.end_marker,
  29. t.del_flag,
  30. t.create_by,
  31. t.create_time,
  32. t.update_by,
  33. t.update_time
  34. </sql>
  35. <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BaseStation">
  36. <selectKey keyProperty="stationId" order="AFTER" resultType="Long">
  37. select @@IDENTITY as station_id
  38. </selectKey>
  39. INSERT INTO base_station
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test='null != stationName'>
  42. station_name,
  43. </if>
  44. <if test='null != lineId'>
  45. line_id,
  46. </if>
  47. <if test='null != stationType'>
  48. station_type,
  49. </if>
  50. <if test='null != orderNum'>
  51. order_num,
  52. </if>
  53. <if test='null != startMarker'>
  54. start_marker,
  55. </if>
  56. <if test='null != endMarker'>
  57. end_marker,
  58. </if>
  59. <if test='null != delFlag'>
  60. del_flag,
  61. </if>
  62. <if test='null != createBy'>
  63. create_by,
  64. </if>
  65. <if test='null != createTime'>
  66. create_time,
  67. </if>
  68. <if test='null != updateBy'>
  69. update_by,
  70. </if>
  71. <if test='null != updateTime'>
  72. update_time
  73. </if>
  74. </trim>
  75. <trim prefix="values (" suffix=")" suffixOverrides=",">
  76. <if test='null != stationName'>
  77. #{stationName},
  78. </if>
  79. <if test='null != lineId'>
  80. #{lineId},
  81. </if>
  82. <if test='null != stationType'>
  83. #{stationType},
  84. </if>
  85. <if test='null != orderNum'>
  86. #{orderNum},
  87. </if>
  88. <if test='null != startMarker'>
  89. #{startMarker},
  90. </if>
  91. <if test='null != endMarker'>
  92. #{endMarker},
  93. </if>
  94. <if test='null != delFlag'>
  95. #{delFlag},
  96. </if>
  97. <if test='null != createBy'>
  98. #{createBy},
  99. </if>
  100. <if test='null != createTime'>
  101. #{createTime},
  102. </if>
  103. <if test='null != updateBy'>
  104. #{updateBy},
  105. </if>
  106. <if test='null != updateTime'>
  107. #{updateTime}
  108. </if>
  109. </trim>
  110. </insert>
  111. <delete id="delete">
  112. UPDATE base_station
  113. set del_flag='1'
  114. WHERE station_id = #{stationId}
  115. </delete>
  116. <update id="update" parameterType="com.railway.business.baseinfo.domain.BaseStation">
  117. UPDATE base_station
  118. <set>
  119. <if test='null != stationName'>station_name = #{stationName},</if>
  120. <if test='null != lineId'>line_id = #{lineId},</if>
  121. <if test='null != stationType'>station_type = #{stationType},</if>
  122. <if test='null != orderNum'>order_num = #{orderNum},</if>
  123. <if test='null != startMarker'>start_marker = #{startMarker},</if>
  124. <if test='null != endMarker'>end_marker = #{endMarker},</if>
  125. <if test='null != delFlag'>del_flag = #{delFlag},</if>
  126. <if test='null != updateBy'>update_by = #{updateBy},</if>
  127. <if test='null != updateTime'>update_time = #{updateTime}</if>
  128. </set>
  129. WHERE station_id = #{stationId}
  130. </update>
  131. <select id="getInfo" resultMap="BaseResultMap">
  132. SELECT
  133. <include refid="Base_Column_List"/>, v.line_name, dict.dict_label as station_type_text
  134. FROM base_station t
  135. left join sys_dict_data dict on t.station_type = dict.dict_value and dict.dict_type = 'station_type'
  136. left join base_dept_station v on t.station_id = t1.station_id
  137. WHERE t.del_flag='0' and t.station_id = #{stationId}
  138. </select>
  139. <select id="getList" resultMap="BaseResultMap">
  140. SELECT DISTINCT
  141. <include refid="Base_Column_List"/>, v.line_name, dict.dict_label as station_type_text
  142. FROM base_station t
  143. left join sys_dict_data dict on t.station_type = dict.dict_value and dict.dict_type = 'station_type'
  144. left join v_station v on t.station_id = v.station_id
  145. <where>
  146. t.del_flag='0'
  147. <if test="deptId!=null and deptId!=''">
  148. and v.dept_id=#{deptId}
  149. </if>
  150. <if test="lineId!=null and lineId!=''">
  151. and t.line_id=#{lineId}
  152. </if>
  153. <if test="stationName!=null and stationName!=''">
  154. and t.station_name like concat('%', #{stationName}, '%')
  155. </if>
  156. <if test="stationType!=null and stationType!=''">
  157. and t.station_type=#{stationType}
  158. </if>
  159. <if test="startMarker!=null and startMarker!=''">
  160. and t.start_marker <![CDATA[ >= ]]> #{startMarker}
  161. </if>
  162. <if test="endMarker!=null and endMarker!=''">
  163. and t.end_marker <![CDATA[ <= ]]> #{endMarker}
  164. </if>
  165. </where>
  166. </select>
  167. <select id="getStationList" resultMap="BaseResultMap">
  168. SELECT DISTINCT
  169. <include refid="Base_Column_List"/>, v.line_name, dict.dict_label as station_type_text
  170. FROM base_station t
  171. left join sys_dict_data dict on t.station_type = dict.dict_value and dict.dict_type = 'station_type'
  172. left join v_station v on t.station_id = v.station_id
  173. <where>
  174. t.del_flag='0'
  175. <if test="deptId!=null and deptId!=''">
  176. and v.dept_id=#{deptId}
  177. </if>
  178. <if test="lineId!=null and lineId!=''">
  179. and t.line_id=#{lineId}
  180. </if>
  181. <if test="stationName!=null and stationName!=''">
  182. and t.station_name like concat('%', #{stationName}, '%')
  183. </if>
  184. <if test="stationType!=null and stationType!=''">
  185. and t.station_type=#{stationType}
  186. </if>
  187. <if test="startMarker!=null and startMarker!=''">
  188. and t.start_marker <![CDATA[ >= ]]> #{startMarker}
  189. </if>
  190. <if test="endMarker!=null and endMarker!=''">
  191. and t.end_marker <![CDATA[ <= ]]> #{endMarker}
  192. </if>
  193. </where>
  194. </select>
  195. <resultMap id="JcabStationMap" type="com.railway.business.catenary.domain.vo.JcebStationVo">
  196. <result column="station_name" property="stationName"/>
  197. <result column="station_id" property="stationId"/>
  198. </resultMap>
  199. <select id="listStation" resultMap="JcabStationMap">
  200. SELECT distinct v.station_id, v.station_name
  201. FROM base_blq t
  202. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  203. <where>
  204. t.del_flag='0'
  205. <if test="deptId!=null and deptId!=''">
  206. and v.dept_id=#{deptId}
  207. </if>
  208. <if test="createBy!=null and createBy!=''">
  209. and t.create_by=#{createBy}
  210. </if>
  211. </where>
  212. </select>
  213. </mapper>