AccountServiceDaoImplMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="accountServiceDaoImpl">
  6. <!-- 保存账户信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessAccountInfo" parameterType="Map">
  8. insert into business_account(
  9. amount,operate,acct_type,obj_id,acct_id,acct_name,b_id,obj_type,part_id
  10. ) values (
  11. #{amount},#{operate},#{acctType},#{objId},#{acctId},#{acctName},#{bId},#{objType},#{partId}
  12. )
  13. </insert>
  14. <insert id="saveAccount" parameterType="Map">
  15. insert into account(
  16. amount,acct_type,obj_id,acct_id,acct_name,b_id,obj_type,part_id
  17. ) values (
  18. #{amount},#{acctType},#{objId},#{acctId},#{acctName},'-1',#{objType},#{partId}
  19. )
  20. </insert>
  21. <!-- 查询账户信息(Business) add by wuxw 2018-07-03 -->
  22. <select id="getBusinessAccountInfo" parameterType="Map" resultType="Map">
  23. select t.amount,t.operate,t.acct_type,t.acct_type acctType,t.obj_id,t.obj_id objId,t.acct_id,t.acct_id
  24. acctId,t.acct_name,t.acct_name acctName,t.b_id,t.b_id bId,t.obj_type,t.obj_type objType,t.part_id,t.part_id partId
  25. from business_account t
  26. where 1 =1
  27. <if test="amount !=null and amount != ''">
  28. and t.amount= #{amount}
  29. </if>
  30. <if test="operate !=null and operate != ''">
  31. and t.operate= #{operate}
  32. </if>
  33. <if test="acctType !=null and acctType != ''">
  34. and t.acct_type= #{acctType}
  35. </if>
  36. <if test="objId !=null and objId != ''">
  37. and t.obj_id= #{objId}
  38. </if>
  39. <if test="acctId !=null and acctId != ''">
  40. and t.acct_id= #{acctId}
  41. </if>
  42. <if test="acctName !=null and acctName != ''">
  43. and t.acct_name= #{acctName}
  44. </if>
  45. <if test="bId !=null and bId != ''">
  46. and t.b_id= #{bId}
  47. </if>
  48. <if test="objType !=null and objType != ''">
  49. and t.obj_type= #{objType}
  50. </if>
  51. <if test="partId !=null and partId != ''">
  52. and t.obj_type= #{partId}
  53. </if>
  54. </select>
  55. <!-- 保存账户信息至 instance表中 add by wuxw 2018-07-03 -->
  56. <insert id="saveAccountInfoInstance" parameterType="Map">
  57. insert into account(
  58. amount,acct_type,obj_id,acct_id,status_cd,acct_name,b_id,obj_type,part_id
  59. ) select t.amount,t.acct_type,t.obj_id,t.acct_id,'0',t.acct_name,t.b_id,t.obj_type,t.part_id
  60. from business_account t where
  61. 1=1
  62. <if test="amount !=null and amount != ''">
  63. and t.amount= #{amount}
  64. </if>
  65. and t.operate= 'ADD'
  66. <if test="acctType !=null and acctType != ''">
  67. and t.acct_type= #{acctType}
  68. </if>
  69. <if test="objId !=null and objId != ''">
  70. and t.obj_id= #{objId}
  71. </if>
  72. <if test="acctId !=null and acctId != ''">
  73. and t.acct_id= #{acctId}
  74. </if>
  75. <if test="acctName !=null and acctName != ''">
  76. and t.acct_name= #{acctName}
  77. </if>
  78. <if test="bId !=null and bId != ''">
  79. and t.b_id= #{bId}
  80. </if>
  81. <if test="objType !=null and objType != ''">
  82. and t.obj_type= #{objType}
  83. </if>
  84. </insert>
  85. <!-- 查询账户信息 add by wuxw 2018-07-03 -->
  86. <select id="getAccountInfo" parameterType="Map" resultType="Map">
  87. select t.amount,t.acct_type,t.acct_type acctType,t.obj_id,t.obj_id objId,t.acct_id,t.acct_id
  88. acctId,t.status_cd,t.status_cd statusCd,t.acct_name,t.acct_name acctName,t.b_id,t.b_id bId,t.obj_type,t.obj_type
  89. objType,t.create_time createTime,td.`name` acctTypeName,t.part_id,t.part_id partId
  90. from account t
  91. LEFT JOIN t_dict td on t.acct_type = td.status_cd and td.table_name = 'account' and td.table_columns =
  92. 'acct_type'
  93. where 1 =1
  94. <if test="amount !=null and amount != ''">
  95. and t.amount= #{amount}
  96. </if>
  97. <if test="hasMoney !=null and hasMoney != ''">
  98. and t.amount > 0
  99. </if>
  100. <if test="acctType !=null and acctType != ''">
  101. and t.acct_type= #{acctType}
  102. </if>
  103. <if test="objId !=null and objId != ''">
  104. and t.obj_id= #{objId}
  105. </if>
  106. <if test="objIds !=null ">
  107. and t.obj_id in
  108. <foreach collection="objIds" item="item" open="(" close=")" separator=",">
  109. #{item}
  110. </foreach>
  111. </if>
  112. <if test="acctIds !=null ">
  113. and t.acct_id in
  114. <foreach collection="acctIds" item="item" open="(" close=")" separator=",">
  115. #{item}
  116. </foreach>
  117. </if>
  118. <if test="acctId !=null and acctId != ''">
  119. and t.acct_id= #{acctId}
  120. </if>
  121. <if test="statusCd !=null and statusCd != ''">
  122. and t.status_cd= #{statusCd}
  123. </if>
  124. <if test="acctName !=null and acctName != ''">
  125. and t.acct_name= #{acctName}
  126. </if>
  127. <if test="bId !=null and bId != ''">
  128. and t.b_id= #{bId}
  129. </if>
  130. <if test="objType !=null and objType != ''">
  131. and t.obj_type= #{objType}
  132. </if>
  133. <if test="partId !=null and partId != ''">
  134. and t.part_id= #{partId}
  135. </if>
  136. order by t.create_time desc
  137. <if test="page != -1 and page != null ">
  138. limit #{page}, #{row}
  139. </if>
  140. </select>
  141. <!-- 修改账户信息 add by wuxw 2018-07-03 -->
  142. <update id="updateAccountInfoInstance" parameterType="Map">
  143. update account t set t.status_cd = #{statusCd}
  144. <if test="newBId != null and newBId != ''">
  145. ,t.b_id = #{newBId}
  146. </if>
  147. <if test="amount !=null and amount != ''">
  148. , t.amount= #{amount}
  149. </if>
  150. <if test="acctType !=null and acctType != ''">
  151. , t.acct_type= #{acctType}
  152. </if>
  153. <if test="objId !=null and objId != ''">
  154. , t.obj_id= #{objId}
  155. </if>
  156. <if test="acctName !=null and acctName != ''">
  157. , t.acct_name= #{acctName}
  158. </if>
  159. <if test="objType !=null and objType != ''">
  160. , t.obj_type= #{objType}
  161. </if>
  162. <if test="partId !=null and partId != ''">
  163. , t.obj_type= #{partId}
  164. </if>
  165. where 1=1
  166. <if test="acctId !=null and acctId != ''">
  167. and t.acct_id= #{acctId}
  168. </if>
  169. <if test="bId !=null and bId != ''">
  170. and t.b_id= #{bId}
  171. </if>
  172. </update>
  173. <!-- 查询账户数量 add by wuxw 2018-07-03 -->
  174. <select id="queryAccountsCount" parameterType="Map" resultType="Map">
  175. select count(1) count
  176. from account t
  177. where 1 =1
  178. <if test="amount !=null and amount != ''">
  179. and t.amount= #{amount}
  180. </if>
  181. <if test="hasMoney !=null and hasMoney != ''">
  182. and t.amount > 0
  183. </if>
  184. <if test="acctType !=null and acctType != ''">
  185. and t.acct_type= #{acctType}
  186. </if>
  187. <if test="objId !=null and objId != ''">
  188. and t.obj_id= #{objId}
  189. </if>
  190. <if test="acctIds !=null ">
  191. and t.acct_id in
  192. <foreach collection="acctIds" item="item" open="(" close=")" separator=",">
  193. #{item}
  194. </foreach>
  195. </if>
  196. <if test="acctId !=null and acctId != ''">
  197. and t.acct_id= #{acctId}
  198. </if>
  199. <if test="statusCd !=null and statusCd != ''">
  200. and t.status_cd= #{statusCd}
  201. </if>
  202. <if test="acctName !=null and acctName != ''">
  203. and t.acct_name= #{acctName}
  204. </if>
  205. <if test="bId !=null and bId != ''">
  206. and t.b_id= #{bId}
  207. </if>
  208. <if test="objType !=null and objType != ''">
  209. and t.obj_type= #{objType}
  210. </if>
  211. <if test="partId !=null and partId != ''">
  212. and t.part_id= #{partId}
  213. </if>
  214. </select>
  215. <!-- 修改账户信息 add by wuxw 2018-07-03 -->
  216. <update id="updateAccount" parameterType="Map">
  217. update account t
  218. <set>
  219. <if test="amount !=null and amount != ''">
  220. t.amount= #{amount},
  221. </if>
  222. <if test="acctType !=null and acctType != ''">
  223. t.acct_type= #{acctType},
  224. </if>
  225. <if test="acctName !=null and acctName != ''">
  226. t.acct_name= #{acctName},
  227. </if>
  228. </set>
  229. where 1=1
  230. <if test="acctId !=null and acctId != ''">
  231. and t.acct_id= #{acctId}
  232. </if>
  233. <if test="objId !=null and objId != ''">
  234. and t.obj_id = #{objId}
  235. </if>
  236. </update>
  237. </mapper>