BusFjxgmdMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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="dept_station_id" property="deptStationId"/>
  14. <result column="xingbie" property="xingbie"/>
  15. <result column="fjlx" property="fjlx"/>
  16. <result column="qsglb" property="qsglb"/>
  17. <result column="qsgh" property="qsgh"/>
  18. <result column="del_flag" property="delFlag"/>
  19. <result column="create_by" property="createBy"/>
  20. <result column="create_time" property="createTime"/>
  21. <result column="update_by" property="updateBy"/>
  22. <result column="update_time" property="updateTime"/>
  23. <result column="dept_name" property="deptName"/>
  24. <result column="line_name" property="lineName"/>
  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.dept_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="AFTER" resultType="Long">
  44. select @@IDENTITY as id
  45. </selectKey>
  46. INSERT INTO base_fjxgmd
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test='null != deptStationId'>
  49. dept_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 != deptStationId'>
  81. #{deptStationId},
  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 != deptStationId'>dept_station_id = #{deptStationId},</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 != updateBy'>update_by = #{updateBy},</if>
  127. <if test='null != updateTime'>update_time = #{updateTime}</if>
  128. </set>
  129. WHERE id = #{id}
  130. </update>
  131. <select id="getInfo" resultMap="BaseResultMap">
  132. SELECT
  133. DISTINCT
  134. v.dept_name,
  135. v.line_name,
  136. v.station_name,
  137. v.station_id,
  138. v.dept_id,
  139. v.line_id,
  140. dict1.dict_label as xingbie_text,
  141. dict2.dict_label as fjlx_text,
  142. <include refid="Base_Column_List"/>
  143. FROM
  144. base_fjxgmd t
  145. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  146. LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  147. LEFT JOIN sys_dict_data dict2 ON (t.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  148. WHERE t.del_flag = '0'
  149. and dict1.status = '0'
  150. and dict2.status = '0'
  151. and t.id = #{id}
  152. </select>
  153. <select id="getList" resultMap="BaseResultMap">
  154. SELECT
  155. v.dept_name,
  156. v.line_name,
  157. v.station_name,
  158. v.station_id,
  159. v.dept_id,
  160. v.line_id,
  161. dict1.dict_label as xingbie_text,
  162. dict2.dict_label as fjlx_text,
  163. <include refid="Base_Column_List"/>
  164. FROM
  165. base_fjxgmd t
  166. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  167. LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  168. LEFT JOIN sys_dict_data dict2 ON (t.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  169. <where>
  170. t.del_flag = '0'
  171. and dict1.status = '0'
  172. and dict2.status = '0'
  173. <if test="deptId!=null and deptId!=''">
  174. and v.dept_id=#{deptId}
  175. </if>
  176. <if test="lineId!=null and lineId!=''">
  177. and v.line_id=#{lineId}
  178. </if>
  179. <if test="stationId!=null and stationId!=''">
  180. and v.station_id=#{stationId}
  181. </if>
  182. <if test="xingbie!=null and xingbie!=''">
  183. and t.xingbie=#{xingbie}
  184. </if>
  185. <if test="fjlx!=null and fjlx!=''">
  186. and t.fjlx=#{fjlx}
  187. </if>
  188. <if test="qsglb!=null and qsglb!=''">
  189. and t.qsglb=#{qsglb}
  190. </if>
  191. <if test="qsgh!=null and qsgh!=''">
  192. and t.qsgh=#{qsgh}
  193. </if>
  194. <if test="pillarArea!=null and pillarArea!=''">
  195. and t.qsglb BETWEEN (t.qsglb + 0.0) - (#{pillarArea} + 0.0) AND (t.qsglb + 0.0) + (#{pillarArea} + 0.0)
  196. </if>
  197. <if test="delFlag!=null and delFlag!=''">
  198. and t.del_flag=#{delFlag}
  199. </if>
  200. <if test="createBy!=null and createBy!=''">
  201. and t.create_by=#{createBy}
  202. </if>
  203. <if test="createTime!=null and createTime!=''">
  204. and t.create_time=#{createTime}
  205. </if>
  206. <if test="updateBy!=null and updateBy!=''">
  207. and t.update_by=#{updateBy}
  208. </if>
  209. <if test="updateTime!=null and updateTime!=''">
  210. and t.update_time=#{updateTime}
  211. </if>
  212. </where>
  213. </select>
  214. <select id="getListByZz" resultMap="BaseResultMap">
  215. SELECT
  216. a.id,
  217. v.dept_id,
  218. v.dept_name,
  219. v.line_name,
  220. v.station_name,
  221. a.qsgh,
  222. a.qsglb,
  223. v.station_id,
  224. a.xingbie,
  225. a.fjlx,
  226. dict1.dict_label as xingbie_text,
  227. dict2.dict_label AS fjlx_text,
  228. ${query.pillarArea} AS pillar_area
  229. FROM base_fjxgmd a
  230. LEFT JOIN v_station v ON a.dept_station_id = v.dept_station_id
  231. LEFT JOIN sys_dict_data dict1 ON (a.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  232. LEFT JOIN sys_dict_data dict2 ON (a.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  233. WHERE a.del_flag = '0'
  234. and dict1.status = '0'
  235. and dict2.status = '0'
  236. <if test="query.lineId != null and query.lineId != ''">
  237. AND v.line_id = #{query.lineId}
  238. </if>
  239. <if test="query.xingbie != null and query.xingbie != ''">
  240. AND a.xingbie = #{query.xingbie}
  241. </if>
  242. <if test="query.marker != null and query.marker != ''">
  243. AND (a.qsglb + 0.0) BETWEEN (#{query.marker} + 0.0) - (#{query.pillarArea} + 0.0)
  244. AND (#{query.marker} + 0.0) + (#{query.pillarArea} + 0.0)
  245. </if>
  246. ORDER BY (a.qsglb + 0)
  247. </select>
  248. </mapper>