ValuationAccountingMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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,namespace的值习惯上设置成包名+sql映射文件名,这样就能够保证namespace的值是唯一的,例如namespace="me.gacl.mapping.userMapper"就是me.gacl.mapping(包名)+userMapper(userMapper.xml文件去除后缀)
  4. -->
  5. <mapper namespace="com.fuzamei.mapperInterface.ValuationAccountingMapper">
  6. <!-- 分页查询所有数据量,用于分页使用 -->
  7. <select id="findAllInformations" resultType="int">
  8. select
  9. count(*)
  10. from
  11. valuation_accounting
  12. <where>
  13. <if test="fundName!='' and fundName!=null">
  14. fund_name=#{fundName}
  15. </if>
  16. <if test="battleResult!='' and battleResult!=null">
  17. and battle_result=#{battleResult}
  18. </if>
  19. <if test="startTime!=null and endTime!=null">
  20. and update_time between #{startTime} and #{endTime}
  21. </if>
  22. </where>
  23. </select>
  24. <!-- 根据条件查询估值核算的信息 -->
  25. <select id="queryValuationAccountingInformation" resultType="com.fuzamei.entity.ValuationAccount">
  26. select
  27. temp.fund_id,
  28. temp.fund_name,
  29. temp.assets_under_custody,
  30. temp.attachment_name attachment_name_of_custodian,
  31. att.attachment_name attachment_name_of_bank,
  32. temp.url url_of_custodian,
  33. att.url url_of_bank,
  34. temp.update_time,
  35. temp.battle_result
  36. from
  37. (select
  38. va.fund_id,
  39. va.fund_name,
  40. va.assets_under_custody,
  41. att.attachment_name,
  42. va.bank_valuation_id,
  43. va.battle_result,
  44. att.url,
  45. va.update_time
  46. from
  47. valuation_accounting va
  48. left join
  49. attachment att
  50. on
  51. va.custodian_valuation_id=att.attachment_id) temp
  52. left join
  53. attachment att
  54. on
  55. temp.bank_valuation_id = att.attachment_id
  56. <where>
  57. <if test="fundName!='' and fundName!=null">
  58. temp.fund_name=#{fundName}
  59. </if>
  60. <if test="battleResult!='' and battleResult!=null">
  61. and temp.battle_result=#{battleResult}
  62. </if>
  63. <if test="startTime!=null and endTime!=null">
  64. and temp.update_time between #{startTime} and #{endTime}
  65. </if>
  66. </where>
  67. order by
  68. temp.update_time asc
  69. limit
  70. #{startPage},#{rowNum}
  71. </select>
  72. <!-- 管理岗上传管理人估值报表的时候插入的数据,分别插入valuation_accounting和attachment表,但是注意这个时候银行估值报表暂时不进行插入 -->
  73. <insert id="insertInformationIntoTableByAdmin">
  74. insert into
  75. valuation_accounting(fund_id,
  76. fund_name,
  77. assets_under_custody,
  78. custodian_valuation_id,
  79. update_time,
  80. battle_result)
  81. values(#{fundId},
  82. #{fundName},
  83. #{assets},
  84. #{attachmentId},
  85. #{updateTime},
  86. #{battleResult})
  87. </insert>
  88. <!-- 将上文的文件信息插入到附件表中去 -->
  89. <insert id="insertInformationToAttachment">
  90. insert into
  91. attachment(attachment_id,
  92. attachment_name,
  93. url,
  94. upload_person_id,
  95. create_time)
  96. values(#{attachmentId},
  97. #{attachmentName},
  98. #{url},
  99. #{userId},
  100. #{addTime})
  101. </insert>
  102. <!-- 银行上传一份估值核算文件后更新之前管理员上传文件插入的那条信息 -->
  103. <update id="updateInformationByBank">
  104. update
  105. valuation_accounting
  106. set
  107. bank_valuation_id=#{attachmentId},
  108. update_time=#{updateTime},
  109. battle_result=#{battleResult}
  110. where
  111. fund_id=#{fundId}
  112. </update>
  113. <!-- 省分行上传估值核算文件,在操作记录中要插入这个数据 -->
  114. <insert id="insertOperationHistoryInformationToDao">
  115. insert into
  116. operation_history(operator_type_id,
  117. operator_account,
  118. operator_role,
  119. operator_person,
  120. operator_time,
  121. hash)
  122. values(#{operatorTypeId},
  123. #{operatorAccount},
  124. #{operatorRole},
  125. #{operatorPerson},
  126. #{operatorTime},
  127. #{hash})
  128. </insert>
  129. <!-- 返回给下载提示框的数据 -->
  130. <select id="checkoutDownloadInformation" resultType="com.fuzamei.entity.ValuationAccount">
  131. select
  132. temp.fund_id,
  133. temp.fund_name,
  134. temp.assets_under_custody,
  135. temp.attachment_name attachment_name_of_custodian,
  136. att.attachment_name attachment_name_of_bank,
  137. temp.url url_of_custodian,
  138. att.url url_of_bank,
  139. from
  140. (select
  141. va.fund_id,
  142. va.fund_name,
  143. va.assets_under_custody,
  144. att.attachment_name,
  145. va.bank_valuation_id,
  146. va.battle_result,
  147. att.url,
  148. va.update_time
  149. from
  150. valuation_accounting va
  151. left join
  152. attachment att
  153. on
  154. va.custodian_valuation_id=att.attachment_id
  155. where
  156. va.fund_id=#{fundId}) temp
  157. left join
  158. attachment att
  159. on
  160. temp.bank_valuation_id = att.attachment_id
  161. order by
  162. temp.update_time asc
  163. </select>
  164. <!-- 对是否有重复的fundId进行查询并返回重复结果 -->
  165. <select id="queryIfHasTheSameFundId" resultType="int">
  166. select count(*) from valuation_accounting where fund_id=#{fundId}
  167. </select>
  168. <!-- 对是否有重复的fundId进行查询并返回重复结果 -->
  169. <select id="queryIfHasTheSameFundName" resultType="int">
  170. select count(*) from valuation_accounting where fund_name=#{fundName}
  171. </select>
  172. <!-- 对是否有存在基金数据进行查询并返回查询到的结果 -->
  173. <select id="checkIfFundExists" resultType="com.fuzamei.entity.ValuationAccount">
  174. select
  175. temp.fund_id,
  176. temp.fund_name,
  177. temp.assets_under_custody,
  178. temp.custodian_valuation_id attachment_id_of_custodian,
  179. temp.bank_valuation_id attachment_id_of_bank,
  180. temp.attachment_name attachment_name_of_custodian,
  181. att.attachment_name attachment_name_of_bank,
  182. temp.url url_of_custodian,
  183. att.url url_of_bank,
  184. temp.update_time,
  185. temp.battle_result
  186. from
  187. (select
  188. va.fund_id,
  189. va.fund_name,
  190. va.assets_under_custody,
  191. att.attachment_name,
  192. va.custodian_valuation_id,
  193. va.bank_valuation_id,
  194. va.battle_result,
  195. att.url,
  196. va.update_time
  197. from
  198. valuation_accounting va
  199. left join
  200. attachment att
  201. on
  202. va.custodian_valuation_id=att.attachment_id) temp
  203. left join
  204. attachment att
  205. on
  206. temp.bank_valuation_id = att.attachment_id
  207. where
  208. temp.fund_name=#{fundName} and temp.fund_id=#{fundId}
  209. </select>
  210. <!-- 管理员再次上传估值文件时修改总表中的信息 -->
  211. <update id="updateInformationByAdmin">
  212. update
  213. valuation_accounting
  214. set
  215. update_time=#{updateTime},
  216. battle_result=#{battleResult}
  217. where
  218. fund_id=#{fundId}
  219. </update>
  220. <!-- 管理人修改附件信息 -->
  221. <update id="updateAttachmentInformationByAdmin">
  222. update
  223. attachment
  224. set
  225. attachment_name=#{attachmentName},
  226. url=#{url},
  227. upload_person_id=#{userId},
  228. create_time=#{addTime}
  229. where
  230. attachment_id=#{attachmentId}
  231. </update>
  232. <!-- 银行修改附件信息 -->
  233. <update id="updateAttachmentInformationByBank">
  234. update
  235. attachment
  236. set
  237. attachment_name=#{attachmentName},
  238. url=#{url},
  239. upload_person_id=#{userId},
  240. create_time=#{addTime}
  241. where
  242. attachment_id=#{attachmentId}
  243. </update>
  244. </mapper>