InvAccountMapper.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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.inv.dao.InvAccountMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.InvAccount">
  7. <id property="accountId" column="account_id" jdbcType="BIGINT"/>
  8. <result property="accountName" column="account_name" jdbcType="VARCHAR"/>
  9. <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
  10. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  11. <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
  12. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  13. <result property="outerFlag" column="outer_flag" jdbcType="CHAR"/>
  14. <result property="businessQuality" column="business_quality" jdbcType="CHAR"/>
  15. <result property="owned" column="owned" jdbcType="VARCHAR"/>
  16. <result property="juridicalPerson" column="juridical_person" jdbcType="VARCHAR"/>
  17. <result property="establishTime" column="establish_time" jdbcType="TIMESTAMP"/>
  18. <result property="biller" column="biller" jdbcType="VARCHAR"/>
  19. <result property="invoicingAmount" column="invoicing_amount" jdbcType="VARCHAR"/>
  20. <result property="invoicingAmountExcess" column="invoicing_amount_excess" jdbcType="VARCHAR"/>
  21. <result property="sumInvoicingAmount" column="sum_invoicing_amount" jdbcType="VARCHAR"/>
  22. <result property="tentativeEstimates" column="tentative_estimates" jdbcType="VARCHAR"/>
  23. <collection property="invAccountCardList" ofType="com.ydtech.modules.inv.model.InvAccountCard"
  24. resultMap="invAccountCardList"/>
  25. </resultMap>
  26. <resultMap id="invAccountCardList" type="com.ydtech.modules.inv.model.InvAccountCard">
  27. <result property="bankCardNum" column="bank_card_num" jdbcType="VARCHAR"/>
  28. <result property="accountId" column="account_id" jdbcType="VARCHAR"/>
  29. <result property="bankName" column="bank_name" jdbcType="VARCHAR"/>
  30. <result property="bank" column="bank" jdbcType="VARCHAR"/>
  31. <result property="bankNum" column="bank_num" jdbcType="VARCHAR"/>
  32. <result property="startCertExpirationDate" column="start_cert_expiration_date" jdbcType="TIMESTAMP"/>
  33. <result property="accountQuality" column="account_quality" jdbcType="CHAR"/>
  34. <result property="pubSingleLines" column="pub_single_lines" jdbcType="VARCHAR"/>
  35. <result property="priSingleLines" column="pri_single_lines" jdbcType="VARCHAR"/>
  36. <result property="pubYearLines" column="pub_year_lines" jdbcType="VARCHAR"/>
  37. <result property="priYearLines" column="pri_year_lines" jdbcType="VARCHAR"/>
  38. <result property="dayStrokeNum" column="day_stroke_num" jdbcType="VARCHAR"/>
  39. <result property="pubDayLines" column="pub_day_lines" jdbcType="VARCHAR"/>
  40. <result property="priDayLines" column="pri_day_lines" jdbcType="VARCHAR"/>
  41. <result property="pubYearExcess" column="pub_year_excess" jdbcType="VARCHAR"/>
  42. <result property="priYearExcess" column="pri_year_excess" jdbcType="VARCHAR"/>
  43. <result property="fiscalProfit" column="fiscal_profit" jdbcType="VARCHAR"/>
  44. <result property="insuranceProfit" column="insurance_profit" jdbcType="VARCHAR"/>
  45. <result property="clearingProfit" column="clearing_profit" jdbcType="VARCHAR"/>
  46. <result property="exteriorProfit" column="exterior_profit" jdbcType="VARCHAR"/>
  47. <result property="parkProfit" column="park_profit" jdbcType="VARCHAR"/>
  48. <result property="tianqinProfit" column="tianqin_profit" jdbcType="VARCHAR"/>
  49. <result property="otherProfit" column="other_profit" jdbcType="VARCHAR"/>
  50. <result property="endCertExpirationDate" column="end_cert_expiration_date" jdbcType="TIMESTAMP"/>
  51. <result property="balance" column="balance" jdbcType="VARCHAR"/>
  52. <result property="dayStrokeNumExcess" column="day_stroke_num_excess" jdbcType="VARCHAR"/>
  53. <result property="pubDayLinesExcess" column="pub_day_lines_excess" jdbcType="VARCHAR"/>
  54. <result property="priDayLinesExcess" column="pri_day_lines_excess" jdbcType="VARCHAR"/>
  55. <result property="spend" column="spend" jdbcType="VARCHAR"/>
  56. </resultMap>
  57. <sql id="Base_Column_List">
  58. a.account_id,
  59. a.account_name,
  60. a.create_by,
  61. a.create_time,
  62. a.update_by,
  63. a.update_time,
  64. a.outer_flag,
  65. a.del_flag,
  66. a.business_quality,
  67. a.owned,
  68. a.juridical_person,
  69. a.establish_time,
  70. a.biller,
  71. a.invoicing_amount,
  72. a.sum_invoicing_amount,
  73. a.tentative_estimates,
  74. ABS(sum(c.invoice_money) - 5000000) as invoicing_amount_excess,
  75. b.bank_card_num,
  76. b.bank_name,
  77. b.bank,
  78. b.bank_num,
  79. b.start_cert_expiration_date,
  80. b.end_cert_expiration_date,
  81. b.account_quality,
  82. b.pub_single_lines,
  83. b.pri_single_lines,
  84. b.pub_year_lines,
  85. b.pri_year_lines,
  86. b.day_stroke_num,
  87. b.pub_day_lines,
  88. b.pri_day_lines,
  89. b.pub_year_excess,
  90. b.pri_year_excess,
  91. b.fiscal_profit,
  92. b.insurance_profit,
  93. b.clearing_profit,
  94. b.exterior_profit,
  95. b.park_profit,
  96. b.tianqin_profit,
  97. b.other_profit,
  98. b.balance,
  99. b.day_stroke_num_excess,
  100. b.pub_day_lines_excess,
  101. b.pri_day_lines_excess,
  102. b.spend
  103. </sql>
  104. <select id="selectAccountsListPage" resultMap="BaseResultMap">
  105. select
  106. <include refid="Base_Column_List"/>
  107. from inv_account a
  108. left join inv_account_card b on a.account_id = b.account_id
  109. left join inv_account_incoice c on a.account_id = c.account_id
  110. <if test="account.invoiceTimeStart!= null">
  111. and c.invoice_time &gt;= #{account.invoiceTimeStart}
  112. </if>
  113. <if test="account.invoiceTimeEnd!= null">
  114. and c.invoice_time &lt;= #{account.invoiceTimeEnd}
  115. </if>
  116. where a.del_flag = '0'
  117. <if test="account.accountId != null and account.accountId != ''">
  118. and a.account_id like concat('%',#{account.accountId},'%')
  119. </if>
  120. <if test="account.accountName!= null and account.accountName!= ''">
  121. and a.account_name like concat('%',#{account.accountName},'%')
  122. </if>
  123. <if test="account.outerFlag!= null and account.outerFlag!= ''">
  124. and a.outer_flag like concat('%',#{account.outerFlag},'%')
  125. </if>
  126. <if test="account.accountQuality!= null and account.accountQuality!= ''">
  127. and b.account_quality like concat('%',#{account.accountQuality},'%')
  128. </if>
  129. <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
  130. and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
  131. </if>
  132. GROUP BY
  133. a.account_id,
  134. b.bank_card_num
  135. </select>
  136. <select id="getSumInvoicingAmount" resultMap="BaseResultMap">
  137. select a.account_id, SUM(b.invoice_money) as sum_invoicing_amount
  138. from inv_account a
  139. left join inv_account_incoice b on a.account_id = b.account_id
  140. left join inv_account_card c on a.account_id = c.account_id
  141. where
  142. a.del_flag = '0'
  143. <if test="account.accountId != null and account.accountId != ''">
  144. and a.account_id like concat('%',#{account.accountId},'%')
  145. </if>
  146. <if test="account.accountName!= null and account.accountName!= ''">
  147. and a.account_name like concat('%',#{account.accountName},'%')
  148. </if>
  149. <if test="account.outerFlag!= null and account.outerFlag!= ''">
  150. and a.outer_flag like concat('%',#{account.outerFlag},'%')
  151. </if>
  152. <if test="account.accountQuality!= null and account.accountQuality!= ''">
  153. and c.account_quality like concat('%',#{account.accountQuality},'%')
  154. </if>
  155. <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
  156. and c.bank_card_num like concat('%',#{account.bankCardNum},'%')
  157. </if>
  158. GROUP BY a.account_id
  159. </select>
  160. <select id="selectAccountsList" resultMap="BaseResultMap">
  161. select
  162. <include refid="Base_Column_List"/>
  163. from inv_account a
  164. left join inv_account_card b on a.account_id = b.account_id
  165. left join inv_account_incoice c on a.account_id = c.account_id
  166. <if test="account.invoiceTimeStart!= null">
  167. and c.invoice_time &gt;= #{account.invoiceTimeStart}
  168. </if>
  169. <if test="account.invoiceTimeEnd!= null">
  170. and c.invoice_time &lt;= #{account.invoiceTimeEnd}
  171. </if>
  172. where a.del_flag = '0'
  173. <if test="account.accountId != null and account.accountId != ''">
  174. and a.account_id like concat('%',#{account.accountId},'%')
  175. </if>
  176. <if test="account.accountName!= null and account.accountName!= ''">
  177. and a.account_name like concat('%',#{account.accountName},'%')
  178. </if>
  179. <if test="account.outerFlag!= null and account.outerFlag!= ''">
  180. and a.outer_flag like concat('%',#{account.outerFlag},'%')
  181. </if>
  182. <if test="account.accountQuality!= null and account.accountQuality!= ''">
  183. and b.account_quality like concat('%',#{account.accountQuality},'%')
  184. </if>
  185. <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
  186. and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
  187. </if>
  188. GROUP BY
  189. a.account_id,
  190. b.bank_card_num
  191. </select>
  192. </mapper>