AccountServiceDaoImplMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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="acctType !=null and acctType != ''">
  98. and t.acct_type= #{acctType}
  99. </if>
  100. <if test="objId !=null and objId != ''">
  101. and t.obj_id= #{objId}
  102. </if>
  103. <if test="acctId !=null and acctId != ''">
  104. and t.acct_id= #{acctId}
  105. </if>
  106. <if test="statusCd !=null and statusCd != ''">
  107. and t.status_cd= #{statusCd}
  108. </if>
  109. <if test="acctName !=null and acctName != ''">
  110. and t.acct_name= #{acctName}
  111. </if>
  112. <if test="bId !=null and bId != ''">
  113. and t.b_id= #{bId}
  114. </if>
  115. <if test="objType !=null and objType != ''">
  116. and t.obj_type= #{objType}
  117. </if>
  118. <if test="partId !=null and partId != ''">
  119. and t.obj_type= #{partId}
  120. </if>
  121. order by t.create_time desc
  122. <if test="page != -1 and page != null ">
  123. limit #{page}, #{row}
  124. </if>
  125. </select>
  126. <!-- 修改账户信息 add by wuxw 2018-07-03 -->
  127. <update id="updateAccountInfoInstance" parameterType="Map">
  128. update account t set t.status_cd = #{statusCd}
  129. <if test="newBId != null and newBId != ''">
  130. ,t.b_id = #{newBId}
  131. </if>
  132. <if test="amount !=null and amount != ''">
  133. , t.amount= #{amount}
  134. </if>
  135. <if test="acctType !=null and acctType != ''">
  136. , t.acct_type= #{acctType}
  137. </if>
  138. <if test="objId !=null and objId != ''">
  139. , t.obj_id= #{objId}
  140. </if>
  141. <if test="acctName !=null and acctName != ''">
  142. , t.acct_name= #{acctName}
  143. </if>
  144. <if test="objType !=null and objType != ''">
  145. , t.obj_type= #{objType}
  146. </if>
  147. <if test="partId !=null and partId != ''">
  148. , t.obj_type= #{partId}
  149. </if>
  150. where 1=1
  151. <if test="acctId !=null and acctId != ''">
  152. and t.acct_id= #{acctId}
  153. </if>
  154. <if test="bId !=null and bId != ''">
  155. and t.b_id= #{bId}
  156. </if>
  157. </update>
  158. <!-- 查询账户数量 add by wuxw 2018-07-03 -->
  159. <select id="queryAccountsCount" parameterType="Map" resultType="Map">
  160. select count(1) count
  161. from account t
  162. where 1 =1
  163. <if test="amount !=null and amount != ''">
  164. and t.amount= #{amount}
  165. </if>
  166. <if test="acctType !=null and acctType != ''">
  167. and t.acct_type= #{acctType}
  168. </if>
  169. <if test="objId !=null and objId != ''">
  170. and t.obj_id= #{objId}
  171. </if>
  172. <if test="acctId !=null and acctId != ''">
  173. and t.acct_id= #{acctId}
  174. </if>
  175. <if test="statusCd !=null and statusCd != ''">
  176. and t.status_cd= #{statusCd}
  177. </if>
  178. <if test="acctName !=null and acctName != ''">
  179. and t.acct_name= #{acctName}
  180. </if>
  181. <if test="bId !=null and bId != ''">
  182. and t.b_id= #{bId}
  183. </if>
  184. <if test="objType !=null and objType != ''">
  185. and t.obj_type= #{objType}
  186. </if>
  187. <if test="partId !=null and partId != ''">
  188. and t.obj_type= #{partId}
  189. </if>
  190. </select>
  191. <!-- 修改账户信息 add by wuxw 2018-07-03 -->
  192. <update id="updateAccount" parameterType="Map">
  193. update account t
  194. <set>
  195. <if test="amount !=null and amount != ''">
  196. t.amount= #{amount},
  197. </if>
  198. <if test="acctType !=null and acctType != ''">
  199. t.acct_type= #{acctType},
  200. </if>
  201. <if test="acctName !=null and acctName != ''">
  202. t.acct_name= #{acctName},
  203. </if>
  204. </set>
  205. where 1=1
  206. <if test="acctId !=null and acctId != ''">
  207. and t.acct_id= #{acctId}
  208. </if>
  209. <if test="objId !=null and objId != ''">
  210. and t.obj_id= #{objId},
  211. </if>
  212. </update>
  213. </mapper>