BusJcebLbjghjlMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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 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.dept_id, v.dept_name,
  199. v.line_id, v.line_name,
  200. v.station_name, v.station_id,
  201. t.*
  202. FROM bus_jceb_lbjghjl t
  203. LEFT JOIN v_station v ON t.dept_station_id = v.dept_station_id
  204. WHERE
  205. t.del_flag = '0'
  206. AND s.del_flag = '0'
  207. AND t.id = #{id}
  208. </select>
  209. <select id="getList" resultMap="BaseResultMap">
  210. SELECT
  211. v.dept_id, v.dept_name,
  212. v.line_id, v.line_name,
  213. v.station_name, v.station_id,
  214. t.*
  215. FROM bus_jceb_lbjghjl t
  216. LEFT JOIN v_station v ON t.dept_station_id = v.dept_station_id
  217. <where>
  218. t.del_flag = '0'
  219. <if test="deptId!=null and deptId!=''">
  220. and v.dept_id=#{deptId}
  221. </if>
  222. <if test="stationId!=null and stationId!=''">
  223. and v.station_id=#{stationId}
  224. </if>
  225. <if test="stationIds!=null and stationIds.length > 0">
  226. and v.station_id in
  227. <foreach collection="stationIds" item="stationId" index="i" open="(" separator="," close=")">
  228. #{stationId}
  229. </foreach>
  230. </if>
  231. <if test="dd!=null and dd!=''">
  232. and t.dd=#{dd}
  233. </if>
  234. <if test="ghqMc!=null and ghqMc!=''">
  235. and t.ghq_mc=#{ghqMc}
  236. </if>
  237. <if test="ghqGgxh!=null and ghqGgxh!=''">
  238. and t.ghq_ggxh=#{ghqGgxh}
  239. </if>
  240. <if test="ghqSccj!=null and ghqSccj!=''">
  241. and t.ghq_sccj=#{ghqSccj}
  242. </if>
  243. <if test="ghhMc!=null and ghhMc!=''">
  244. and t.ghh_mc=#{ghhMc}
  245. </if>
  246. <if test="ghhGgxh!=null and ghhGgxh!=''">
  247. and t.ghh_ggxh=#{ghhGgxh}
  248. </if>
  249. <if test="ghhSccj!=null and ghhSccj!=''">
  250. and t.ghh_sccj=#{ghhSccj}
  251. </if>
  252. <if test="ghyy!=null and ghyy!=''">
  253. and t.ghyy=#{ghyy}
  254. </if>
  255. <if test="operationDate!=null">
  256. and t.operation_date=#{operationDate}
  257. </if>
  258. <if test="operator!=null and operator!=''">
  259. and t.operator like concat('%', #{operator}, '%')
  260. </if>
  261. <if test="remark!=null and remark!=''">
  262. and t.remark=#{remark}
  263. </if>
  264. <if test="submitState!=null and submitState!=''">
  265. and t.submit_state <![CDATA[ >= ]]> #{submitState}
  266. </if>
  267. <if test="delFlag!=null and delFlag!=''">
  268. and t.del_flag=#{delFlag}
  269. </if>
  270. <if test="createBy!=null and createBy!=''">
  271. and t.create_by=#{createBy}
  272. </if>
  273. <if test="createTime!=null">
  274. and DATE_FORMAT(t.create_time, '%Y-%m-%d') = #{createTime}
  275. </if>
  276. <if test="updateBy!=null and updateBy!=''">
  277. and t.update_by=#{updateBy}
  278. </if>
  279. <if test="updateTime!=null">
  280. and DATE_FORMAT(t.update_time, '%Y-%m-%d') = #{updateTime}
  281. </if>
  282. </where>
  283. <if test="orderBy!=null and orderBy!=''">
  284. order by t.${orderBy}
  285. </if>
  286. <if test="isAsc!=null and isAsc!=''">
  287. <if test="isAsc == '1'.toString()">
  288. asc
  289. </if>
  290. <if test="isAsc == '0'.toString()">
  291. desc
  292. </if>
  293. </if>
  294. </select>
  295. <select id="getJcebList" resultMap="BaseResultMap">
  296. SELECT
  297. v.dept_id, v.dept_name,
  298. v.line_id, v.line_name,
  299. v.station_name, v.station_id,
  300. t.*
  301. FROM bus_jceb_lbjghjl t
  302. LEFT JOIN v_station v ON t.dept_station_id = v.dept_station_id
  303. <where>
  304. t.del_flag='0'
  305. <if test="submitState!=null and submitState!=''">
  306. and t.submit_state <![CDATA[ >= ]]> #{submitState}
  307. </if>
  308. <if test="deptId!=null and deptId!=''">
  309. and v.dept_id=#{deptId}
  310. </if>
  311. <if test="stationId!=null and stationId!=''">
  312. and v.station_id=#{stationId}
  313. </if>
  314. <if test="stationIds!=null and stationIds.length > 0">
  315. and v.station_id in
  316. <foreach collection="stationIds" item="stationId" index="i" open="(" separator="," close=")">
  317. #{stationId}
  318. </foreach>
  319. </if>
  320. <if test="pillarCode!=null and pillarCode!=''">
  321. and t.pillar_start=#{pillarCode}
  322. </if>
  323. <if test="operator!=null and operator!=''">
  324. and t.operator like concat('%', #{operator}, '%')
  325. </if>
  326. <if test="createBy!=null and createBy!=''">
  327. and t.create_by=#{createBy}
  328. </if>
  329. </where>
  330. </select>
  331. <resultMap id="JcebResultMap" type="com.railway.business.catenary.domain.vo.JcebRecordVo">
  332. <result column="id" property="id"/>
  333. <result column="dept_name" property="deptName"/>
  334. <result column="station_name" property="stationName"/>
  335. <result column="operation_date" property="operationDate"/>
  336. <result column="operator" property="operator"/>
  337. <result column="jcebType" property="jcebType"/>
  338. </resultMap>
  339. <select id="getListByType" resultMap="JcebResultMap">
  340. SELECT t.id, v.dept_name, v.station_name, t.operation_date, t.operator, #{jcebType} as jcebType
  341. FROM bus_jceb_lbjghjl t
  342. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  343. <where>
  344. t.del_flag='0'
  345. <if test="submitState!=null and submitState!=''">
  346. and t.submit_state <![CDATA[ >= ]]> #{submitState}
  347. </if>
  348. <if test="deptId!=null and deptId!=''">
  349. and v.dept_id=#{deptId}
  350. </if>
  351. <if test="stationId!=null and stationId!=''">
  352. and v.station_id=#{stationId}
  353. </if>
  354. <if test="stationIds!=null and stationIds.length > 0">
  355. and v.station_id in
  356. <foreach collection="stationIds" item="stationId" index="i" open="(" separator="," close=")">
  357. #{stationId}
  358. </foreach>
  359. </if>
  360. <if test="pillarCode!=null and pillarCode!=''">
  361. and t.pillar_start=#{pillarCode}
  362. </if>
  363. <if test="operator!=null and operator!=''">
  364. and t.operator like concat('%', #{operator}, '%')
  365. </if>
  366. <if test="createBy!=null and createBy!=''">
  367. and t.create_by=#{createBy}
  368. </if>
  369. </where>
  370. </select>
  371. <resultMap id="JcebCountResultMap" type="com.railway.business.catenary.domain.vo.JcebRecordVo">
  372. <result column="c" property="count"/>
  373. <result column="operation_date" property="operationDate"/>
  374. </resultMap>
  375. <select id="getCountByType" resultMap="JcebCountResultMap">
  376. SELECT count(*) c, max(t.operation_date) as operation_date
  377. FROM bus_jceb_lbjghjl t
  378. LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
  379. <where>
  380. t.del_flag='0'
  381. <if test="submitState!=null and submitState!=''">
  382. and t.submit_state <![CDATA[ >= ]]> #{submitState}
  383. </if>
  384. <if test="deptId!=null and deptId!=''">
  385. and v.dept_id=#{deptId}
  386. </if>
  387. <if test="stationId!=null and stationId!=''">
  388. and v.station_id=#{stationId}
  389. </if>
  390. <if test="pillarCode!=null and pillarCode!=''">
  391. and t.pillar_start=#{pillarCode}
  392. </if>
  393. <if test="operator!=null and operator!=''">
  394. and t.operator like concat('%', #{operator}, '%')
  395. </if>
  396. <if test="createBy!=null and createBy!=''">
  397. and t.create_by=#{createBy}
  398. </if>
  399. </where>
  400. </select>
  401. </mapper>