TmstruckSmsRusultMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.steerinfo.dil.mapper.TmstruckSmsRusultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckSmsRusult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="TOTAL_RESULT_ID" jdbcType="DECIMAL" property="totalResultId" />
  7. <result column="SENDER_ID" jdbcType="DECIMAL" property="senderId" />
  8. <result column="RESULT_SENDING_TIME" jdbcType="TIMESTAMP" property="resultSendingTime" />
  9. <result column="RESULT_SMS_CONTENT" jdbcType="VARCHAR" property="resultSmsContent" />
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  11. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  13. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  15. </resultMap>
  16. <sql id="columns">
  17. RESULT_ID, TOTAL_RESULT_ID, SENDER_ID, RESULT_SENDING_TIME, RESULT_SMS_CONTENT, INSERT_USERNAME,
  18. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
  19. </sql>
  20. <sql id="columns_alias">
  21. t.RESULT_ID, t.TOTAL_RESULT_ID, t.SENDER_ID, t.RESULT_SENDING_TIME, t.RESULT_SMS_CONTENT,
  22. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
  23. </sql>
  24. <sql id="select">
  25. SELECT <include refid="columns"/> FROM TMSTRUCK_SMS_RUSULT
  26. </sql>
  27. <sql id="select_alias">
  28. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_SMS_RUSULT t
  29. </sql>
  30. <sql id="where">
  31. <where>
  32. <if test="resultId != null">
  33. and RESULT_ID = #{resultId}
  34. </if>
  35. <if test="totalResultId != null">
  36. and TOTAL_RESULT_ID = #{totalResultId}
  37. </if>
  38. <if test="senderId != null">
  39. and SENDER_ID = #{senderId}
  40. </if>
  41. <if test="resultSendingTime != null">
  42. and TO_CHAR(RESULT_SENDING_TIME,'yyyy-MM-dd') = #{resultSendingTime}
  43. </if>
  44. <if test="resultSmsContent != null and resultSmsContent != ''">
  45. and RESULT_SMS_CONTENT = #{resultSmsContent}
  46. </if>
  47. <if test="insertUsername != null and insertUsername != ''">
  48. and INSERT_USERNAME = #{insertUsername}
  49. </if>
  50. <if test="insertTime != null">
  51. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  52. </if>
  53. <if test="updateUsername != null and updateUsername != ''">
  54. and UPDATE_USERNAME = #{updateUsername}
  55. </if>
  56. <if test="updateTime != null">
  57. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  58. </if>
  59. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  60. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  61. </if>
  62. </where>
  63. </sql>
  64. <sql id="whereLike">
  65. <where>
  66. <if test="resultId != null">
  67. and RESULT_ID = #{resultId}
  68. </if>
  69. <if test="totalResultId != null">
  70. and TOTAL_RESULT_ID = #{totalResultId}
  71. </if>
  72. <if test="senderId != null">
  73. and SENDER_ID = #{senderId}
  74. </if>
  75. <if test="resultSendingTime != null">
  76. and TO_CHAR(RESULT_SENDING_TIME,'yyyy-MM-dd') = #{resultSendingTime}
  77. </if>
  78. <if test="resultSmsContent != null and resultSmsContent != ''">
  79. and RESULT_SMS_CONTENT LIKE '%${resultSmsContent}%'
  80. </if>
  81. <if test="insertUsername != null and insertUsername != ''">
  82. and INSERT_USERNAME LIKE '%${insertUsername}%'
  83. </if>
  84. <if test="insertTime != null">
  85. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  86. </if>
  87. <if test="updateUsername != null and updateUsername != ''">
  88. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  89. </if>
  90. <if test="updateTime != null">
  91. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  92. </if>
  93. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  94. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  95. </if>
  96. </where>
  97. </sql>
  98. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  99. delete from TMSTRUCK_SMS_RUSULT
  100. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  101. </delete>
  102. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  103. delete from TMSTRUCK_SMS_RUSULT
  104. where 1!=1
  105. <if test="totalResultId != null">
  106. or TOTAL_RESULT_ID = #{totalResultId}
  107. </if>
  108. <if test="senderId != null">
  109. or SENDER_ID = #{senderId}
  110. </if>
  111. <if test="resultSendingTime != null">
  112. or TO_CHAR(RESULT_SENDING_TIME,'yyyy-MM-dd') = '#{resultSendingTime}'
  113. </if>
  114. <if test="resultSmsContent != null and resultSmsContent != ''">
  115. or RESULT_SMS_CONTENT = #{resultSmsContent}
  116. </if>
  117. <if test="insertUsername != null and insertUsername != ''">
  118. or INSERT_USERNAME = #{insertUsername}
  119. </if>
  120. <if test="insertTime != null">
  121. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  122. </if>
  123. <if test="updateUsername != null and updateUsername != ''">
  124. or UPDATE_USERNAME = #{updateUsername}
  125. </if>
  126. <if test="updateTime != null">
  127. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  128. </if>
  129. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  130. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  131. </if>
  132. </delete>
  133. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckSmsRusult">
  134. insert into TMSTRUCK_SMS_RUSULT (RESULT_ID, TOTAL_RESULT_ID, SENDER_ID,
  135. RESULT_SENDING_TIME, RESULT_SMS_CONTENT,
  136. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  137. UPDATE_TIME, INSERT_UPDATE_REMARK)
  138. values (#{resultId,jdbcType=DECIMAL}, #{totalResultId,jdbcType=DECIMAL}, #{senderId,jdbcType=DECIMAL},
  139. #{resultSendingTime,jdbcType=TIMESTAMP}, #{resultSmsContent,jdbcType=VARCHAR},
  140. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  141. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR})
  142. </insert>
  143. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckSmsRusult">
  144. insert into TMSTRUCK_SMS_RUSULT
  145. <trim prefix="(" suffix=")" suffixOverrides=",">
  146. <if test="resultId != null">
  147. RESULT_ID,
  148. </if>
  149. <if test="totalResultId != null">
  150. TOTAL_RESULT_ID,
  151. </if>
  152. <if test="senderId != null">
  153. SENDER_ID,
  154. </if>
  155. <if test="resultSendingTime != null">
  156. RESULT_SENDING_TIME,
  157. </if>
  158. <if test="resultSmsContent != null">
  159. RESULT_SMS_CONTENT,
  160. </if>
  161. <if test="insertUsername != null">
  162. INSERT_USERNAME,
  163. </if>
  164. <if test="insertTime != null">
  165. INSERT_TIME,
  166. </if>
  167. <if test="updateUsername != null">
  168. UPDATE_USERNAME,
  169. </if>
  170. <if test="updateTime != null">
  171. UPDATE_TIME,
  172. </if>
  173. <if test="insertUpdateRemark != null">
  174. INSERT_UPDATE_REMARK,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides=",">
  178. <if test="resultId != null">
  179. #{resultId,jdbcType=DECIMAL},
  180. </if>
  181. <if test="totalResultId != null">
  182. #{totalResultId,jdbcType=DECIMAL},
  183. </if>
  184. <if test="senderId != null">
  185. #{senderId,jdbcType=DECIMAL},
  186. </if>
  187. <if test="resultSendingTime != null">
  188. #{resultSendingTime,jdbcType=TIMESTAMP},
  189. </if>
  190. <if test="resultSmsContent != null">
  191. #{resultSmsContent,jdbcType=VARCHAR},
  192. </if>
  193. <if test="insertUsername != null">
  194. #{insertUsername,jdbcType=VARCHAR},
  195. </if>
  196. <if test="insertTime != null">
  197. #{insertTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="updateUsername != null">
  200. #{updateUsername,jdbcType=VARCHAR},
  201. </if>
  202. <if test="updateTime != null">
  203. #{updateTime,jdbcType=TIMESTAMP},
  204. </if>
  205. <if test="insertUpdateRemark != null">
  206. #{insertUpdateRemark,jdbcType=VARCHAR},
  207. </if>
  208. </trim>
  209. </insert>
  210. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckSmsRusult">
  211. update TMSTRUCK_SMS_RUSULT
  212. set TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL},
  213. SENDER_ID = #{senderId,jdbcType=DECIMAL},
  214. RESULT_SENDING_TIME = #{resultSendingTime,jdbcType=TIMESTAMP},
  215. RESULT_SMS_CONTENT = #{resultSmsContent,jdbcType=VARCHAR},
  216. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  217. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  218. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  219. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  220. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
  221. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  222. </update>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckSmsRusult">
  224. update TMSTRUCK_SMS_RUSULT
  225. <set>
  226. <if test="totalResultId != null">
  227. TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL},
  228. </if>
  229. <if test="senderId != null">
  230. SENDER_ID = #{senderId,jdbcType=DECIMAL},
  231. </if>
  232. <if test="resultSendingTime != null">
  233. RESULT_SENDING_TIME = #{resultSendingTime,jdbcType=TIMESTAMP},
  234. </if>
  235. <if test="resultSmsContent != null">
  236. RESULT_SMS_CONTENT = #{resultSmsContent,jdbcType=VARCHAR},
  237. </if>
  238. <if test="insertUsername != null">
  239. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  240. </if>
  241. <if test="insertTime != null">
  242. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="updateUsername != null">
  245. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  246. </if>
  247. <if test="updateTime != null">
  248. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  249. </if>
  250. <if test="insertUpdateRemark != null">
  251. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  252. </if>
  253. </set>
  254. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  255. </update>
  256. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  257. <include refid="select"/>
  258. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  259. </select>
  260. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  261. <include refid="select"/>
  262. <include refid="where"/>
  263. </select>
  264. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  265. <include refid="select"/>
  266. <include refid="whereLike"/>
  267. </select>
  268. <insert id="batchInsert" parameterType="java.util.List">
  269. insert into TMSTRUCK_SMS_RUSULT
  270. (RESULT_ID,
  271. TOTAL_RESULT_ID, SENDER_ID, RESULT_SENDING_TIME,
  272. RESULT_SMS_CONTENT, INSERT_USERNAME,
  273. INSERT_TIME, UPDATE_USERNAME,
  274. UPDATE_TIME, INSERT_UPDATE_REMARK
  275. )
  276. ( <foreach collection="list" item="item" separator="union all">
  277. select
  278. #{item.resultId,jdbcType=DECIMAL},
  279. #{item.totalResultId,jdbcType=DECIMAL}, #{item.senderId,jdbcType=DECIMAL}, #{item.resultSendingTime,jdbcType=TIMESTAMP},
  280. #{item.resultSmsContent,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  281. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  282. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
  283. from dual
  284. </foreach> )
  285. </insert>
  286. <update id="batchUpdate" parameterType="java.util.List">
  287. update TMSTRUCK_SMS_RUSULT
  288. set
  289. RESULT_ID=
  290. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  291. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  292. </foreach>
  293. ,TOTAL_RESULT_ID=
  294. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  295. when #{item.resultId,jdbcType=DECIMAL} then #{item.totalResultId,jdbcType=DECIMAL}
  296. </foreach>
  297. ,SENDER_ID=
  298. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  299. when #{item.resultId,jdbcType=DECIMAL} then #{item.senderId,jdbcType=DECIMAL}
  300. </foreach>
  301. ,RESULT_SENDING_TIME=
  302. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  303. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultSendingTime,jdbcType=TIMESTAMP}
  304. </foreach>
  305. ,RESULT_SMS_CONTENT=
  306. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  307. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultSmsContent,jdbcType=VARCHAR}
  308. </foreach>
  309. ,INSERT_USERNAME=
  310. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  311. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  312. </foreach>
  313. ,INSERT_TIME=
  314. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  315. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  316. </foreach>
  317. ,UPDATE_USERNAME=
  318. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  319. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  320. </foreach>
  321. ,UPDATE_TIME=
  322. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  323. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  324. </foreach>
  325. ,INSERT_UPDATE_REMARK=
  326. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  327. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  328. </foreach>
  329. where RESULT_ID in
  330. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  331. #{item.resultId,jdbcType=DECIMAL}
  332. </foreach>
  333. </update>
  334. <delete id="batchDelete" parameterType="java.util.List">
  335. delete from TMSTRUCK_SMS_RUSULT
  336. where RESULT_ID in
  337. <foreach collection="list" item="id" open="(" close=")" separator=",">
  338. #{id}
  339. </foreach>
  340. </delete>
  341. <!-- 友情提示!!!-->
  342. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  343. <!-- 根据运输订单号查找托运方 -->
  344. <select id="selectShipperIdByOrderNumber" parameterType="java.lang.String" resultType="java.lang.Integer">
  345. select RS.SHIPPER_ID "shipperId"
  346. from OMSTRUCK_ORDER OO
  347. left join AMSTRUCK_RAIL_DAYPLAN ARD
  348. on OO.ORDER_PLAN_ID=ARD.DAYPLAN_ID
  349. left join RMS_SHIPPER RS
  350. on RS.SHIPPER_ID=ARD.SHIPMENT_UNIT_ID
  351. where OO.ORDER_NUMBER=#{orderNumber}
  352. </select>
  353. <!-- 根据运输订单号查找司机电话号码 -->
  354. <select id="selectCarDriverByOrderNumber" parameterType="java.lang.String" resultType="java.lang.String">
  355. select RCD.DRIVER_PHONE "driverPhone"
  356. from OMSTRUCK_ORDER OO
  357. left join RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
  358. left join RMS_DRIVER_CAPACITY RDC ON RDC.CAPACITY_ID=RC.CAPACITY_ID
  359. left join RMS_CAR_DRIVER RCD ON RDC.DRIVER_ID = RCD.DRIVER_ID
  360. where OO.ORDER_NUMBER=#{orderNumber}
  361. </select>
  362. <!-- 查询短信实绩 -->
  363. <select id="selectSmsResult" parameterType="java.util.Map" resultType="java.util.Map">
  364. SELECT TSR.RESULT_SENDING_TIME "sendIngTime",
  365. TSR.RESULT_SMS_CONTENT "content",
  366. rc.capacity_number "capacityNo"
  367. FROM TMSTRUCK_SMS_RUSULT TSR
  368. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  369. ON TTR.RESULT_TOTAL_ID = TSR.TOTAL_RESULT_ID
  370. left join omstruck_order oo
  371. on oo.order_id = ttr.order_id
  372. left join rms_capacity rc
  373. on rc.capacity_id = oo.capacity_id
  374. </select>
  375. <select id="selectIdApp" resultType="java.util.Map">
  376. select rs.SHIPPER_APPID "AppId",
  377. rs.SHIPPER_SECRETKEY "secretKey"
  378. from RMS_SHIPPER RS
  379. where rs.SHIPPER_ID=#{bigDecimal}
  380. </select>
  381. <select id="getDriverTel" resultType="java.lang.String" parameterType="decimal">
  382. select OO.DRIVER_TEL from OMSTRUCK_ORDER OO
  383. where OO.ORDER_ID = #{orderId}
  384. </select>
  385. </mapper>