AccountServiceDaoImplMapper.xml 11 KB

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