BusFjxgmdMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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.BusFjxgmdMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BusFjxgmd">
  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="xingbie" property="xingbie"/>
  14. <result column="fjlx" property="fjlx"/>
  15. <result column="qsglb" property="qsglb"/>
  16. <result column="qsgh" property="qsgh"/>
  17. <result column="del_flag" property="delFlag"/>
  18. <result column="create_by" property="createBy"/>
  19. <result column="create_time" property="createTime"/>
  20. <result column="update_by" property="updateBy"/>
  21. <result column="update_time" property="updateTime"/>
  22. <result column="dept_name" property="deptName"/>
  23. <result column="line_name" property="lineName"/>
  24. <result column="station_name" property="stationName"/>
  25. <result column="xingbie_text" property="xingbieText"/>
  26. <result column="fjlx_text" property="fjlxText"/>
  27. <result column="pillar_area" property="pillarArea"/>
  28. </resultMap>
  29. <sql id="Base_Column_List">
  30. t.id,
  31. t.station_id,
  32. t.xingbie,
  33. t.fjlx,
  34. t.qsglb,
  35. t.qsgh,
  36. t.del_flag,
  37. t.create_by,
  38. t.create_time,
  39. t.update_by,
  40. t.update_time
  41. </sql>
  42. <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BusFjxgmd">
  43. <selectKey keyProperty="id" order="BEFORE" resultType="String">
  44. select replace(uuid(), '-', '') from dual
  45. </selectKey>
  46. INSERT INTO base_fjxgmd
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test='null != stationId'>
  49. station_id,
  50. </if>
  51. <if test='null != xingbie'>
  52. xingbie,
  53. </if>
  54. <if test='null != fjlx'>
  55. fjlx,
  56. </if>
  57. <if test='null != qsglb'>
  58. qsglb,
  59. </if>
  60. <if test='null != qsgh'>
  61. qsgh,
  62. </if>
  63. <if test='null != delFlag'>
  64. del_flag,
  65. </if>
  66. <if test='null != createBy'>
  67. create_by,
  68. </if>
  69. <if test='null != createTime'>
  70. create_time,
  71. </if>
  72. <if test='null != updateBy'>
  73. update_by,
  74. </if>
  75. <if test='null != updateTime'>
  76. update_time
  77. </if>
  78. </trim>
  79. <trim prefix="values (" suffix=")" suffixOverrides=",">
  80. <if test='null != stationId'>
  81. #{stationId},
  82. </if>
  83. <if test='null != xingbie'>
  84. #{xingbie},
  85. </if>
  86. <if test='null != fjlx'>
  87. #{fjlx},
  88. </if>
  89. <if test='null != qsglb'>
  90. #{qsglb},
  91. </if>
  92. <if test='null != qsgh'>
  93. #{qsgh},
  94. </if>
  95. <if test='null != delFlag'>
  96. #{delFlag},
  97. </if>
  98. <if test='null != createBy'>
  99. #{createBy},
  100. </if>
  101. <if test='null != createTime'>
  102. #{createTime},
  103. </if>
  104. <if test='null != updateBy'>
  105. #{updateBy},
  106. </if>
  107. <if test='null != updateTime'>
  108. #{updateTime}
  109. </if>
  110. </trim>
  111. </insert>
  112. <delete id="delete">
  113. UPDATE base_fjxgmd
  114. set del_flag='1'
  115. WHERE id = #{id}
  116. </delete>
  117. <update id="update" parameterType="com.railway.business.baseinfo.domain.BusFjxgmd">
  118. UPDATE base_fjxgmd
  119. <set>
  120. <if test='null != stationId'>station_id = #{stationId},</if>
  121. <if test='null != xingbie'>xingbie = #{xingbie},</if>
  122. <if test='null != fjlx'>fjlx = #{fjlx},</if>
  123. <if test='null != qsglb'>qsglb = #{qsglb},</if>
  124. <if test='null != qsgh'>qsgh = #{qsgh},</if>
  125. <if test='null != delFlag'>del_flag = #{delFlag},</if>
  126. <if test='null != createBy'>create_by = #{createBy},</if>
  127. <if test='null != createTime'>create_time = #{createTime},</if>
  128. <if test='null != updateBy'>update_by = #{updateBy},</if>
  129. <if test='null != updateTime'>update_time = #{updateTime}</if>
  130. </set>
  131. WHERE id = #{id}
  132. </update>
  133. <select id="getInfo" resultMap="BaseResultMap">
  134. SELECT
  135. DISTINCT
  136. v.dept_name,
  137. v.line_name,
  138. v.station_name,
  139. v.dept_id,
  140. v.line_id,
  141. dict1.dict_label as xingbie_text,
  142. dict2.dict_label as fjlx_text,
  143. <include refid="Base_Column_List"/>
  144. FROM
  145. base_fjxgmd t
  146. LEFT JOIN v_station v ON t.station_id = v.station_id
  147. LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  148. LEFT JOIN sys_dict_data dict2 ON (t.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  149. WHERE t.del_flag = '0' AND t.id = #{id}
  150. </select>
  151. <select id="getList" resultMap="BaseResultMap">
  152. SELECT
  153. v.dept_name,
  154. v.line_name,
  155. v.station_name,
  156. v.dept_id,
  157. v.line_id,
  158. dict1.dict_label as xingbie_text,
  159. dict2.dict_label as fjlx_text,
  160. <include refid="Base_Column_List"/>
  161. FROM
  162. base_fjxgmd t
  163. LEFT JOIN v_station v ON t.station_id = v.station_id
  164. LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  165. LEFT JOIN sys_dict_data dict2 ON (t.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  166. <where>
  167. t.del_flag = '0'
  168. <if test="deptId!=null and deptId!=''">
  169. and v.dept_id=#{deptId}
  170. </if>
  171. <if test="lineId!=null and lineId!=''">
  172. and v.line_id=#{lineId}
  173. </if>
  174. <if test="stationId!=null and stationId!=''">
  175. and t.station_id=#{stationId}
  176. </if>
  177. <if test="xingbie!=null and xingbie!=''">
  178. and t.xingbie=#{xingbie}
  179. </if>
  180. <if test="fjlx!=null and fjlx!=''">
  181. and t.fjlx=#{fjlx}
  182. </if>
  183. <if test="qsglb!=null and qsglb!=''">
  184. and t.qsglb=#{qsglb}
  185. </if>
  186. <if test="qsgh!=null and qsgh!=''">
  187. and t.qsgh=#{qsgh}
  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="getListByZz" resultMap="BaseResultMap">
  207. SELECT D.* FROM
  208. (
  209. SELECT a.id,
  210. a.qsgh,
  211. a.qsglb,
  212. v.dept_id,
  213. v.station_name,
  214. a.station_id,
  215. a.xingbie,
  216. a.fjlx,
  217. v.dept_name,
  218. v.line_name,
  219. dict1.dict_label AS xingbie_text,
  220. dict2.dict_label AS fjlx_text,
  221. ${query.pillarArea} AS pillar_area
  222. FROM base_fjxgmd a
  223. LEFT JOIN v_station v ON a.station_id = v.station_id
  224. LEFT JOIN sys_dict_data dict1 ON (a.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  225. LEFT JOIN sys_dict_data dict2 ON (a.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  226. WHERE a.del_flag = '0'
  227. ) D ,
  228. (
  229. SELECT zzdzxx.pillar_code
  230. FROM base_pillar zzdzxx,
  231. (
  232. SELECT zz.id,
  233. zz.pillar_code,
  234. zz.marker
  235. FROM base_pillar zz
  236. LEFT JOIN v_station v ON zz.station_id = v.station_id
  237. WHERE 1 = 1
  238. <if test="query.qsgh != null and query.qsgh != ''">
  239. AND zz.pillar_code = #{query.qsgh}
  240. </if>
  241. <if test="query.qsglb != null and query.qsglb != ''">
  242. AND zz.marker = #{query.qsglb}
  243. </if>
  244. <if test="query.deptId != null and query.deptId != ''">
  245. AND v.dept_id = #{query.deptId}
  246. </if>
  247. <if test="query.lineId != null and query.lineId != ''">
  248. AND v.line_id = #{query.lineId}
  249. </if>
  250. <if test="query.stationId != null and query.stationId != ''">
  251. AND v.station_id = #{query.stationId}
  252. </if>
  253. <if test="query.xingbie != null and query.xingbie != ''">
  254. AND zz.xingbie = #{query.xingbie}
  255. </if>
  256. ) B
  257. WHERE (zzdzxx.marker + 0.0) BETWEEN (B.marker + 0.0) - (#{query.pillarArea} + 0.0) AND (B.marker + 0.0) +
  258. (#{query.pillarArea} + 0.0)
  259. ) H
  260. WHERE D.qsgh = H.pillar_code
  261. ORDER BY (D.qsgh + 0)
  262. </select>
  263. </mapper>