BusJcebJyzqsjlMapper.xml 9.4 KB

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