BusFjxgmdMapper.xml 8.3 KB

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