SysAmountAuditingMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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="com.ydtech.modules.admin.dao.SysAmountAuditingMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">
  7. <id property="id" column="id" jdbcType="INTEGER"/>
  8. <result property="bankNumber" column="bank_number" jdbcType="VARCHAR"/>
  9. <result property="amount" column="amount" jdbcType="DECIMAL"/>
  10. <result property="userId" column="user_id" jdbcType="VARCHAR"/>
  11. <result property="auditingStatus" column="auditing_status" jdbcType="VARCHAR"/>
  12. <result property="amountStatus" column="amount_status" jdbcType="VARCHAR"/>
  13. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  14. </resultMap>
  15. <select id="getByUserId" resultType="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">
  16. select
  17. a. id as "id",
  18. a. bank_number as "bankNumber",
  19. a. amount as "amount",
  20. a. user_id as "userId",
  21. a. auditing_status as "auditingStatus",
  22. a. amount_status as "amountStatus"
  23. from sys_amount_auditing a
  24. <where>
  25. a.auditing_status ='2'
  26. <if test="userId !=null and userId !=''">
  27. and a.user_id =#{userId}
  28. </if>
  29. <if test="amountStatus !=null and amountStatus !=''">
  30. and a.amount_status =#{amountStatus}
  31. </if>
  32. </where>
  33. </select>
  34. <select id="queryPageOrder" resultType="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">
  35. select
  36. a.id as "id",
  37. a.bank_number as "bankNumber",
  38. a.amount as "amount",
  39. a.user_id as "userId",
  40. a.create_time as "createTime",
  41. a.auditing_status as "auditingStatus",
  42. a.amount_status as "amountStatus",
  43. a.auditing_time as "auditingTime",
  44. a.auditing_user_id as "auditingUserId",
  45. b.user_amount as "userAmount",
  46. b.amount as "historyAmount",
  47. b.surplus_amount as "surplusAmount",
  48. su.name as "userName",
  49. su2.name as "auditingUserName",
  50. su.dept_id as "deptId",
  51. sd.name as "deptName",
  52. bc.bank_account as "bankAccount"
  53. from sys_amount_auditing a
  54. left join sys_user_account_history b on a.id = b.auditiing_id
  55. left join sys_user su on su.id =a.user_id
  56. left join sys_dept sd on sd.id =su.dept_id
  57. left join sys_user_bank_card bc on bc.bank_number =a.bank_number
  58. left join sys_user su2 on su2.id = a.auditing_user_id
  59. <where>
  60. <if test="sysAmountAuditingVo.auditingStatus !=null and sysAmountAuditingVo.auditingStatus != ''">
  61. a.auditing_status=#{sysAmountAuditingVo.auditingStatus}
  62. </if>
  63. <if test="sysAmountAuditingVo.amountStatus !=null and sysAmountAuditingVo.amountStatus != ''">
  64. and a.amount_status=#{sysAmountAuditingVo.amountStatus}
  65. </if>
  66. <if test="sysAmountAuditingVo.id !=null and sysAmountAuditingVo.id != ''">
  67. and a.id=#{sysAmountAuditingVo.id}
  68. </if>
  69. <if test="sysAmountAuditingVo.userId !=null and sysAmountAuditingVo.userId != ''">
  70. and a.user_id=#{sysAmountAuditingVo.userId}
  71. </if>
  72. <if test="sysAmountAuditingVo.startTime !=null and sysAmountAuditingVo.startTime != '' and sysAmountAuditingVo.endTime !=null and sysAmountAuditingVo.endTime!= '' ">
  73. and a.create_time BETWEEN #{sysAmountAuditingVo.startTime} AND #{sysAmountAuditingVo.endTime}
  74. </if>
  75. <if test="sysAmountAuditingVo.timeFiltering !=null and sysAmountAuditingVo.timeFiltering != '' ">
  76. AND DATE_FORMAT(a.auditing_time, '%Y-%m-%d') = #{sysAmountAuditingVo.timeFiltering}
  77. </if>
  78. <if test="sysAmountAuditingVo.withdrawalTime !=null and sysAmountAuditingVo.withdrawalTime != '' ">
  79. AND DATE_FORMAT(a.create_time, '%Y-%m-%d') = #{sysAmountAuditingVo.withdrawalTime}
  80. </if>
  81. </where>
  82. </select>
  83. <select id="queryPageOrderNew" resultType="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">
  84. select
  85. a.id as "id",
  86. a.bank_number as "bankNumber",
  87. a.amount as "amount",
  88. a.user_id as "userId",
  89. a.create_time as "createTime",
  90. a.voucher_id as "voucherId",
  91. a.pic_id as "picId",
  92. a.auditing_status as "auditingStatus",
  93. a.amount_status as "amountStatus",
  94. a.auditing_time as "auditingTime",
  95. a.auditing_user_id as "auditingUserId",
  96. b.user_amount as "userAmount",
  97. b.amount as "historyAmount",
  98. b.surplus_amount as "surplusAmount",
  99. su.name as "userName",
  100. su.mobile as "mobile",
  101. su2.name as "auditingUserName",
  102. su.dept_id as "deptId",
  103. sd.name as "deptName",
  104. bc.bank_account as "bankAccount",
  105. bc.bank_address as "bankAddress",
  106. su.leader_name as "leaderName",
  107. su.leader_id as "leaderId"
  108. from sys_amount_auditing a
  109. left join sys_user_account_history b on a.id = b.auditiing_id
  110. left join sys_user su on su.id =a.user_id
  111. left join sys_dept sd on sd.id =su.dept_id
  112. left join sys_user_bank_card bc on bc.bank_number =a.bank_number
  113. left join sys_user su2 on su2.id = a.auditing_user_id
  114. <where>
  115. <if test="auditingStatus !=null and auditingStatus != ''">
  116. a.auditing_status=#{auditingStatus}
  117. </if>
  118. <if test="amountStatus !=null and amountStatus != ''">
  119. and a.amount_status=#{amountStatus}
  120. </if>
  121. <if test="id !=null and id != ''">
  122. and a.id=#{id}
  123. </if>
  124. <if test="mobile !=null and mobile != ''">
  125. and su.mobile=#{mobile}
  126. </if>
  127. <if test="userName !=null and userName != ''">
  128. and su.name=#{userName}
  129. </if>
  130. <if test="userId !=null and userId != ''">
  131. and a.user_id=#{userId}
  132. </if>
  133. <if test="startDate !=null and startDate != '' and endDate !=null and endDate!= '' ">
  134. and DATE_FORMAT( a.create_time, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  135. </if>
  136. <if test="leaderName !=null and leaderName != ''">
  137. and su.leader_name=#{leaderName}
  138. </if>
  139. <if test="leaderId !=null and leaderId != ''">
  140. and su.leader_id=#{leaderId}
  141. </if>
  142. </where>
  143. order by a.create_time desc
  144. </select>
  145. <select id="getProgressIng" resultType="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">
  146. SELECT
  147. a.user_id as "userId",
  148. sum( a.amount ) as "amount",
  149. a.amount_status as "amountStatus"
  150. FROM
  151. sys_amount_auditing a
  152. <where>
  153. <if test="auditingStatus !=null and auditingStatus != ''">
  154. a.auditing_status=#{auditingStatus}
  155. </if>
  156. <if test="amountStatus !=null and amountStatus != ''">
  157. and a.amount_status=#{amountStatus}
  158. </if>
  159. <if test="id !=null and id != ''">
  160. and a.id=#{id}
  161. </if>
  162. <if test="userId !=null and userId != ''">
  163. and a.user_id=#{userId}
  164. </if>
  165. <if test="startDate !=null and startDate != '' and endDate !=null and endDate!= '' ">
  166. and DATE_FORMAT( a.auditing_time, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  167. </if>
  168. </where>
  169. GROUP BY
  170. user_id,
  171. amount_status
  172. </select>
  173. <select id="queryAmountPage" resultType="com.ydtech.modules.admin.model.dto.MyCollectInAdvanceDto">
  174. select
  175. a.id as "id",
  176. a.bank_number as "bankNumber",
  177. a.amount as "ransactionAmount",
  178. a.create_time as "createTime"
  179. from sys_amount_auditing a
  180. left join sys_user_bank_card bc on bc.bank_number =a.bank_number
  181. left join sys_user su2 on su2.id = a.auditing_user_id
  182. <where>
  183. <if test="myIncomeAndExpensesQueryDto.userId !=null and myIncomeAndExpensesQueryDto.userId != ''">
  184. and a.user_id=#{myIncomeAndExpensesQueryDto.userId}
  185. </if>
  186. <if test="myIncomeAndExpensesQueryDto.startDate !=null and myIncomeAndExpensesQueryDto.startDate != '' and myIncomeAndExpensesQueryDto.endDate !=null and myIncomeAndExpensesQueryDto.endDate != '' ">
  187. AND a.create_time BETWEEN #{myIncomeAndExpensesQueryDto.startDate} AND #{myIncomeAndExpensesQueryDto.endDate}
  188. </if>
  189. <if test="myIncomeAndExpensesQueryDto.incomeAndExpensesType !=null and myIncomeAndExpensesQueryDto.incomeAndExpensesType != '' ">
  190. and a.auditing_status = #{myIncomeAndExpensesQueryDto.incomeAndExpensesType}
  191. </if>
  192. </where>
  193. </select>
  194. <select id="findSumAmount" resultType="java.math.BigDecimal">
  195. select
  196. sum(a.amount) as "sumAmount"
  197. from sys_amount_auditing a
  198. <where>
  199. <if test="myIncomeAndExpensesQueryDto.userId !=null and myIncomeAndExpensesQueryDto.userId != ''">
  200. and a.user_id=#{myIncomeAndExpensesQueryDto.userId}
  201. </if>
  202. <if test="myIncomeAndExpensesQueryDto.startDate !=null and myIncomeAndExpensesQueryDto.startDate != '' and myIncomeAndExpensesQueryDto.endDate !=null and myIncomeAndExpensesQueryDto.endDate != '' ">
  203. AND a.create_time BETWEEN #{myIncomeAndExpensesQueryDto.startDate} AND #{myIncomeAndExpensesQueryDto.endDate}
  204. </if>
  205. <if test="myIncomeAndExpensesQueryDto.incomeAndExpensesType !=null and myIncomeAndExpensesQueryDto.incomeAndExpensesType != '' ">
  206. and a.auditing_status = #{myIncomeAndExpensesQueryDto.incomeAndExpensesType}
  207. </if>
  208. </where>
  209. </select>
  210. <select id="findSumAmountByUserId" resultType="java.math.BigDecimal">
  211. select
  212. sum(a.amount) as "sumAmount"
  213. from sys_amount_auditing a
  214. <where>
  215. <if test="userId !=null and userId != ''">
  216. and a.user_id=#{userId}
  217. </if>
  218. </where>
  219. </select>
  220. <select id="querySumAmount" resultType="java.math.BigDecimal">
  221. select
  222. sum(a.amount)
  223. from sys_amount_auditing a
  224. left join sys_user_account_history b on a.id = b.auditiing_id
  225. left join sys_user su on su.id =a.user_id
  226. <where>
  227. <if test="vo.auditingStatus !=null and vo.auditingStatus != ''">
  228. a.auditing_status=#{vo.auditingStatus}
  229. </if>
  230. <if test="vo.amountStatus !=null and vo.amountStatus != ''">
  231. and a.amount_status=#{vo.amountStatus}
  232. </if>
  233. <if test="vo.id !=null and vo.id != ''">
  234. and a.id=#{vo.id}
  235. </if>
  236. <if test="vo.mobile !=null and vo.mobile != ''">
  237. and su.mobile=#{vo.mobile}
  238. </if>
  239. <if test="vo.userName !=null and vo.userName != ''">
  240. and su.name=#{vo.userName}
  241. </if>
  242. <if test="vo.userId !=null and vo.userId != ''">
  243. and a.user_id=#{vo.userId}
  244. </if>
  245. <if test="vo.startTime !=null and vo.startTime != '' and vo.endTime !=null and vo.endTime!= '' ">
  246. and DATE_FORMAT( a.create_time, '%Y-%m-%d') between DATE_FORMAT(#{vo.startTime}, '%Y-%m-%d') and DATE_FORMAT(#{vo.endTime}, '%Y-%m-%d')
  247. </if>
  248. <if test="vo.leaderName !=null and vo.leaderName != ''">
  249. and su.leader_name=#{vo.leaderName}
  250. </if>
  251. <if test="vo.leaderId !=null and vo.leaderId != ''">
  252. and su.leader_id = #{vo.leaderId}
  253. </if>
  254. </where>
  255. </select>
  256. </mapper>