BusFjxgmdMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. DISTINCT
  156. v.dept_name,
  157. v.line_name,
  158. v.station_name,
  159. v.station_id,
  160. v.dept_id,
  161. v.line_id,
  162. dict1.dict_label as xingbie_text,
  163. dict2.dict_label as fjlx_text,
  164. <include refid="Base_Column_List"/>
  165. FROM
  166. base_fjxgmd t
  167. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  168. LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  169. LEFT JOIN sys_dict_data dict2 ON (t.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  170. <where>
  171. t.del_flag = '0'
  172. and dict1.status = '0'
  173. and dict2.status = '0'
  174. <if test="deptId!=null and deptId!=''">
  175. and v.dept_id=#{deptId}
  176. </if>
  177. <if test="lineId!=null and lineId!=''">
  178. and v.line_id=#{lineId}
  179. </if>
  180. <if test="stationId!=null and stationId!=''">
  181. and v.station_id=#{stationId}
  182. </if>
  183. <if test="xingbie!=null and xingbie!=''">
  184. and t.xingbie=#{xingbie}
  185. </if>
  186. <if test="fjlx!=null and fjlx!=''">
  187. and t.fjlx=#{fjlx}
  188. </if>
  189. <if test="qsglb!=null and qsglb!=''">
  190. and t.qsglb=#{qsglb}
  191. </if>
  192. <if test="qsgh!=null and qsgh!=''">
  193. and t.qsgh=#{qsgh}
  194. </if>
  195. <if test="pillarArea!=null and pillarArea!=''">
  196. and t.qsglb BETWEEN (t.qsglb + 0.0) - (#{pillarArea} + 0.0) AND (t.qsglb + 0.0) + (#{pillarArea} + 0.0)
  197. </if>
  198. <if test="delFlag!=null and delFlag!=''">
  199. and t.del_flag=#{delFlag}
  200. </if>
  201. <if test="createBy!=null and createBy!=''">
  202. and t.create_by=#{createBy}
  203. </if>
  204. <if test="createTime!=null">
  205. and DATE_FORMAT(t.create_time, '%Y-%m-%d') = #{createTime}
  206. </if>
  207. <if test="updateBy!=null and updateBy!=''">
  208. and t.update_by=#{updateBy}
  209. </if>
  210. <if test="updateTime!=null">
  211. and DATE_FORMAT(t.update_time, '%Y-%m-%d') = #{updateTime}
  212. </if>
  213. </where>
  214. </select>
  215. <select id="getListByZz" resultMap="BaseResultMap">
  216. SELECT
  217. DISTINCT
  218. a.id,
  219. v.dept_id,
  220. v.dept_name,
  221. v.line_name,
  222. v.station_name,
  223. a.qsgh,
  224. a.qsglb,
  225. v.station_id,
  226. a.xingbie,
  227. a.fjlx,
  228. dict1.dict_label as xingbie_text,
  229. dict2.dict_label AS fjlx_text,
  230. ${query.pillarArea} AS pillar_area
  231. FROM base_fjxgmd a
  232. LEFT JOIN v_station v ON a.dept_station_id = v.dept_station_id
  233. LEFT JOIN sys_dict_data dict1 ON (a.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  234. LEFT JOIN sys_dict_data dict2 ON (a.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
  235. WHERE a.del_flag = '0'
  236. and dict1.status = '0'
  237. and dict2.status = '0'
  238. <if test="query.lineId != null and query.lineId != ''">
  239. AND v.line_id = #{query.lineId}
  240. </if>
  241. <if test="query.xingbie != null and query.xingbie != ''">
  242. AND a.xingbie = #{query.xingbie}
  243. </if>
  244. <if test="query.marker != null and query.marker != ''">
  245. AND (a.qsglb + 0.0) BETWEEN (#{query.marker} + 0.0) - (#{query.pillarArea} + 0.0)
  246. AND (#{query.marker} + 0.0) + (#{query.pillarArea} + 0.0)
  247. </if>
  248. ORDER BY (a.qsglb + 0)
  249. </select>
  250. </mapper>