InvAccountMapper.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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="endCertExpirationDate" column="end_cert_expiration_date" jdbcType="TIMESTAMP"/>
  44. <result property="balance" column="balance" jdbcType="VARCHAR"/>
  45. <result property="dayStrokeNumExcess" column="day_stroke_num_excess" jdbcType="VARCHAR"/>
  46. <result property="pubDayLinesExcess" column="pub_day_lines_excess" jdbcType="VARCHAR"/>
  47. <result property="priDayLinesExcess" column="pri_day_lines_excess" jdbcType="VARCHAR"/>
  48. <result property="spend" column="spend" jdbcType="VARCHAR"/>
  49. </resultMap>
  50. <sql id="Base_Column_List">
  51. a.account_id,
  52. a.account_name,
  53. a.create_by,
  54. a.create_time,
  55. a.update_by,
  56. a.update_time,
  57. a.outer_flag,
  58. a.del_flag,
  59. a.business_quality,
  60. a.owned,
  61. a.juridical_person,
  62. a.establish_time,
  63. a.biller,
  64. a.invoicing_amount,
  65. a.sum_invoicing_amount,
  66. a.tentative_estimates,
  67. ABS(sum(c.no_has_tax) - 5000000) as invoicing_amount_excess,
  68. b.bank_card_num,
  69. b.bank_name,
  70. b.bank,
  71. b.bank_num,
  72. b.start_cert_expiration_date,
  73. b.end_cert_expiration_date,
  74. b.account_quality,
  75. b.pub_single_lines,
  76. b.pri_single_lines,
  77. b.pub_year_lines,
  78. b.pri_year_lines,
  79. b.day_stroke_num,
  80. b.pub_day_lines,
  81. b.pri_day_lines,
  82. b.pub_year_excess,
  83. b.pri_year_excess,
  84. b.balance,
  85. b.day_stroke_num_excess,
  86. b.pub_day_lines_excess,
  87. b.pri_day_lines_excess,
  88. b.spend
  89. </sql>
  90. <select id="selectAccountsListPage" resultMap="BaseResultMap">
  91. select
  92. <include refid="Base_Column_List"/>
  93. from inv_account a
  94. left join inv_account_card b on a.account_id = b.account_id
  95. left join inv_account_incoice c on a.account_id = c.account_id and c.del_flag = '0'
  96. <if test="account.invoiceTimeStart!= null">
  97. and c.invoice_time &gt;= #{account.invoiceTimeStart}
  98. </if>
  99. <if test="account.invoiceTimeEnd!= null">
  100. and c.invoice_time &lt;= #{account.invoiceTimeEnd}
  101. </if>
  102. where a.del_flag = '0'
  103. <if test="account.accountId != null and account.accountId != ''">
  104. and a.account_id = #{account.accountId}
  105. </if>
  106. <if test="account.accountName!= null and account.accountName!= ''">
  107. and a.account_name like concat('%',#{account.accountName},'%')
  108. </if>
  109. <if test="account.outerFlag!= null and account.outerFlag!= ''">
  110. and a.outer_flag like concat('%',#{account.outerFlag},'%')
  111. </if>
  112. <if test="account.accountQuality!= null and account.accountQuality!= ''">
  113. and b.account_quality like concat('%',#{account.accountQuality},'%')
  114. </if>
  115. <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
  116. and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
  117. </if>
  118. GROUP BY
  119. a.account_id,
  120. b.bank_card_num
  121. </select>
  122. <select id="getSumInvoicingAmount" resultMap="BaseResultMap">
  123. select a.account_id, SUM(b.no_has_tax) as sum_invoicing_amount
  124. from inv_account a
  125. left join inv_account_incoice b on a.account_id = b.account_id and b.del_flag = '0'
  126. where
  127. a.del_flag = '0'
  128. <if test="account.accountId != null and account.accountId != ''">
  129. and a.account_id = #{account.accountId}
  130. </if>
  131. <if test="account.accountName!= null and account.accountName!= ''">
  132. and a.account_name like concat('%',#{account.accountName},'%')
  133. </if>
  134. <if test="account.outerFlag!= null and account.outerFlag!= ''">
  135. and a.outer_flag like concat('%',#{account.outerFlag},'%')
  136. </if>
  137. <if test="account.accountQuality!= null and account.accountQuality!= ''">
  138. and c.account_quality like concat('%',#{account.accountQuality},'%')
  139. </if>
  140. GROUP BY a.account_id
  141. </select>
  142. <select id="selectAccountsList" resultMap="BaseResultMap">
  143. select
  144. <include refid="Base_Column_List"/>
  145. from inv_account a
  146. left join inv_account_card b on a.account_id = b.account_id
  147. left join inv_account_incoice c on a.account_id = c.account_id and c.del_flag = '0'
  148. <if test="account.invoiceTimeStart!= null">
  149. and c.invoice_time &gt;= #{account.invoiceTimeStart}
  150. </if>
  151. <if test="account.invoiceTimeEnd!= null">
  152. and c.invoice_time &lt;= #{account.invoiceTimeEnd}
  153. </if>
  154. where a.del_flag = '0'
  155. <if test="account.accountId != null and account.accountId != ''">
  156. and a.account_id = #{account.accountId}
  157. </if>
  158. <if test="account.accountName!= null and account.accountName!= ''">
  159. and a.account_name like concat('%',#{account.accountName},'%')
  160. </if>
  161. <if test="account.outerFlag!= null and account.outerFlag!= ''">
  162. and a.outer_flag like concat('%',#{account.outerFlag},'%')
  163. </if>
  164. <if test="account.accountQuality!= null and account.accountQuality!= ''">
  165. and b.account_quality like concat('%',#{account.accountQuality},'%')
  166. </if>
  167. <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
  168. and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
  169. </if>
  170. GROUP BY
  171. a.account_id,
  172. b.bank_card_num
  173. </select>
  174. </mapper>