UseMoneyMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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.zjugis.business.flow.usemoney.dao.UseMoneyDao">
  4. <select id="getUseMoneyEarnestPage"
  5. resultType="com.zjugis.business.flow.usemoney.controller.vo.UseMoneyEarnestRespVO">
  6. SELECT
  7. T2.ID,
  8. T2.instance_id,
  9. T2.PROJECT_ID,
  10. T2.APPLY_TIME,
  11. to_char(T2.COLLECTION_COMPANY) as COLLECTION_COMPANY,
  12. T2.USER_NICKNAME,
  13. T2.DEPT_NAME,
  14. T2.PAYMENT_COMPANY_ID,
  15. T1.AMOUNT,
  16. to_char(T1.REMARK) REMARK,
  17. T1.WRITE_OFF_AMOUNT,
  18. T1.I_WRITE_OFF,
  19. T1.WRITE_OFF_TIME,
  20. T1.COST_TYPE,
  21. T1.ID as detailId,
  22. case when T2.PROJECT_ID is not null then T3.XMMC else T4.XMMC end as XMMC,
  23. 'usemonvy' as type
  24. FROM
  25. WF_USE_MONEY_DETAIL T1
  26. LEFT JOIN WF_USE_MONEY T2 ON T1.USE_MONEY_ID = T2.ID
  27. LEFT JOIN PROJECT T3 ON T2.PROJECT_ID=T3.ID
  28. LEFT JOIN project T4 ON T1.PROJECT_ID=T4.ID
  29. <where>
  30. T1.COST_TYPE LIKE '14%' and T2.FLOW_STATUS=90
  31. <if test="params != null and params.collectionCompany != null and params.collectionCompany != ''">
  32. <bind name="collectionCompany" value="'%'+params.collectionCompany+'%'"/>
  33. AND T2.COLLECTION_COMPANY like #{collectionCompany}
  34. </if>
  35. <if test="params != null and params.REMARK != null and params.REMARK != ''">
  36. <bind name="REMARK" value="'%'+params.REMARK+'%'"/>
  37. AND T1.REMARK like #{REMARK}
  38. </if>
  39. <if test="params != null and params.costType != null and params.costType != ''">
  40. AND T1.COST_TYPE = #{params.costType}
  41. </if>
  42. <if test="params != null and params.useMoneyNo != null and params.useMoneyNo != ''">
  43. AND T2.USE_MONEY_NO = #{params.useMoneyNo}
  44. </if>
  45. <if test="params != null and params.totalAmount != null and params.totalAmount != ''">
  46. AND T2.TOTAL_AMOUNT = #{params.totalAmount}
  47. </if>
  48. <if test="params != null and params.status != null and params.status != ''">
  49. AND T1.I_WRITE_OFF = #{params.status}
  50. </if>
  51. <if test="params != null and params.userId != null and params.userId != ''">
  52. AND T2.USER_ID = #{params.userId}
  53. </if>
  54. <if test="params != null and params.applyOn != null ">
  55. AND T2.APPLY_TIME &gt;= #{params.applyOn}
  56. </if>
  57. <if test="params != null and params.applyOff != null ">
  58. AND T2.APPLY_TIME &lt;= #{params.applyOff}
  59. </if>
  60. <if test="params != null and params.writeOn != null ">
  61. AND T1.WRITE_OFF_TIME &gt;= #{params.writeOn}
  62. </if>
  63. <if test="params != null and params.writeOff != null ">
  64. AND T1.WRITE_OFF_TIME &lt;= #{params.writeOff}
  65. </if>
  66. <if test="params != null and params.DeptList != null and params.DeptList.size > 0">
  67. AND T3.ZRBM_ID in
  68. <foreach collection="params.DeptList" item="item" open="(" close=")" separator=",">
  69. #{item}
  70. </foreach>
  71. </if>
  72. <if test="params != null and params.UserDeptList != null and params.UserDeptList.size > 0">
  73. AND T2.DEPT_ID in
  74. <foreach collection="params.UserDeptList" item="item" open="(" close=")" separator=",">
  75. #{item}
  76. </foreach>
  77. </if>
  78. </where>
  79. union
  80. SELECT
  81. T2.ID,
  82. T2.instance_id,
  83. T2.PROJECT_ID,
  84. T2.APPLY_TIME,
  85. '' as COLLECTION_COMPANY,
  86. T2.USER_NICKNAME,
  87. T2.DEPT_NAME,
  88. T2.PAYMENT_COMPANY_ID,
  89. T1.AMOUNT,
  90. to_char(T1.BZ1) AS REMARK,
  91. T1.WRITE_OFF_AMOUNT,
  92. T1.I_WRITE_OFF,
  93. T1.WRITE_OFF_TIME,
  94. T1.COST_TYPE,
  95. T1.ID as detailId,
  96. T3.XMMC,
  97. 'cost' as type
  98. FROM
  99. WF_COMMON_COST_DETAIL T1
  100. LEFT JOIN WF_COMMON_COST T2 ON T1.COMMON_COST_ID = T2.ID
  101. LEFT JOIN PROJECT T3 ON T1.PROJECT_ID=T3.ID
  102. <where>
  103. T1.COST_TYPE LIKE '14%' and T2.FLOW_STATUS=90
  104. <if test="params != null and params.collectionCompany != null and params.collectionCompany != ''">
  105. <bind name="collectionCompany" value="'%'+params.collectionCompany+'%'"/>
  106. AND 1!=1
  107. </if>
  108. <if test="params != null and params.REMARK != null and params.REMARK != ''">
  109. <bind name="REMARK" value="'%'+params.REMARK+'%'"/>
  110. AND T1.BZ1 like #{REMARK}
  111. </if>
  112. <if test="params != null and params.costType != null and params.costType != ''">
  113. AND T1.COST_TYPE = #{params.costType}
  114. </if>
  115. <if test="params != null and params.useMoneyNo != null and params.useMoneyNo != ''">
  116. AND T2.COMMON_COST_NO = #{params.useMoneyNo}
  117. </if>
  118. <if test="params != null and params.totalAmount != null and params.totalAmount != ''">
  119. AND T1.AMOUNT = #{params.totalAmount}
  120. </if>
  121. <if test="params != null and params.status != null and params.status != ''">
  122. AND T1.I_WRITE_OFF = #{params.status}
  123. </if>
  124. <if test="params != null and params.userId != null and params.userId != ''">
  125. AND T2.USER_ID = #{params.userId}
  126. </if>
  127. <if test="params != null and params.applyOn != null ">
  128. AND T2.APPLY_TIME &gt;= #{params.applyOn}
  129. </if>
  130. <if test="params != null and params.applyOff != null">
  131. AND T2.APPLY_TIME &lt;= #{params.applyOff}
  132. </if>
  133. <if test="params != null and params.writeOn != null ">
  134. AND T1.WRITE_OFF_TIME &gt;= #{params.writeOn}
  135. </if>
  136. <if test="params != null and params.writeOff != null ">
  137. AND T1.WRITE_OFF_TIME &lt;= #{params.writeOff}
  138. </if>
  139. <if test="params != null and params.DeptList != null and params.DeptList.size > 0">
  140. AND T3.ZRBM_ID in
  141. <foreach collection="params.DeptList" item="item" open="(" close=")" separator=",">
  142. #{item}
  143. </foreach>
  144. </if>
  145. <if test="params != null and params.UserDeptList != null and params.UserDeptList.size > 0">
  146. AND T2.DEPT_ID in
  147. <foreach collection="params.UserDeptList" item="item" open="(" close=")" separator=",">
  148. #{item}
  149. </foreach>
  150. </if>
  151. </where>
  152. order by APPLY_TIME DESC NULLS LAST
  153. </select>
  154. <select id="getUseMoneyEarnestDeptPage"
  155. resultType="com.zjugis.business.flow.usemoney.controller.vo.UseMoneyEarnestRespVO">
  156. SELECT
  157. T2.ID,
  158. T2.INSTANCE_ID,
  159. T2.PROJECT_ID,
  160. T2.APPLY_TIME,
  161. to_char(T2.COLLECTION_COMPANY) as COLLECTION_COMPANY,
  162. T2.USER_NICKNAME,
  163. T2.PAYMENT_COMPANY_ID,
  164. T1.AMOUNT,
  165. to_char(T1.REMARK) as REMARK,
  166. T1.WRITE_OFF_AMOUNT,
  167. T1.I_WRITE_OFF,
  168. T1.WRITE_OFF_TIME,
  169. T1.COST_TYPE,
  170. case when T2.PROJECT_ID is not null then T3.XMMC else T4.XMMC end as XMMC
  171. FROM
  172. WF_USE_MONEY_DETAIL T1
  173. LEFT JOIN WF_USE_MONEY T2 ON T1.USE_MONEY_ID = T2.ID
  174. LEFT JOIN project T3 ON T2.PROJECT_ID=T3.ID
  175. LEFT JOIN project T4 ON T1.PROJECT_ID=T4.ID
  176. <where>
  177. T1.COST_TYPE LIKE '14%' and T2.FLOW_STATUS=90
  178. <if test="projectIds != null and projectIds.size > 0">
  179. AND (T2.PROJECT_ID IN
  180. <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")">
  181. #{item,jdbcType=VARCHAR}
  182. </foreach>
  183. or T1.PROJECT_ID IN
  184. <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")">
  185. #{item,jdbcType=VARCHAR}
  186. </foreach>
  187. <if test="params.UserDeptList != null and params.UserDeptList.size > 0">
  188. or (T2.DEPT_ID IN
  189. <foreach collection="params.UserDeptList" index="index" item="item1" open="(" separator="," close=")">
  190. #{item1,jdbcType=VARCHAR}
  191. </foreach>
  192. )
  193. </if>
  194. )
  195. </if>
  196. <if test="params != null and params.collectionCompany != null and params.collectionCompany != ''">
  197. <bind name="collectionCompany" value="'%'+params.collectionCompany+'%'"/>
  198. AND T2.COLLECTION_COMPANY like #{collectionCompany}
  199. </if>
  200. <if test="params != null and params.REMARK != null and params.REMARK != ''">
  201. <bind name="REMARK" value="'%'+params.REMARK+'%'"/>
  202. AND T1.REMARK like #{REMARK}
  203. </if>
  204. <if test="params != null and params.costType != null and params.costType != ''">
  205. AND T1.COST_TYPE = #{params.costType}
  206. </if>
  207. <if test="params != null and params.totalAmount != null and params.totalAmount != ''">
  208. AND T2.TOTAL_AMOUNT = #{params.totalAmount}
  209. </if>
  210. <if test="params != null and params.status != null and params.status != ''">
  211. AND T1.I_WRITE_OFF = #{params.status}
  212. </if>
  213. <if test="params != null and params.userId != null and params.userId != ''">
  214. AND T2.USER_ID = #{params.userId}
  215. </if>
  216. <if test="params != null and params.applyOn != null ">
  217. AND T2.APPLY_TIME &gt;= #{params.applyOn}
  218. </if>
  219. <if test="params != null and params.applyOff != null ">
  220. AND T2.APPLY_TIME &lt;= #{params.applyOff}
  221. </if>
  222. <if test="params != null and params.writeOn != null ">
  223. AND T1.WRITE_OFF_TIME &gt;= #{params.writeOn}
  224. </if>
  225. <if test="params != null and params.writeOff != null ">
  226. AND T1.WRITE_OFF_TIME &lt;= #{params.writeOff}
  227. </if>
  228. <if test="params != null and params.DeptList != null and params.DeptList.size > 0">
  229. AND T3.ZRBM_ID in
  230. <foreach collection="params.DeptList" item="item" open="(" close=")" separator=",">
  231. #{item}
  232. </foreach>
  233. </if>
  234. </where>
  235. union
  236. SELECT
  237. T2.ID,
  238. T2.instance_id,
  239. T2.PROJECT_ID,
  240. T2.APPLY_TIME,
  241. '' as COLLECTION_COMPANY,
  242. T2.USER_NICKNAME,
  243. T2.PAYMENT_COMPANY_ID,
  244. T1.AMOUNT,
  245. to_char(T1.BZ1) AS REMARK,
  246. T1.WRITE_OFF_AMOUNT,
  247. T1.I_WRITE_OFF,
  248. T1.WRITE_OFF_TIME,
  249. T1.COST_TYPE,
  250. T3.XMMC
  251. FROM
  252. WF_COMMON_COST_DETAIL T1
  253. LEFT JOIN WF_COMMON_COST T2 ON T1.COMMON_COST_ID = T2.ID
  254. LEFT JOIN PROJECT T3 ON T2.PROJECT_ID=T3.ID
  255. <where>
  256. T1.COST_TYPE LIKE '14%' and T2.FLOW_STATUS=90
  257. <if test="projectIds != null and projectIds.size > 0">
  258. AND (T1.PROJECT_ID IN
  259. <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")">
  260. #{item,jdbcType=VARCHAR}
  261. </foreach>
  262. <if test="params.UserDeptList != null and params.UserDeptList.size > 0">
  263. or (T2.DEPT_ID IN
  264. <foreach collection="params.UserDeptList" index="index" item="item1" open="(" separator="," close=")">
  265. #{item1,jdbcType=VARCHAR}
  266. </foreach>
  267. )
  268. </if>
  269. )
  270. </if>
  271. <if test="params != null and params.collectionCompany != null and params.collectionCompany != ''">
  272. <bind name="collectionCompany" value="'%'+params.collectionCompany+'%'"/>
  273. AND 1!=1
  274. </if>
  275. <if test="params != null and params.REMARK != null and params.REMARK != ''">
  276. <bind name="REMARK" value="'%'+params.REMARK+'%'"/>
  277. AND T1.BZ1 like #{REMARK}
  278. </if>
  279. <if test="params != null and params.costType != null and params.costType != ''">
  280. AND T1.COST_TYPE = #{params.costType}
  281. </if>
  282. <!-- <if test="params != null and params.useMoneyNo != null and params.useMoneyNo != ''">-->
  283. <!-- AND T2.COMMON_COST_NO = #{params.useMoneyNo}-->
  284. <!-- </if>-->
  285. <if test="params != null and params.totalAmount != null and params.totalAmount != ''">
  286. AND T1.AMOUNT = #{params.totalAmount}
  287. </if>
  288. <if test="params != null and params.status != null and params.status != ''">
  289. AND T1.I_WRITE_OFF = #{params.status}
  290. </if>
  291. <if test="params != null and params.userId != null and params.userId != ''">
  292. AND T2.USER_ID = #{params.userId}
  293. </if>
  294. <if test="params != null and params.applyOn != null ">
  295. AND T2.APPLY_TIME &gt;= #{params.applyOn}
  296. </if>
  297. <if test="params != null and params.applyOff != null ">
  298. AND T2.APPLY_TIME &lt;= #{params.applyOff}
  299. </if>
  300. <if test="params != null and params.writeOn != null ">
  301. AND T1.WRITE_OFF_TIME &gt;= #{params.writeOn}
  302. </if>
  303. <if test="params != null and params.writeOff != null ">
  304. AND T1.WRITE_OFF_TIME &lt;= #{params.writeOff}
  305. </if>
  306. <if test="params != null and params.DeptList != null and params.DeptList.size > 0">
  307. AND T3.ZRBM_ID in
  308. <foreach collection="params.DeptList" item="item" open="(" close=")" separator=",">
  309. #{item}
  310. </foreach>
  311. </if>
  312. </where>
  313. ORDER BY APPLY_TIME DESC NULLS LAST
  314. </select>
  315. <select id="getCount" resultType="java.lang.Integer">
  316. select sum(num) from (
  317. SELECT count(*) as num
  318. from
  319. WF_USE_MONEY_DETAIL T1
  320. LEFT JOIN WF_USE_MONEY T2 ON T1.USE_MONEY_ID = T2.ID
  321. <where>
  322. T1.ISVALID = 1 and T2.FLOW_STATUS=90 and I_WRITE_OFF=0 AND T2.ISVALID = 1 and T1.COST_TYPE LIKE '14%'
  323. <if test="params != null and params.userId != null and params.userId != ''">
  324. AND USER_ID = #{params.userId}
  325. </if>
  326. </where>
  327. union all
  328. SELECT count(*) as num
  329. from
  330. WF_COMMON_COST_DETAIL T1
  331. LEFT JOIN WF_COMMON_COST T2 ON T1.COMMON_COST_ID = T2.ID
  332. <where>
  333. T1.ISVALID = 1 and T2.FLOW_STATUS=90 and I_WRITE_OFF=0 AND T2.ISVALID = 1 and T1.COST_TYPE LIKE '14%'
  334. <if test="params != null and params.userId != null and params.userId != ''">
  335. AND USER_ID = #{params.userId}
  336. </if>
  337. </where>
  338. ) e
  339. </select>
  340. <select id="getUseMoneyOverviewHx" resultType="com.zjugis.business.flow.usemoney.controller.vo.UseMoneyOverviewVO">
  341. select
  342. NVL( sum( totalAmount ), 0 ) AS totalAmount,
  343. NVL( sum( totalUseAmount ), 0 ) AS totalUseAmount,
  344. NVL( sum( totalAmount ) - sum( totalUseAmount ), 0 ) AS totalApplyAmount
  345. from (
  346. SELECT
  347. NVL(sum(AMOUNT),0) as totalAmount,
  348. NVL(sum(WRITE_OFF_AMOUNT),0) as totalUseAmount,
  349. NVL(sum(AMOUNT)-sum(WRITE_OFF_AMOUNT),0) as totalApplyAmount
  350. from
  351. WF_USE_MONEY_DETAIL T1
  352. LEFT JOIN WF_USE_MONEY T2 ON T1.USE_MONEY_ID = T2.ID
  353. LEFT JOIN project T3 ON T2.PROJECT_ID=T3.ID
  354. <where>
  355. T1.ISVALID = 1 and T2.FLOW_STATUS=90 AND T2.ISVALID = 1 and T1.COST_TYPE LIKE '14%'
  356. <if test="params != null and params.collectionCompany != null and params.collectionCompany != ''">
  357. <bind name="collectionCompany" value="'%'+params.collectionCompany+'%'"/>
  358. AND T2.COLLECTION_COMPANY like #{collectionCompany}
  359. </if>
  360. <if test="params != null and params.REMARK != null and params.REMARK != ''">
  361. <bind name="REMARK" value="'%'+params.REMARK+'%'"/>
  362. AND T1.REMARK like #{REMARK}
  363. </if>
  364. <if test="params != null and params.costType != null and params.costType != ''">
  365. AND T1.COST_TYPE = #{params.costType}
  366. </if>
  367. <if test="params != null and params.useMoneyNo != null and params.useMoneyNo != ''">
  368. AND T2.USE_MONEY_NO = #{params.useMoneyNo}
  369. </if>
  370. <if test="params != null and params.totalAmount != null and params.totalAmount != ''">
  371. AND T2.TOTAL_AMOUNT = #{params.totalAmount}
  372. </if>
  373. <if test="params != null and params.status != null and params.status != ''">
  374. AND T1.I_WRITE_OFF = #{params.status}
  375. </if>
  376. <if test="params != null and params.userId != null and params.userId != ''">
  377. AND T2.USER_ID = #{params.userId}
  378. </if>
  379. <if test="params != null and params.applyOn != null ">
  380. AND T2.APPLY_TIME &gt;= #{params.applyOn}
  381. </if>
  382. <if test="params != null and params.applyOff != null ">
  383. AND T2.APPLY_TIME &lt;= #{params.applyOff}
  384. </if>
  385. <if test="params != null and params.writeOn != null ">
  386. AND T1.WRITE_OFF_TIME &gt;= #{params.writeOn}
  387. </if>
  388. <if test="params != null and params.writeOff != null ">
  389. AND T1.WRITE_OFF_TIME &lt;= #{params.writeOff}
  390. </if>
  391. <if test="params != null and params.DeptList != null and params.DeptList.size > 0">
  392. AND T3.ZRBM_ID in
  393. <foreach collection="params.DeptList" item="item" open="(" close=")" separator=",">
  394. #{item}
  395. </foreach>
  396. </if>
  397. <if test="params.project != null and params.project.size > 0">
  398. AND (T2.PROJECT_ID IN
  399. <foreach collection="params.project" index="index" item="item" open="(" separator="," close=")">
  400. #{item,jdbcType=VARCHAR}
  401. </foreach>
  402. or T1.PROJECT_ID IN
  403. <foreach collection="params.project" index="index" item="item" open="(" separator="," close=")">
  404. #{item,jdbcType=VARCHAR}
  405. </foreach>
  406. <if test="params.UserDeptList != null and params.UserDeptList.size > 0">
  407. or (T2.DEPT_ID IN
  408. <foreach collection="params.UserDeptList" index="index" item="item1" open="(" separator="," close=")">
  409. #{item1,jdbcType=VARCHAR}
  410. </foreach>
  411. )
  412. </if>
  413. )
  414. </if>
  415. </where>
  416. union all
  417. SELECT
  418. NVL(sum(AMOUNT),0) as totalAmount,
  419. NVL(sum(WRITE_OFF_AMOUNT),0) as totalUseAmount,
  420. NVL(sum(AMOUNT)-sum(WRITE_OFF_AMOUNT),0) as totalApplyAmount
  421. from
  422. WF_COMMON_COST_DETAIL T1
  423. LEFT JOIN WF_COMMON_COST T2 ON T1.COMMON_COST_ID = T2.ID
  424. LEFT JOIN project T3 ON T2.PROJECT_ID=T3.ID
  425. <where>
  426. T1.ISVALID = 1 and T2.FLOW_STATUS=90 AND T2.ISVALID = 1 and T1.COST_TYPE LIKE '14%'
  427. <if test="params != null and params.collectionCompany != null and params.collectionCompany != ''">
  428. <bind name="collectionCompany" value="'%'+params.collectionCompany+'%'"/>
  429. AND 1!=1
  430. </if>
  431. <if test="params != null and params.REMARK != null and params.REMARK != ''">
  432. <bind name="REMARK" value="'%'+params.REMARK+'%'"/>
  433. AND T1.BZ1 like #{REMARK}
  434. </if>
  435. <if test="params != null and params.costType != null and params.costType != ''">
  436. AND T1.COST_TYPE = #{params.costType}
  437. </if>
  438. <if test="params != null and params.useMoneyNo != null and params.useMoneyNo != ''">
  439. AND T2.COMMON_COST_NO = #{params.useMoneyNo}
  440. </if>
  441. <if test="params != null and params.totalAmount != null and params.totalAmount != ''">
  442. AND T2.TOTAL_AMOUNT = #{params.totalAmount}
  443. </if>
  444. <if test="params != null and params.status != null and params.status != ''">
  445. AND T1.I_WRITE_OFF = #{params.status}
  446. </if>
  447. <if test="params != null and params.userId != null and params.userId != ''">
  448. AND T2.USER_ID = #{params.userId}
  449. </if>
  450. <if test="params != null and params.applyOn != null ">
  451. AND T2.APPLY_TIME &gt;= #{params.applyOn}
  452. </if>
  453. <if test="params != null and params.applyOff != null ">
  454. AND T2.APPLY_TIME &lt;= #{params.applyOff}
  455. </if>
  456. <if test="params != null and params.writeOn != null">
  457. AND T1.WRITE_OFF_TIME &gt;= #{params.writeOn}
  458. </if>
  459. <if test="params != null and params.writeOff != null ">
  460. AND T1.WRITE_OFF_TIME &lt;= #{params.writeOff}
  461. </if>
  462. <if test="params != null and params.DeptList != null and params.DeptList.size > 0">
  463. AND T3.ZRBM_ID in
  464. <foreach collection="params.DeptList" item="item" open="(" close=")" separator=",">
  465. #{item}
  466. </foreach>
  467. </if>
  468. <if test="params.project != null and params.project.size > 0">
  469. AND (T1.PROJECT_ID IN
  470. <foreach collection="params.project" index="index" item="item" open="(" separator="," close=")">
  471. #{item,jdbcType=VARCHAR}
  472. </foreach>
  473. <if test="params.UserDeptList != null and params.UserDeptList.size > 0">
  474. or (T2.DEPT_ID IN
  475. <foreach collection="params.UserDeptList" index="index" item="item1" open="(" separator="," close=")">
  476. #{item1,jdbcType=VARCHAR}
  477. </foreach>
  478. )
  479. </if>
  480. )
  481. </if>
  482. </where>) e
  483. </select>
  484. <!-- <select id="getUseMoneyPage" resultType="com.zjugis.business.flow.usemoney.controller.vo.UseMoneyRespVO">-->
  485. <!-- SELECT-->
  486. <!-- T.*-->
  487. <!-- FROM-->
  488. <!-- WF_USE_MONEY T-->
  489. <!-- <where>-->
  490. <!-- <if test="params != null and params.userId != null">-->
  491. <!-- AND T.USER_ID = #{params.userId}-->
  492. <!-- </if>-->
  493. <!-- <if test="params != null and params.costType != null">-->
  494. <!-- AND T.DEPT_ID = #{params.costType}-->
  495. <!-- </if>-->
  496. <!-- <if test="params != null and params.costType != null">-->
  497. <!-- AND T.USE_MONEY_NO = #{params.costType}-->
  498. <!-- </if>-->
  499. <!-- <if test="params != null and params.costType != null">-->
  500. <!-- AND T.COST_TYPE = #{params.costType}-->
  501. <!-- </if>-->
  502. <!-- <if test="params != null and params.params.flowStatus != null">-->
  503. <!-- AND T.FLOW_STATUS = #{params.flowStatus}-->
  504. <!-- </if>-->
  505. <!-- <if test="params != null and params.costType != null">-->
  506. <!-- AND T.TOTAL_AMOUNT = #{params.costType}-->
  507. <!-- </if>-->
  508. <!-- <if test="params != null and params.applyOn != null">-->
  509. <!-- AND T.APPLY_DATE &gt;= #{params.applyOn}-->
  510. <!-- </if>-->
  511. <!-- <if test="params != null and params.applyOff != null">-->
  512. <!-- AND T.APPLY_DATE &lt;= #{params.applyOff}-->
  513. <!-- </if>-->
  514. <!-- </where>-->
  515. <!-- ORDER BY T.APPLY_TIME DESC NULLS LAST-->
  516. <!-- </select>-->
  517. <select id="getAllIdByProject" resultType="java.lang.String">
  518. SELECT T1.id
  519. from
  520. WF_USE_MONEY T1
  521. LEFT JOIN WF_USE_MONEY_DETAIL T2 ON T2.USE_MONEY_ID = T1.ID
  522. <where>
  523. T1.ISVALID = 1 and T1.FLOW_STATUS=90 AND T2.ISVALID = 1
  524. and (t1.PROJECT_ID=#{project} or t2.PROJECT_ID=#{project})
  525. </where>
  526. </select>
  527. <select id="getDataByProject" resultType="com.zjugis.business.flow.usemoney.controller.vo.UseMoneyTypeRespVO">
  528. SELECT
  529. sum(case when t1.COST_TYPE ='0101' or t1.COST_TYPE ='0102' then t1.AMOUNT else 0 end ) as subAmount,
  530. sum(case when t1.COST_TYPE ='03' then t1.AMOUNT else 0 end ) as outAmount,
  531. sum(case when t1.COST_TYPE !='03' and t1.COST_TYPE !='0101' and t1.COST_TYPE !='0102' then t1.AMOUNT else 0 end ) as otherAmount
  532. from
  533. WF_USE_MONEY_DETAIL T1
  534. LEFT JOIN WF_USE_MONEY T2 ON T1.USE_MONEY_ID = T2.ID
  535. <where>
  536. T1.ISVALID = 1 and T2.FLOW_STATUS=90 AND T2.ISVALID = 1
  537. and (t1.PROJECT_ID=#{project} or t2.PROJECT_ID=#{project})
  538. </where>
  539. </select>
  540. </mapper>