OrderInfMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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.minpay.db.table.own.mapper.OrderInfMapper">
  4. <select id="getOrderInf" resultType="hashmap" parameterType="String">
  5. SELECT
  6. toi.OIF_ORDERNO AS oifOrderNo,
  7. toi.OIF_DESTINATION AS oifDestination,
  8. toi.OIF_CLEAR_CUSTOM AS oifClearCustom,
  9. toi.OIF_PRO_CON AS oifProCon,
  10. tci.CIF_CERT_NO AS cifCretNo,
  11. tci.CIF_NAME AS cifName,
  12. iu.USR_NAME AS usrName
  13. FROM
  14. tp_order_inf toi
  15. INNER JOIN tp_company_info tci ON toi.OIF_COM_ID = tci.CIF_ID
  16. INNER JOIN im_user iu ON iu.USR_ID = toi.OIF_LOGISTICS_ID
  17. where
  18. toi.OIF_STT = '13'
  19. and toi.OIF_ORDERNO = #{orderNo}
  20. </select>
  21. <select id="queryFinanceTodo" resultType="hashmap">
  22. SELECT
  23. toi.OIF_ORDERNO AS 'orderNo',
  24. tci.CIF_NAME AS 'cifName',
  25. toi.OIF_STT AS 'stt'
  26. FROM
  27. tp_order_inf toi
  28. LEFT JOIN tp_company_info tci ON toi.OIF_COM_ID = tci.CIF_ID
  29. WHERE
  30. toi.OIF_STT IN ('06', '10', '12')
  31. or OIF_AUTHER = '03'
  32. </select>
  33. <select id="selectOrder" resultType="hashmap" parameterType="java.util.Map">
  34. SELECT
  35. OIF_ORDERNO "orderno",
  36. OIF_COM_ID "comId",
  37. c.`CIF_COR_NAME` "corName",
  38. c.`CIF_CREDITS` "credits",
  39. c.`CIF_CREDITS_BALANCE` "creditsBalance",
  40. OIF_APPLY_DATE "applyDate",
  41. IFNULL(OIF_TERM , "-") "term",
  42. OIF_TRANS_TYPE "transType",
  43. IF((LOCATE('*',OIF_STT)=0),(select apr_showmsg from pub_apppar where APR_CODE = 'ORDER_STT' and APR_VALUE = OIF_STT),
  44. (select concat(apr_showmsg,'|冻结') from pub_apppar where APR_CODE = 'ORDER_STT' and APR_VALUE = replace(OIF_STT,'*',''))) "sttDesc",
  45. IF((LOCATE('*',OIF_STT)=0),OIF_STT,'99') "stt",
  46. OIF_WAYBILL_NO "waybillNo",
  47. OIF_LOGISTICS_ID "logisticsId",
  48. OIF_DESTINATION "destination",
  49. OIF_CLEAR_CUSTOM "clearCustom",
  50. OIF_MARGIN_AMT "marginAmt",
  51. OIF_AGENCY_FEE "agencyFee",
  52. OIF_INSTEREST "insterest",
  53. OIF_HANDING_FEE "handingFee",
  54. OIF_LOGISTICE_AMT "logisticeAmt",
  55. OIF_CLEARANCE_AMT "clearanceAmt",
  56. OIF_TARRIFF "tarriff",
  57. OIF_SALE_TAX "saleTax",
  58. OIF_VAT "vat",
  59. IF(OIF_TATAL_SUBSIDY='','0',IFNULL(OIF_TATAL_SUBSIDY,'0')) "tatalSubsidy",
  60. OIF_RETURN_RATIO "returnRatio",
  61. IF(OIF_RETURN_AMT='','0',IFNULL(OIF_RETURN_AMT,'0')) "returnAmt",
  62. OIF_GENER_AGREEMENT "generAgreement",
  63. OIF_PRO_CON "proCon",
  64. OIF_FORWARD_CON_RUL "forwardConRul",
  65. OIF_PRODUCT_URL "productUrl",
  66. OIF_PRODUCT_LOGO "productLogo",
  67. OIF_APPRIVE_PASS_DATE "apprivePassDate",
  68. OIF_ESTIMATE_AMOUNT "estimateAmount",
  69. OIF_EXPIRED_DATE "expiredDate",
  70. OIF_CREATE_DATE "createDate",
  71. OIF_CREATE_USER "createUser",
  72. OIF_REMAIN_AMOUNT "remainAmount",
  73. OIF_LOANING_AMT "loaningAmt",
  74. CIF_NAME "companyName",
  75. if(OIF_CONTRACT_AMT is null,0,CAST(OIF_CONTRACT_AMT AS DECIMAL (20, 6))) "contractAmt",
  76. OIF_PRO_CON_NO "proConNo",
  77. OIF_MARGIN_LEVEL "marginLevel",
  78. OIF_CURRENCY "currency",
  79. (SELECT GROUP_CONCAT(ODT_NAME SEPARATOR ',') FROM tp_order_detail b WHERE a.OIF_ORDERNO = b.ODT_ORDERNO) "productName",
  80. (SELECT sum(ODT_COUNT) FROM tp_order_detail c WHERE a.OIF_ORDERNO = c.ODT_ORDERNO) "productNum",
  81. (CASE WHEN #{newDate,jdbcType=VARCHAR} > OIF_EXPIRED_DATE THEN "已进入宽限期" ELSE "--" END) "overdueState"
  82. FROM
  83. tp_order_inf a
  84. LEFT JOIN tp_company_info c ON a.OIF_COM_ID = c.CIF_ID
  85. where
  86. 1=1
  87. <if test="state != null and state!= ''">
  88. and a.OIF_STT in (${state})
  89. </if>
  90. <if test="djState != null and djState !=''">
  91. and a.OIF_STT like '%*'
  92. </if>
  93. <if test="corName != null and corName != ''">
  94. and c.CIF_NAME like CONCAT('%', #{corName,jdbcType=VARCHAR}, '%')
  95. </if>
  96. <if test="orderNo != null and orderNo != ''">
  97. and a.OIF_ORDERNO like CONCAT('%', #{orderNo,jdbcType=VARCHAR}, '%')
  98. </if>
  99. <if test="companyId != null and companyId != ''">
  100. and a.OIF_COM_ID = #{companyId,jdbcType=VARCHAR}
  101. </if>
  102. <if test="dates!=null and dates != ''">
  103. and substr(a.OIF_CREATE_DATE,1,8) between substr((#{dates,jdbcType=VARCHAR}),1,8)
  104. and substr((#{dates,jdbcType=VARCHAR}),12,19)
  105. </if>
  106. <if test="type != null and type!= ''">
  107. and (SELECT COUNT(1) FROM tp_approve_auth h WHERE h.AAH_APPLYNO=a.OIF_ORDERNO and
  108. AAH_RESULT = "0" and h.AAH_BATCH = a.OIF_BATCH) = #{type,jdbcType=VARCHAR}
  109. </if>
  110. <if test="beOverdue != null and beOverdue!= ''">
  111. and #{newDate,jdbcType=VARCHAR} > OIF_EXPIRED_DATE
  112. </if>
  113. <if test="imUserId != null and imUserId != ''">
  114. and a.OIF_MANAGER_NO = #{imUserId, jdbcType=VARCHAR}
  115. </if>
  116. ORDER BY OIF_CREATE_DATE DESC
  117. </select>
  118. <select id="selectOrderAuth" resultType="hashmap" parameterType="java.util.Map">
  119. SELECT
  120. OIF_ORDERNO "orderno",
  121. OIF_COM_ID "comId",
  122. c.`CIF_COR_NAME` "corName",
  123. c.`CIF_CREDITS` "credits",
  124. c.`CIF_CREDITS_BALANCE` "creditsBalance",
  125. OIF_APPLY_DATE "applyDate",
  126. IFNULL(OIF_TERM , "-") "term",
  127. OIF_TRANS_TYPE "transType",
  128. OIF_STT "stt",
  129. OIF_WAYBILL_NO "waybillNo",
  130. OIF_LOGISTICS_ID "logisticsId",
  131. OIF_DESTINATION "destination",
  132. OIF_CLEAR_CUSTOM "clearCustom",
  133. OIF_MARGIN_AMT "marginAmt",
  134. OIF_AGENCY_FEE "agencyFee",
  135. OIF_INSTEREST "insterest",
  136. OIF_HANDING_FEE "handingFee",
  137. OIF_LOGISTICE_AMT "logisticeAmt",
  138. OIF_CLEARANCE_AMT "clearanceAmt",
  139. OIF_TARRIFF "tarriff",
  140. OIF_SALE_TAX "saleTax",
  141. OIF_VAT "vat",
  142. OIF_TATAL_SUBSIDY "tatalSubsidy",
  143. OIF_RETURN_RATIO "returnRatio",
  144. OIF_RETURN_AMT "returnAmt",
  145. OIF_GENER_AGREEMENT "generAgreement",
  146. OIF_PRO_CON "proCon",
  147. OIF_FORWARD_CON_RUL "forwardConRul",
  148. OIF_PRODUCT_URL "productUrl",
  149. OIF_PRODUCT_LOGO "productLogo",
  150. OIF_APPRIVE_PASS_DATE "apprivePassDate",
  151. OIF_EXPIRED_DATE "expiredDate",
  152. OIF_CREATE_DATE "createDate",
  153. OIF_CREATE_USER "createUser",
  154. OIF_REMAIN_AMOUNT "remainAmount",
  155. OIF_LOANING_AMT "loaningAmt",
  156. CIF_NAME "companyName",
  157. (SELECT GROUP_CONCAT(ODT_NAME SEPARATOR ',') FROM tp_order_detail b WHERE a.OIF_ORDERNO = b.ODT_ORDERNO) "productName",
  158. (SELECT sum(ODT_COUNT) FROM tp_order_detail c WHERE a.OIF_ORDERNO = c.ODT_ORDERNO) "productNum",
  159. (CASE WHEN #{newDate,jdbcType=VARCHAR} > OIF_EXPIRED_DATE THEN "已进入宽限期" ELSE "--" END) "overdueState"
  160. FROM
  161. tp_order_inf a
  162. LEFT JOIN tp_company_info c ON a.OIF_COM_ID = c.CIF_ID
  163. where 1=1 and a.OIF_STT ='03'
  164. and OIF_AUTHER = #{auther,jdbcType=VARCHAR}
  165. ORDER BY OIF_CREATE_DATE DESC
  166. </select>
  167. <select id="selectOrderStatistics" resultType="hashmap" parameterType="java.util.Map">
  168. SELECT
  169. OIF_STT "stt",
  170. COUNT(1) "num"
  171. FROM tp_order_inf GROUP BY OIF_STT
  172. </select>
  173. <select id="selectValuationGoods" resultType="hashmap" parameterType="java.util.Map">
  174. SELECT
  175. ODT_ID "detailId",
  176. ODT_NAME "name",
  177. (ODT_PRICE_CIF*ODT_COUNT*0.9) "detailValuation",
  178. (SELECT SUM((ODT_PRICE_CIF*ODT_COUNT*0.9)) FROM tp_order_detail
  179. where
  180. 1=1
  181. <if test="orderNo != null and orderNo!= ''">
  182. and a.ODT_ORDERNO = #{orderNo,jdbcType=VARCHAR}
  183. </if>
  184. ) "orderValuation"
  185. FROM tp_order_detail a
  186. WHERE
  187. 1=1
  188. <if test="orderNo != null and orderNo!= ''">
  189. and a.ODT_ORDERNO = #{orderNo,jdbcType=VARCHAR}
  190. </if>
  191. </select>
  192. <select id="selectValuationGoodsB" resultType="hashmap" parameterType="java.util.Map">
  193. SELECT
  194. OIF_ORDERNO "orderno",
  195. OIF_LOANING_AMT "loaningAmt",
  196. (SELECT ROUND(SUM((ODT_PRICE_CIF*ODT_COUNT)*0.9),2) FROM tp_order_detail
  197. where
  198. 1=1
  199. <if test="orderNo != null and orderNo!= ''">
  200. and ODT_ORDERNO = #{orderNo,jdbcType=VARCHAR}
  201. </if>
  202. ) "orderValuation"
  203. from
  204. tp_order_inf a
  205. where 1=1
  206. <if test="orderNo != null and orderNo!= ''">
  207. and a.OIF_ORDERNO = #{orderNo,jdbcType=VARCHAR}
  208. </if>
  209. </select>
  210. <select id="queryOrderApproval" resultType="hashmap" parameterType="java.util.Map">
  211. SELECT
  212. AAH_FLOWNO "flowno",
  213. AAH_APPLYNO "applyno",
  214. AAH_STT "stt",
  215. AAH_USER "user",
  216. AAH_AUTHTIME "authtime",
  217. AAH_RESULT "result",
  218. AAH_OPINION "opinion",
  219. AAH_AUTH_TYPE "authType",
  220. b.USR_NAME "name"
  221. FROM tp_approve_auth a
  222. inner join tp_order_inf c on c.OIF_BATCH = a.AAH_BATCH and c.OIF_ORDERNO = a.AAH_APPLYNO
  223. left join im_user b on b.USR_ID = a.AAH_USER
  224. where 1=1
  225. <if test="orderNo != null and orderNo!= ''">
  226. and a.AAH_APPLYNO = #{orderNo,jdbcType=VARCHAR}
  227. </if>
  228. <if test="authType != null and authType!= ''">
  229. and a.AAH_AUTH_TYPE = #{authType,jdbcType=VARCHAR}
  230. </if>
  231. ORDER BY a.AAH_AUTHTIME desc
  232. </select>
  233. <select id="queryOrderApproval_down" resultType="hashmap" parameterType="java.util.Map">
  234. SELECT
  235. AAH_FLOWNO "flowno",
  236. AAH_APPLYNO "applyno",
  237. AAH_STT "stt",
  238. AAH_USER "user",
  239. AAH_AUTHTIME "authtime",
  240. AAH_RESULT "result",
  241. AAH_OPINION "opinion",
  242. AAH_AUTH_TYPE "authType",
  243. b.USR_NAME "name"
  244. FROM tp_approve_auth a
  245. inner join tp_order_inf c on c.OIF_BATCH = a.AAH_BATCH and c.OIF_ORDERNO = a.AAH_APPLYNO
  246. left join im_user b on b.USR_ID = a.AAH_USER
  247. where 1=1
  248. <if test="orderNo != null and orderNo!= ''">
  249. and a.AAH_APPLYNO = #{orderNo,jdbcType=VARCHAR}
  250. </if>
  251. <if test="authType != null and authType!= ''">
  252. and a.AAH_AUTH_TYPE = #{authType,jdbcType=VARCHAR}
  253. </if>
  254. ORDER BY a.AAH_AUTHTIME asc
  255. </select>
  256. <select id="queryOrderPayment" resultType="hashmap" parameterType="java.util.Map">
  257. SELECT
  258. CFT_FLOWNO "flowno",
  259. CFT_ORDERNO "orderno",
  260. CFT_VOUCHER_NO "voucherNo",
  261. CFT_SUBJECTS "subjects",
  262. CFT_BUDGET_TYPE "budgetType",
  263. CFT_AMT "amt",
  264. CFT_RECV_ACC_NAME "recvAccName",
  265. CFT_RECV_ACC_NO "recvAccNo",
  266. CFT_RECV_ACC_BANK "recvAccBank",
  267. CFT_PAY_ACC_NAME "payAccName",
  268. CFT_PAY_ACC_NO "payAccNo",
  269. CFT_PAY_ACC_BANK "payAccBank",
  270. CFT_PAY_TIME "payTime",
  271. CFT_VOUCHER "voucher",
  272. CFT_CREATE_TIME "createTime",
  273. CFT_CREATE_USER "createUser",
  274. b.USR_NAME "createName",
  275. CFT_TYPE "type"
  276. FROM tp_capital_flow a
  277. left join im_user b on b.USR_ID = a.CFT_CREATE_USER
  278. where 1=1
  279. <if test="orderNo != null and orderNo!= ''">
  280. and a.CFT_ORDERNO = #{orderNo,jdbcType=VARCHAR}
  281. </if>
  282. ORDER BY CFT_CREATE_TIME DESC
  283. </select>
  284. <select id="queryToDoTask" resultType="hashmap" parameterType="java.util.Map">
  285. SELECT
  286. a.OIF_ORDERNO "orderNo",
  287. a.OIF_STT "stt"
  288. FROM tp_order_inf a
  289. where a.OIF_STT <![CDATA[<> ]]> '22'
  290. <if test="usrId != null and usrId != ''">
  291. and a.OIF_MANAGER_NO = #{usrId,jdbcType=VARCHAR}
  292. </if>
  293. ORDER BY a.OIF_MODITY_DATE DESC
  294. </select>
  295. <select id="queryOrderList" parameterType="java.util.Map" resultType="com.minpay.common.bean.OrderModel">
  296. SELECT
  297. toi.OIF_ORDERNO AS 'orderNo',
  298. tci.CIF_NAME AS 'companyName',
  299. (
  300. SELECT
  301. GROUP_CONCAT(ODT_NAME SEPARATOR ',')
  302. FROM
  303. tp_order_detail tod
  304. WHERE
  305. toi.OIF_ORDERNO = tod.ODT_ORDERNO
  306. ) "productName",
  307. toi.OIF_APPRIVE_PASS_DATE AS 'passDate',
  308. toi.OIF_TERM AS 'term',
  309. toi.OIF_EXPIRED_DATE AS 'expiredDate',
  310. (
  311. CASE toi.OIF_STT
  312. WHEN '00' THEN
  313. '已申请'
  314. WHEN '01' THEN
  315. '已提交'
  316. WHEN '02' THEN
  317. '估值不通过'
  318. WHEN '03' THEN
  319. '审批中'
  320. WHEN '04' THEN
  321. '审批拒绝'
  322. WHEN '05' THEN
  323. '合同已签署'
  324. WHEN '06' THEN
  325. '预付款已支付'
  326. WHEN '10' THEN
  327. '已支付供应商订货款'
  328. WHEN '11' THEN
  329. '货品生产完成'
  330. WHEN '12' THEN
  331. '已支付供应商尾款'
  332. WHEN '13' THEN
  333. '已支付供应商尾款'
  334. WHEN '20' THEN
  335. '运输中'
  336. WHEN '21' THEN
  337. '货品已入库'
  338. WHEN '22' THEN
  339. '已完成'
  340. END
  341. ) AS 'stt',
  342. (CASE WHEN #{newDate,jdbcType=VARCHAR} > OIF_EXPIRED_DATE THEN "宽限期" ELSE "--" END) "overdueState"
  343. FROM
  344. tp_order_inf toi
  345. INNER JOIN tp_company_info tci ON tci.CIF_ID = toi.OIF_COM_ID
  346. <where>
  347. <if test="corName != null and corName != ''">
  348. tci.CIF_NAME like CONCAT('%',#{corName},'%')
  349. </if>
  350. <if test="orderNo != null and orderNo != ''">
  351. and toi.OIF_ORDERNO like CONCAT('%',#{orderNo},'%')
  352. </if>
  353. <if test="state != null and state != ''">
  354. and toi.OIF_STT = #{state}
  355. </if>
  356. <if test="beginDate != null and beginDate != ''">
  357. <![CDATA[and toi.OIF_APPLY_DATE >= #{beginDate}]]>
  358. </if>
  359. <if test="endDate != null and endDate != ''">
  360. <![CDATA[and toi.OIF_APPLY_DATE <= #{endDate}]]>
  361. </if>
  362. </where>
  363. </select>
  364. <select id="queryOrderAmt" resultType="hashmap" parameterType="java.util.Map">
  365. SELECT
  366. sum(t.OIF_TOTAL_AMT) "orderAmt"
  367. FROM tp_order_inf t
  368. where 1=1
  369. <if test="imUserId != null and imUserId != ''">
  370. and t.OIF_MANAGER_NO = #{imUserId, jdbcType=VARCHAR}
  371. </if>
  372. </select>
  373. <select id="queryLoanList" resultType="com.minpay.common.bean.LoanModel" parameterType="java.util.Map">
  374. SELECT
  375. DISTINCT
  376. tci.CIF_NAME AS 'companyName',
  377. tci.CIF_ID AS 'userId',
  378. cast(
  379. tad.ADL_TRXAMOUT AS DECIMAL (20, 6)
  380. ) AS 'loaningAmt',
  381. toi.OIF_APPLY_DATE AS 'applyDate',
  382. toi.OIF_ORDERNO AS 'orderNo',
  383. tci.CIF_NAME AS 'corName'
  384. FROM
  385. tp_company_info tci
  386. LEFT JOIN im_user iu ON iu.USR_COMID = tci.CIF_ID
  387. LEFT JOIN tp_credit_apply tca ON tca.CAP_COM_ID = tci.CIF_ID
  388. LEFT JOIN tp_order_inf toi ON toi.OIF_COM_ID = tci.CIF_ID
  389. LEFT JOIN tp_acc_detail tad ON tad.ADL_REL_NO = toi.OIF_ORDERNO
  390. <where>
  391. tad.ADL_ACCNO = #{userId}
  392. <if test="corName != null and corName != ''">
  393. and tci.CIF_NAME like CONCAT('%',#{corName},'%')
  394. </if>
  395. <if test="beginDate != null and beginDate != ''">
  396. <![CDATA[ and toi.OIF_APPLY_DATE >= #{beginDate}]]>
  397. </if>
  398. <if test="endDate != null and endDate != ''">
  399. <![CDATA[and toi.OIF_APPLY_DATE <= #{endDate}]]>
  400. </if>
  401. </where>
  402. </select>
  403. <select id="queryOrderDetailsB" resultType="hashmap" parameterType="java.util.Map">
  404. SELECT
  405. ODT_ID "id",
  406. ODT_ORDERNO "orderno",
  407. ODT_NAME "name",
  408. ODT_CATEGORY "category",
  409. ODT_BRAND "brand",
  410. ODT_ORIGIN_COUNTRY "originCountry",
  411. ODT_NORMS "norms",
  412. ODT_VALIDITY "validity",
  413. ODT_PRICE_EXIT "priceExit",
  414. ODT_PRICE_CIF "priceCif",
  415. ODT_PRICE_SALE "priceSale",
  416. ODT_COUNT "zcount",
  417. ODT_SUM_AMT "sumAmt",
  418. ODT_Margin_level "marginLevel",
  419. '' AS 'outDate',
  420. '0' AS 'actualCount',
  421. (SELECT tod.ODT_COUNT- IFNULL(SUM(CIF_COUNT),0) FROM tp_outwh_flow a WHERE a.CIF_PROD_ID = tod.ODT_ID) "count"
  422. FROM
  423. tp_order_detail tod
  424. WHERE 1=1 and tod.ODT_ORDERNO = #{orderNo}
  425. </select>
  426. <select id="quertCustomerTodo" resultType="hashmap" parameterType="java.util.Map">
  427. SELECT DISTINCT
  428. a.*
  429. FROM
  430. (
  431. (
  432. SELECT DISTINCT
  433. tci.CIF_ID AS 'orderNo',
  434. tci.CIF_NAME AS 'cifName',
  435. 'stt' AS 'stt',
  436. tci.CIF_CREATE_TIME
  437. FROM
  438. tp_company_info tci
  439. INNER JOIN tp_credit_apply tca ON tca.CAP_COM_ID = tci.CIF_ID
  440. WHERE
  441. CAP_STT = '00'
  442. AND CIF_MANAGER_NO = #{managerNo}
  443. ORDER BY
  444. tci.CIF_CREATE_TIME DESC
  445. )
  446. UNION ALL
  447. (
  448. SELECT DISTINCT
  449. (
  450. CASE
  451. WHEN toi.OIF_STT = '01' THEN
  452. tci.CIF_ID
  453. ELSE
  454. toi.OIF_ORDERNO
  455. END
  456. ) AS 'orderNo',
  457. tci.CIF_NAME 'cifName',
  458. toi.OIF_STT AS 'stt',
  459. tci.CIF_CREATE_TIME
  460. FROM
  461. tp_order_inf toi
  462. LEFT JOIN tp_company_info tci ON toi.OIF_COM_ID = tci.CIF_ID
  463. WHERE
  464. OIF_STT IN ('01', '04', '11', '21')
  465. AND OIF_MANAGER_NO = #{managerNo}
  466. ORDER BY
  467. tci.CIF_CREATE_TIME DESC
  468. )
  469. UNION ALL
  470. (
  471. SELECT DISTINCT
  472. toi.OIF_ORDERNO AS 'orderNo',
  473. tci.CIF_NAME 'cifName',
  474. 'std' AS 'stt',
  475. tci.CIF_CREATE_TIME
  476. FROM
  477. tp_order_inf toi
  478. LEFT JOIN tp_company_info tci ON toi.OIF_COM_ID = tci.CIF_ID
  479. WHERE
  480. #{newDate,jdbcType=VARCHAR} > OIF_EXPIRED_DATE
  481. AND OIF_MANAGER_NO = #{managerNo}
  482. ORDER BY
  483. tci.CIF_CREATE_TIME DESC
  484. )
  485. UNION ALL
  486. (
  487. SELECT DISTINCT
  488. toi.OIF_ORDERNO AS 'orderNo',
  489. tci.CIF_NAME AS 'cifName',
  490. 'stc' AS 'stt',
  491. tci.CIF_CREATE_TIME
  492. FROM
  493. tp_order_inf toi
  494. INNER JOIN tp_company_info tci ON toi.OIF_COM_ID = tci.CIF_ID
  495. WHERE
  496. OIF_STT = '00'
  497. AND CIF_MANAGER_NO = #{managerNo}
  498. ORDER BY
  499. tci.CIF_CREATE_TIME DESC
  500. )
  501. UNION ALL
  502. (
  503. SELECT DISTINCT
  504. tci.CIF_ID 'orderNo',
  505. tci.CIF_NAME 'cifName',
  506. '01' AS 'stt',
  507. tci.CIF_CREATE_TIME
  508. FROM
  509. tp_company_info tci
  510. INNER JOIN im_user iu ON tci.CIF_ID = iu.USR_COMID
  511. WHERE
  512. CIF_STT = '01'
  513. AND CIF_MANAGER_NO = #{managerNo}
  514. ORDER BY
  515. tci.CIF_CREATE_TIME DESC
  516. )
  517. ) a ORDER BY
  518. CIF_CREATE_TIME DESC
  519. </select>
  520. <select id="getOutFlowDetail" resultType="hashmap" parameterType="java.util.Map">
  521. SELECT DISTINCT
  522. CIF_BATCH_NO AS batchNo,
  523. CIF_OTHER_FEE AS otherFee,
  524. CIF_STOAGE_FEE AS stoageFee,
  525. CIF_TOTAL_FEE AS totalFee
  526. FROM
  527. tp_outwh_flow
  528. WHERE
  529. CIF_ORDER_NO = #{orderNo}
  530. AND CIF_TOTAL_FEE != ''
  531. ORDER BY
  532. CIF_BATCH_NO
  533. </select>
  534. </mapper>