BusJlgzMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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.catenary.mapper.BusJlgzMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.catenary.domain.BusJlgz">
  6. <result column="id" property="id"/>
  7. <result column="line_id" property="lineId"/>
  8. <result column="line_name" property="lineName"/>
  9. <result column="substation_id" property="substationId"/>
  10. <result column="substation_name" property="substationName"/>
  11. <result column="xingbie" property="xingbie"/>
  12. <result column="marker" property="marker"/>
  13. <result column="yylx" property="yylx"/>
  14. <result column="operation_date" property="operationDate"/>
  15. <result column="gzms" property="gzms"/>
  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. <result column="del_flag" property="delFlag"/>
  21. <result column="yylx_text" property="yylxText"/>
  22. <result column="xingbie_text" property="xingbieText"/>
  23. </resultMap>
  24. <sql id="Base_Column_List">
  25. t.id,
  26. v.line_id,
  27. v.line_name,
  28. t.substation_id,
  29. v.substation_name,
  30. t.xingbie,
  31. t.marker,
  32. t.yylx,
  33. t.operation_date,
  34. t.gzms,
  35. t.create_by,
  36. t.create_time,
  37. t.update_by,
  38. t.update_time,
  39. t.del_flag
  40. </sql>
  41. <insert id="insert" parameterType="com.railway.business.catenary.domain.BusJlgz">
  42. <selectKey keyProperty="id" order="AFTER" resultType="Long">
  43. select @@IDENTITY as id
  44. </selectKey>
  45. INSERT INTO base_jlgz
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test='null != substationId'>
  48. substation_id,
  49. </if>
  50. <if test='null != xingbie'>
  51. xingbie,
  52. </if>
  53. <if test='null != marker'>
  54. marker,
  55. </if>
  56. <if test='null != yylx'>
  57. yylx,
  58. </if>
  59. <if test='null != operationDate'>
  60. operation_date,
  61. </if>
  62. <if test='null != gzms'>
  63. gzms,
  64. </if>
  65. <if test='null != createBy'>
  66. create_by,
  67. </if>
  68. <if test='null != createTime'>
  69. create_time,
  70. </if>
  71. <if test='null != updateBy'>
  72. update_by,
  73. </if>
  74. <if test='null != updateTime'>
  75. update_time,
  76. </if>
  77. <if test='null != delFlag'>
  78. del_flag
  79. </if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test='null != substationId'>
  83. #{substationId},
  84. </if>
  85. <if test='null != xingbie'>
  86. #{xingbie},
  87. </if>
  88. <if test='null != marker'>
  89. #{marker},
  90. </if>
  91. <if test='null != yylx'>
  92. #{yylx},
  93. </if>
  94. <if test='null != operationDate'>
  95. #{operationDate},
  96. </if>
  97. <if test='null != gzms'>
  98. #{gzms},
  99. </if>
  100. <if test='null != createBy'>
  101. #{createBy},
  102. </if>
  103. <if test='null != createTime'>
  104. #{createTime},
  105. </if>
  106. <if test='null != updateBy'>
  107. #{updateBy},
  108. </if>
  109. <if test='null != updateTime'>
  110. #{updateTime},
  111. </if>
  112. <if test='null != delFlag'>
  113. #{delFlag}
  114. </if>
  115. </trim>
  116. </insert>
  117. <delete id="delete">
  118. UPDATE base_jlgz
  119. set del_flag='1'
  120. WHERE id = #{id}
  121. </delete>
  122. <update id="update" parameterType="com.railway.business.catenary.domain.BusJlgz">
  123. UPDATE base_jlgz
  124. <set>
  125. <if test='null != substationId'>substation_id = #{substationId},</if>
  126. <if test='null != xingbie'>xingbie = #{xingbie},</if>
  127. <if test='null != marker'>marker = #{marker},</if>
  128. <if test='null != yylx'>yylx = #{yylx},</if>
  129. <if test='null != operationDate'>operation_date = #{operationDate},</if>
  130. <if test='null != gzms'>gzms = #{gzms},</if>
  131. <if test='null != updateBy'>update_by = #{updateBy},</if>
  132. <if test='null != updateTime'>update_time = #{updateTime},</if>
  133. <if test='null != delFlag'>del_flag = #{delFlag}</if>
  134. </set>
  135. WHERE id = #{id}
  136. </update>
  137. <select id="getInfo" resultMap="BaseResultMap">
  138. SELECT
  139. DISTINCT
  140. <include refid="Base_Column_List"/> ,
  141. dict1.dict_label as xingbie_text,
  142. dict2.dict_label as yylx_text
  143. FROM
  144. base_jlgz t
  145. LEFT JOIN v_substation v ON t.substation_id = v.substation_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.yylx = dict2.dict_value AND dict2.dict_type = 'gzyy')
  148. WHERE
  149. t.del_flag = '0'
  150. AND t.id = #{id}
  151. </select>
  152. <select id="getList" resultMap="BaseResultMap">
  153. SELECT
  154. dict1.dict_label as xingbie_text,
  155. dict2.dict_label as yylx_text,
  156. <include refid="Base_Column_List"/>
  157. FROM
  158. base_jlgz t
  159. LEFT JOIN v_substation v ON t.substation_id = v.substation_id
  160. LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
  161. LEFT JOIN sys_dict_data dict2 ON (t.yylx = dict2.dict_value AND dict2.dict_type = 'gzyy')
  162. <where>
  163. t.del_flag = '0'
  164. AND dict1.status = '0'
  165. AND dict2.status = '0'
  166. <if test="lineId!=null and lineId!=''">
  167. and t.line_id=#{lineId}
  168. </if>
  169. <if test="substationId!=null and substationId!=''">
  170. and t.substation_id=#{substationId}
  171. </if>
  172. <if test="xingbie!=null and xingbie!=''">
  173. and t.xingbie=#{xingbie}
  174. </if>
  175. <if test="marker!=null and marker!=''">
  176. and t.marker=#{marker}
  177. </if>
  178. <if test="yylx!=null and yylx!=''">
  179. and t.yylx=#{yylx}
  180. </if>
  181. <if test="operationDate!=null and operationDate!=''">
  182. and t.operation_date=#{operationDate}
  183. </if>
  184. <if test="gzms!=null and gzms!=''">
  185. and t.gzms=#{gzms}
  186. </if>
  187. <if test="createBy!=null and createBy!=''">
  188. and t.create_by=#{createBy}
  189. </if>
  190. <if test="createTime!=null and createTime!=''">
  191. and t.create_time=#{createTime}
  192. </if>
  193. <if test="updateBy!=null and updateBy!=''">
  194. and t.update_by=#{updateBy}
  195. </if>
  196. <if test="updateTime!=null and updateTime!=''">
  197. and t.update_time=#{updateTime}
  198. </if>
  199. <if test="delFlag!=null and delFlag!=''">
  200. and t.del_flag=#{delFlag}
  201. </if>
  202. </where>
  203. <if test="orderBy!=null and orderBy!=''">
  204. order by t.${orderBy}
  205. </if>
  206. <if test="isAsc!=null and isAsc!=''">
  207. <if test="isAsc == '1'.toString()">
  208. asc
  209. </if>
  210. <if test="isAsc == '0'.toString()">
  211. desc
  212. </if>
  213. </if>
  214. </select>
  215. <select id="getListByZz" resultType="com.railway.business.catenary.domain.vo.BusJlgzListByZzVo">
  216. SELECT dictYylx.dict_value as yylx, dictYylx.dict_label as yylxText, ifnull(res.total,0) as total FROM
  217. (
  218. SELECT jlgz.yylx, jlgz.yylx_text as yylxText, count(1) as total FROM
  219. (
  220. SELECT
  221. dict2.dict_label as yylx_text,
  222. t.yylx
  223. FROM base_jlgz t
  224. LEFT JOIN v_substation v ON t.substation_id = v.substation_id
  225. LEFT JOIN sys_dict_data dict2 ON (t.yylx = dict2.dict_value AND dict2.dict_type = 'gzyy')
  226. WHERE t.del_flag = '0'
  227. <if test="query.lineId != null and query.lineId != ''">
  228. AND v.line_id = #{query.lineId}
  229. </if>
  230. <if test="query.xingbie != null and query.xingbie != ''">
  231. AND t.xingbie = #{query.xingbie}
  232. </if>
  233. <if test="query.marker != null and query.marker != ''">
  234. AND (t.marker + 0.0) BETWEEN (#{query.marker} + 0.0) - (#{query.pillarArea} + 0.0)
  235. AND (#{query.marker} + 0.0) + (#{query.pillarArea} + 0.0)
  236. </if>
  237. ) jlgz
  238. GROUP BY jlgz.yylx
  239. ) res right join sys_dict_data dictYylx on res.yylx = dictYylx.dict_value
  240. where dictYylx.dict_type = 'gzyy'
  241. </select>
  242. </mapper>