BusJcebLbjghjlMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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.BusJcebLbjghjlMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.catenary.domain.BusJcebLbjghjl">
  6. <result column="id" property="id"/>
  7. <result column="station_id" property="stationId"/>
  8. <result column="station_name" property="stationName"/>
  9. <result column="dept_station_id" property="deptStationId"/>
  10. <result column="dd" property="dd"/>
  11. <result column="ghq_mc" property="ghqMc"/>
  12. <result column="ghq_ggxh" property="ghqGgxh"/>
  13. <result column="ghq_sccj" property="ghqSccj"/>
  14. <result column="ghh_mc" property="ghhMc"/>
  15. <result column="ghh_ggxh" property="ghhGgxh"/>
  16. <result column="ghh_sccj" property="ghhSccj"/>
  17. <result column="ghyy" property="ghyy"/>
  18. <result column="operation_date" property="operationDate"/>
  19. <result column="operator" property="operator"/>
  20. <result column="remark" property="remark"/>
  21. <result column="submit_state" property="submitState"/>
  22. <result column="del_flag" property="delFlag"/>
  23. <result column="create_by" property="createBy"/>
  24. <result column="create_time" property="createTime"/>
  25. <result column="update_by" property="updateBy"/>
  26. <result column="update_time" property="updateTime"/>
  27. </resultMap>
  28. <sql id="Base_Column_List">
  29. id,
  30. dept_station_id,
  31. station_name,
  32. dd,
  33. ghq_mc,
  34. ghq_ggxh,
  35. ghq_sccj,
  36. ghh_mc,
  37. ghh_ggxh,
  38. ghh_sccj,
  39. ghyy,
  40. operation_date,
  41. operator,
  42. remark,
  43. submit_state,
  44. del_flag,
  45. create_by,
  46. create_time,
  47. update_by,
  48. update_time
  49. </sql>
  50. <insert id="insert" parameterType="com.railway.business.catenary.domain.BusJcebLbjghjl">
  51. <selectKey keyProperty="id" order="AFTER" resultType="Long">
  52. select @@IDENTITY as line_id
  53. </selectKey>
  54. INSERT INTO bus_jceb_lbjghjl
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test='null != deptStationId'>
  57. dept_station_id,
  58. </if>
  59. <if test='null != dd'>
  60. dd,
  61. </if>
  62. <if test='null != ghqMc'>
  63. ghq_mc,
  64. </if>
  65. <if test='null != ghqGgxh'>
  66. ghq_ggxh,
  67. </if>
  68. <if test='null != ghqSccj'>
  69. ghq_sccj,
  70. </if>
  71. <if test='null != ghhMc'>
  72. ghh_mc,
  73. </if>
  74. <if test='null != ghhGgxh'>
  75. ghh_ggxh,
  76. </if>
  77. <if test='null != ghhSccj'>
  78. ghh_sccj,
  79. </if>
  80. <if test='null != ghyy'>
  81. ghyy,
  82. </if>
  83. <if test='null != operationDate'>
  84. operation_date,
  85. </if>
  86. <if test='null != operator'>
  87. operator,
  88. </if>
  89. <if test='null != remark'>
  90. remark,
  91. </if>
  92. <if test='null != submitState'>
  93. submit_state,
  94. </if>
  95. <if test='null != delFlag'>
  96. del_flag,
  97. </if>
  98. <if test='null != createBy'>
  99. create_by,
  100. </if>
  101. <if test='null != createTime'>
  102. create_time,
  103. </if>
  104. <if test='null != updateBy'>
  105. update_by,
  106. </if>
  107. <if test='null != updateTime'>
  108. update_time
  109. </if>
  110. </trim>
  111. <trim prefix="values (" suffix=")" suffixOverrides=",">
  112. <if test='null != deptStationId'>
  113. #{deptStationId},
  114. </if>
  115. <if test='null != dd'>
  116. #{dd},
  117. </if>
  118. <if test='null != ghqMc'>
  119. #{ghqMc},
  120. </if>
  121. <if test='null != ghqGgxh'>
  122. #{ghqGgxh},
  123. </if>
  124. <if test='null != ghqSccj'>
  125. #{ghqSccj},
  126. </if>
  127. <if test='null != ghhMc'>
  128. #{ghhMc},
  129. </if>
  130. <if test='null != ghhGgxh'>
  131. #{ghhGgxh},
  132. </if>
  133. <if test='null != ghhSccj'>
  134. #{ghhSccj},
  135. </if>
  136. <if test='null != ghyy'>
  137. #{ghyy},
  138. </if>
  139. <if test='null != operationDate'>
  140. #{operationDate},
  141. </if>
  142. <if test='null != operator'>
  143. #{operator},
  144. </if>
  145. <if test='null != remark'>
  146. #{remark},
  147. </if>
  148. <if test='null != submitState'>
  149. #{submitState},
  150. </if>
  151. <if test='null != delFlag'>
  152. #{delFlag},
  153. </if>
  154. <if test='null != createBy'>
  155. #{createBy},
  156. </if>
  157. <if test='null != createTime'>
  158. #{createTime},
  159. </if>
  160. <if test='null != updateBy'>
  161. #{updateBy},
  162. </if>
  163. <if test='null != updateTime'>
  164. #{updateTime}
  165. </if>
  166. </trim>
  167. </insert>
  168. <delete id="delete">
  169. UPDATE bus_jceb_lbjghjl
  170. set del_flag='1'
  171. WHERE id = #{id}
  172. </delete>
  173. <update id="update" parameterType="com.railway.business.catenary.domain.BusJcebLbjghjl">
  174. UPDATE bus_jceb_lbjghjl
  175. <set>
  176. <if test='null != deptStationId'>dept_station_id = #{deptStationId},</if>
  177. <if test='null != dd'>dd = #{dd},</if>
  178. <if test='null != ghqMc'>ghq_mc = #{ghqMc},</if>
  179. <if test='null != ghqGgxh'>ghq_ggxh = #{ghqGgxh},</if>
  180. <if test='null != ghqSccj'>ghq_sccj = #{ghqSccj},</if>
  181. <if test='null != ghhMc'>ghh_mc = #{ghhMc},</if>
  182. <if test='null != ghhGgxh'>ghh_ggxh = #{ghhGgxh},</if>
  183. <if test='null != ghhSccj'>ghh_sccj = #{ghhSccj},</if>
  184. <if test='null != ghyy'>ghyy = #{ghyy},</if>
  185. <if test='null != operationDate'>operation_date = #{operationDate},</if>
  186. <if test='null != operator'>operator = #{operator},</if>
  187. <if test='null != remark'>remark = #{remark},</if>
  188. <if test='null != submitState'>submit_state = #{submitState},</if>
  189. <if test='null != delFlag'>del_flag = #{delFlag},</if>
  190. <if test='null != updateBy'>update_by = #{updateBy},</if>
  191. <if test='null != updateTime'>update_time = #{updateTime}</if>
  192. </set>
  193. WHERE id = #{id}
  194. </update>
  195. <select id="getInfo" resultMap="BaseResultMap">
  196. SELECT
  197. DISTINCT
  198. v.station_name,
  199. a.*
  200. FROM bus_jceb_lbjghjl a
  201. LEFT JOIN v_station v ON a.dept_station_id = v.dept_station_id
  202. WHERE
  203. a.del_flag = '0'
  204. AND s.del_flag = '0'
  205. AND a.id = #{id}
  206. </select>
  207. <select id="getList" resultMap="BaseResultMap">
  208. SELECT
  209. v.station_name,
  210. a.*
  211. FROM bus_jceb_lbjghjl a
  212. LEFT JOIN v_station v ON a.dept_station_id = v.dept_station_id
  213. <where>
  214. a.del_flag = '0'
  215. <if test="stationId!=null and stationId!=''">
  216. and v.station_id=#{stationId}
  217. </if>
  218. <if test="dd!=null and dd!=''">
  219. and a.dd=#{dd}
  220. </if>
  221. <if test="ghqMc!=null and ghqMc!=''">
  222. and a.ghq_mc=#{ghqMc}
  223. </if>
  224. <if test="ghqGgxh!=null and ghqGgxh!=''">
  225. and a.ghq_ggxh=#{ghqGgxh}
  226. </if>
  227. <if test="ghqSccj!=null and ghqSccj!=''">
  228. and a.ghq_sccj=#{ghqSccj}
  229. </if>
  230. <if test="ghhMc!=null and ghhMc!=''">
  231. and a.ghh_mc=#{ghhMc}
  232. </if>
  233. <if test="ghhGgxh!=null and ghhGgxh!=''">
  234. and a.ghh_ggxh=#{ghhGgxh}
  235. </if>
  236. <if test="ghhSccj!=null and ghhSccj!=''">
  237. and a.ghh_sccj=#{ghhSccj}
  238. </if>
  239. <if test="ghyy!=null and ghyy!=''">
  240. and a.ghyy=#{ghyy}
  241. </if>
  242. <if test="operationDate!=null and operationDate!=''">
  243. and a.operation_date=#{operationDate}
  244. </if>
  245. <if test="operator!=null and operator!=''">
  246. and a.operator=#{operator}
  247. </if>
  248. <if test="remark!=null and remark!=''">
  249. and a.remark=#{remark}
  250. </if>
  251. <if test="submitState!=null and submitState!=''">
  252. and a.submit_state=#{submitState}
  253. </if>
  254. <if test="delFlag!=null and delFlag!=''">
  255. and a.del_flag=#{delFlag}
  256. </if>
  257. <if test="createBy!=null and createBy!=''">
  258. and a.create_by=#{createBy}
  259. </if>
  260. <if test="createTime!=null and createTime!=''">
  261. and a.create_time=#{createTime}
  262. </if>
  263. <if test="updateBy!=null and updateBy!=''">
  264. and a.update_by=#{updateBy}
  265. </if>
  266. <if test="updateTime!=null and updateTime!=''">
  267. and a.update_time=#{updateTime}
  268. </if>
  269. </where>
  270. order by a.operation_date desc
  271. </select>
  272. <resultMap id="JcebResultMap" type="com.railway.business.catenary.domain.vo.JcebRecordVo">
  273. <result column="dept_name" property="deptName"/>
  274. <result column="station_name" property="stationName"/>
  275. <result column="operation_date" property="operationDate"/>
  276. <result column="operator" property="operator"/>
  277. <result column="jcebType" property="jcebType"/>
  278. </resultMap>
  279. <select id="getListByType" resultMap="JcebResultMap">
  280. SELECT v.dept_name, v.station_name, t.operation_date, t.operator, #{jcebType} as jcebType
  281. FROM bus_jceb_lbjghjl t
  282. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  283. <where>
  284. t.del_flag='0'
  285. <if test="stationId!=null and stationId!=''">
  286. and v.station_id=#{stationId}
  287. </if>
  288. <if test="pillarCode!=null and pillarCode!=''">
  289. and t.pillar_start=#{pillarCode}
  290. </if>
  291. <if test="operator!=null and operator!=''">
  292. and t.operator=#{operator}
  293. </if>
  294. <if test="createBy!=null and createBy!=''">
  295. and t.create_by=#{createBy}
  296. </if>
  297. </where>
  298. </select>
  299. <resultMap id="JcebCountResultMap" type="com.railway.business.catenary.domain.vo.JcebRecordVo">
  300. <result column="c" property="count"/>
  301. <result column="operation_date" property="operationDate"/>
  302. </resultMap>
  303. <select id="getCountByType" resultMap="JcebCountResultMap">
  304. SELECT count(*) c, max(t.operation_date) as operation_date
  305. FROM bus_jceb_lbjghjl t
  306. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  307. <where>
  308. t.del_flag='0'
  309. <if test="stationId!=null and stationId!=''">
  310. and v.station_id=#{stationId}
  311. </if>
  312. <if test="pillarCode!=null and pillarCode!=''">
  313. and t.pillar_start=#{pillarCode}
  314. </if>
  315. <if test="operator!=null and operator!=''">
  316. and t.operator=#{operator}
  317. </if>
  318. </where>
  319. </select>
  320. </mapper>