CapitalTransferMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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.fuzamei.mapperInterface.CapitalTransferMapper"><!-- 找接口 -->
  4. <!--查询资金划转表 列表 管理人发起后 管理人和指令业务岗能看见 -->
  5. <select id="selectCapitalTransferTable" parameterType="java.util.Map" resultType="com.fuzamei.entity.CapitalTransfer">
  6. select z.fund_id,
  7. y.person_name,
  8. z.fund_name,
  9. y.account_balance,
  10. z.sum_of_money,
  11. f.attachment_name,
  12. f.url,
  13. y.drawing_account,
  14. z.apply_time,
  15. z.handle_time,
  16. s.status_name
  17. from
  18. capital_transfer z left join t_user y
  19. on z. custodian=y.user_id
  20. left join attachment f
  21. on z.basis_of_payment=f.attachment_id
  22. left join status s on z.status_id=s.status_id
  23. <where>
  24. <if test="fund_name!='' and fund_name!= null">
  25. fund_name=#{fund_name}
  26. </if>
  27. <if test="status_name!='' and status_name!=null">
  28. and status_name=#{status_name}
  29. </if>
  30. <if test="startTime!=null and endTime!=null">
  31. and apply_time between #{startTime} and #{endTime}
  32. </if>
  33. </where>
  34. order by apply_time desc
  35. limit #{startPage},#{rowNum}
  36. </select>
  37. <!-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||/////////////////////////////-->
  38. <!--查询资金划转表 列表 指令业务岗审核通过后 核算业务岗 才能看见之前的记录 状态不在12和13 -->
  39. <select id="selectCapitalTransferTable2" parameterType="java.util.Map" resultType="com.fuzamei.entity.CapitalTransfer">
  40. select z.fund_id,
  41. y.person_name,
  42. z.fund_name,
  43. y.account_balance,
  44. z.sum_of_money,
  45. f.attachment_name,
  46. f.url,
  47. y.drawing_account,
  48. z.apply_time,
  49. z.handle_time,
  50. s.status_name
  51. from
  52. capital_transfer z left join t_user y
  53. on z. custodian=y.user_id
  54. left join attachment f
  55. on z.basis_of_payment=f.attachment_id
  56. left join status s on z.status_id=s.status_id
  57. <where>
  58. z.status_id not in(12,13)
  59. <if test="fund_name!='' and fund_name!= null">
  60. and fund_name=#{fund_name}
  61. </if>
  62. <if test="status_name!='' and status_name!=null">
  63. and status_name=#{status_name}
  64. </if>
  65. <if test="startTime!=null and endTime!=null">
  66. and apply_time between #{startTime} and #{endTime}
  67. </if>
  68. </where>
  69. order by apply_time desc
  70. limit #{startPage},#{rowNum}
  71. </select>
  72. <!--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
  73. <!--查询资金划转表 列表 指令业务岗和核算业务岗审核通过后 核算主管岗 才能看见之前的记录 状态不在12和13和14和15 -->
  74. <select id="selectCapitalTransferTable3" parameterType="java.util.Map" resultType="com.fuzamei.entity.CapitalTransfer">
  75. select z.fund_id,
  76. y.person_name,
  77. z.fund_name,
  78. y.account_balance,
  79. z.sum_of_money,
  80. f.attachment_name,
  81. f.url,
  82. y.drawing_account,
  83. z.apply_time,
  84. z.handle_time,
  85. s.status_name
  86. from
  87. capital_transfer z left join t_user y
  88. on z. custodian=y.user_id
  89. left join attachment f
  90. on z.basis_of_payment=f.attachment_id
  91. left join status s on z.status_id=s.status_id
  92. <where>
  93. z.status_id not in(12,13,14,15)
  94. <if test="fund_name!='' and fund_name!= null">
  95. and fund_name=#{fund_name}
  96. </if>
  97. <if test="status_name!='' and status_name!=null">
  98. and status_name=#{status_name}
  99. </if>
  100. <if test="startTime!=null and endTime!=null">
  101. and apply_time between #{startTime} and #{endTime}
  102. </if>
  103. </where>
  104. order by apply_time desc
  105. limit #{startPage},#{rowNum}
  106. </select>
  107. <!-- ///////////////////////////////分页//////////////////////////////////////////////////////////////////////////////////// -->
  108. <!--查询资金划转表 返回查询总条数 管理人和指令业务岗可以查看-->
  109. <select id="selectCapitalTransferPage" resultType="int" parameterType="java.util.Map">
  110. <!-- SELECT count(*) from capital_transfer z left join status s on z.status_id = s.status_id -->
  111. select count(*) from capital_transfer z
  112. <where>
  113. <if test="fund_name != null and fund_name!=''">
  114. fund_name=#{fund_name}
  115. </if>
  116. <if test="status_name!= null and status_name!=''">
  117. and status_name=#{status_name}
  118. </if>
  119. <if test="startTime!=null and endTime!=null">
  120. and apply_time between #{startTime} and #{endTime}
  121. </if>
  122. </where>
  123. </select>
  124. <!-- ////////////////////////////////////////////////////////////////////////////////////////////////// -->
  125. <!--查询资金划转表 返回查询总条数 指令业务岗审核通过后核算业务岗才能看见之前审核的列表信息 -->
  126. <select id="selectCapitalTransferPage2" resultType="int" parameterType="java.util.Map">
  127. <!-- SELECT count(*) from capital_transfer z left join status s on z.status_id = s.status_id -->
  128. select count(*) from capital_transfer z
  129. <where>
  130. z.status_id not in(12,13)
  131. <if test="fund_name != null and fund_name!=''">
  132. and fund_name=#{fund_name}
  133. </if>
  134. <if test="status_name != null and status_name !=''">
  135. and status_name=#{status_name}
  136. </if>
  137. <if test="startTime!=null and endTime!=null">
  138. and apply_time between #{startTime} and #{endTime}
  139. </if>
  140. </where>
  141. </select>
  142. <!--///////////////////////////////////////////////////////////////// -->
  143. <!--查询资金划转表 返回查询总条数 指令业务岗和核算业务岗审核通过后核算主管岗才能看见之前的2级审核的列表的信息 -->
  144. <select id="selectCapitalTransferPage3" resultType="int" parameterType="java.util.Map">
  145. <!-- SELECT count(*) from capital_transfer z left join status s on z.status_id = s.status_id -->
  146. select count(*) from capital_transfer z
  147. <where>
  148. z.status_id not in(12,13,14,15)
  149. <if test="fund_name!= null and fund_name!=''">
  150. and fund_name=#{fund_name}
  151. </if>
  152. <if test="status_name!= null and status_name!=''">
  153. and status_name=#{status_name}
  154. </if>
  155. <if test="startTime!=null and endTime!=null">
  156. and apply_time between #{startTime} and #{endTime}
  157. </if>
  158. </where>
  159. </select>
  160. <!--************************************************************************************************ -->
  161. <!--查看 资金划转详情 根据前端给我返回的id 在把那一条数据查出来-->
  162. <select id="selectChaKanZiJinHuaZhuan" parameterType="java.util.Map" resultType="com.fuzamei.entity.CapitalTransfer">
  163. select y.person_name,
  164. sj.fund_name,
  165. y.account_balance,
  166. sj.sum_of_money,
  167. f.attachment_name,
  168. f.url,
  169. y.drawing_account,
  170. sj.apply_time
  171. from capital_transfer sj
  172. left join
  173. t_user y
  174. on
  175. sj.custodian= y.user_id
  176. left join
  177. attachment f
  178. on
  179. sj.basis_of_payment=f.attachment_id
  180. <where>
  181. <if test="fund_id!='' and fund_id!=null">
  182. fund_id=#{fund_id}
  183. </if>
  184. </where>
  185. </select>
  186. <!--************************************************************************************************************* -->
  187. <!-- 点击查看 (划转资金审核记录表) 框框详情记录 -->
  188. <select id="selectCapitalTransferRecord" parameterType="java.util.Map" resultType="com.fuzamei.entity.CapitalTransferCheck">
  189. select
  190. bc.fund_id,
  191. bc.check_department,
  192. bc.check_person,
  193. bc.check_opinion,
  194. bc.check_time,
  195. bc.check_result ,
  196. s.status_name as relation
  197. from
  198. (select
  199. bc.check_department,
  200. bc.check_person,
  201. bc.fund_id,
  202. bc.check_opinion,
  203. bc.check_time,
  204. s.status_name as check_result,
  205. bc.relation
  206. from
  207. capital_transfer_check bc
  208. left join
  209. status s
  210. on
  211. bc.check_result=s.status_id) bc
  212. left join
  213. status s
  214. on
  215. bc.relation=s.status_id
  216. where fund_id=#{fund_id}
  217. order by
  218. bc.check_time desc
  219. <where>
  220. <if test="fund_id!='' and fund_id!=null">
  221. fund_id=#{fund_id}
  222. </if>
  223. </where> -
  224. </select>
  225. <!--//////////////////// -->
  226. <!-- 根据资金划转id查询状态id值 -->
  227. <select id="getStatusIdByCapitalId" resultType="int">
  228. select status_id from capital_transfer where fund_id=#{fund_id}
  229. </select>
  230. <!--===========================================以下=================================================================================== -->
  231. <!-- 管理人 发起 划转资金 插入到划转资金表*******************************///暂没用////////////////////////////////////////////////////// -->
  232. <insert id="insertCapitalTransfer" parameterType="java.util.Map">
  233. insert into
  234. capital_transfer(fund_id,
  235. custodian,
  236. fund_name,
  237. sum_of_money,
  238. basis_of_payment,
  239. apply_time,
  240. handle_time,
  241. status_id)
  242. values(#{fund_id},
  243. #{custodian},
  244. #{fund_name},
  245. #{sum_of_money},
  246. #{basis_of_payment},
  247. #{apply_time},
  248. #{handle_time},
  249. #{status_id})
  250. </insert>
  251. <!--******************************************//**////***///************************************************************************************ -->
  252. <!-- 将划转资金 上传依据到 ————> 的附件信息插入附件表中 (多用此方法) -->
  253. <insert id="insertAttachmentInfo" parameterType="java.util.Map">
  254. insert into
  255. attachment(attachment_id,
  256. attachment_name,
  257. url,
  258. upload_person_id,
  259. create_time)
  260. values(#{attachment_id},
  261. #{attachment_name},
  262. #{url},
  263. #{upload_person_id},
  264. #{create_time})
  265. </insert>
  266. <!--****************************************************************************************** -->
  267. <!-- 当划转资金时 往操作记录表中插入一条数据 (多用此方法)-->
  268. <insert id="insertOperationHistory">
  269. insert into
  270. operation_history(operator_type_id,
  271. operator_account,
  272. operator_role,
  273. operator_person,
  274. operator_time,
  275. hash)
  276. values(#{operator_type_id},
  277. #{operator_account},
  278. #{operator_role},
  279. #{operator_person},
  280. #{operator_time},
  281. #{hash})
  282. </insert>
  283. <!--******************************************************************************************************* -->
  284. <!-- 查询划转资金表 几级审核 审核意见 详情 --><!-- 要排除状态13 状态为: 指令业务岗审核不通过就到不了核算业务岗这里审核 --><!--资金划转点击查看详情 -->
  285. <select id="selectCheckOpinion" parameterType="java.util.Map" resultType="com.fuzamei.entity.CapitalTransfer">
  286. select
  287. y.person_name,
  288. z.fund_name,
  289. y.account_balance,
  290. z.sum_of_money,
  291. f.attachment_name,
  292. f.url,
  293. y.drawing_account,
  294. z.apply_time
  295. from
  296. capital_transfer z left join t_user y
  297. on
  298. z. custodian=y.user_id
  299. left join
  300. attachment f
  301. on z.basis_of_payment=f.attachment_id
  302. left join
  303. status s
  304. on s.status_id=z.status_id
  305. <where>
  306. z.status_id not in (13)
  307. <if test="fund_id != null and fund_id != ''">
  308. and fund_id=#{fund_id}
  309. </if>
  310. </where>
  311. </select>
  312. <!--************************************************************************************************* -->
  313. <!--将审核意见插入到(划转资金审核记录表)里 -->
  314. <insert id="insertCheckTransfer" parameterType="java.util.Map">
  315. insert into capital_transfer_check(fund_id,
  316. check_department,
  317. check_person,
  318. check_opinion,
  319. check_time,
  320. check_result,
  321. relation)
  322. values(#{fund_id},
  323. #{check_department},
  324. #{check_person},
  325. #{check_opinion},
  326. #{check_time},
  327. #{check_result},
  328. #{relation})
  329. </insert>
  330. <!--审核意见 查询审核记录表 (暂没用)-->
  331. <!-- <select id="">
  332. select s.fund_id,
  333. s.check_department,
  334. s.check_person,
  335. s.check_opinion,
  336. s.check_time,
  337. y.status_name as check_result,
  338. zt.status_name as relation
  339. from
  340. capital_transfer_check s
  341. left join
  342. status y on s.check_result=y.status_id
  343. left join
  344. status zt on s.relation=zt.status_id
  345. </select> -->
  346. <!-- 将划转审核结果意见在插入划转资金表的同时,也将审核结果更新到划转资金表中去,根据基金id ->fund_id定位到指定的业务 -->
  347. <update id="updateCapitaltransferStatus" parameterType="java.util.Map">
  348. update
  349. capital_transfer
  350. set
  351. status_id=#{statusId}
  352. where
  353. fund_id=#{fund_id}
  354. </update>
  355. <!--根据user_id 去修改账户余额 -->
  356. <update id="updateTUserAccountBalance"><!--用户表的账户余额 要减掉-->
  357. update t_user set account_balance=#{account_balance} where user_id=#{user_id}
  358. </update>
  359. <!--根据账户表的账户id来修改钱 -->
  360. <update id="updateAccountMoney"><!-- 账户表的账户 (钱)要加起来 -->
  361. update account set money=#{money} where account_id=#{account_id}
  362. </update>
  363. <!-- 查询 根据用户id查询出账户表id值--><!--暂没用 -->
  364. <!-- <select id="queryAccountIdByUserId" resultType="com.fuzamei.entity.UserAccount">
  365. select account_id from user_account where user_id=#{user_id}
  366. </select> -->
  367. <!--查询所有(账户名称) 返给前端 -->
  368. <select id="queryAccountWhereUserId" parameterType="int" resultType="com.fuzamei.entity.AccountInfo">
  369. select account_name from account_info WHERE account_id in
  370. (select account_id from user_account where user_id=#{user_id})
  371. </select>
  372. </mapper>