WalletPrepaidMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!-- 预付清单(wallet_prepaid) -->
  4. <mapper namespace="com.sckw.payment.mapper.WalletPrepaidMapper">
  5. <!-- 字段映射 -->
  6. <resultMap id="walletPrepaidMap" type="com.sckw.payment.entity.WalletPrepaid">
  7. <id column="id" property="id" />
  8. <result column="pro_ent_id" property="proEntId" />
  9. <result column="sup_ent_id" property="supEntId" />
  10. <result column="pre_balance" property="preBalance" />
  11. <result column="trading_amount" property="tradingAmount" />
  12. <result column="status" property="status" />
  13. <result column="remark" property="remark" />
  14. <result column="del_flag" property="delFlag" />
  15. <result column="create_by" property="createBy" />
  16. <result column="create_time" property="createTime" />
  17. <result column="update_by" property="updateBy" />
  18. <result column="update_time" property="updateTime" />
  19. </resultMap>
  20. <!-- 表所有字段 -->
  21. <sql id="allColumns">
  22. wp.id, wp.pro_ent_id, wp.sup_ent_id, wp.pre_balance, wp.trading_amount, wp.status, wp.remark, wp.del_flag,
  23. wp.create_by, wp.create_time, wp.update_by, wp.update_time
  24. </sql>
  25. <!-- 分页查询待履约/预付清单列表 -->
  26. <select id="selectWalletPrepaidList" resultMap="walletPrepaidMap">
  27. SELECT
  28. <include refid="allColumns" />
  29. FROM wallet_prepaid wp WHERE wp.DEL_FLAG = '0'
  30. <choose>
  31. <when test="entType == 1">
  32. AND wp.sup_ent_id = #{curEntId}
  33. <if test="tradeEntId != null">
  34. AND wp.pro_ent_id = #{tradeEntId}
  35. </if>
  36. </when>
  37. <when test="entType == 2">
  38. AND wp.pro_ent_id = #{curEntId}
  39. <if test="tradeEntId != null">
  40. AND wp.sup_ent_id = #{tradeEntId}
  41. </if>
  42. </when>
  43. </choose>
  44. <if test="balanceMin != null">
  45. AND wp.pre_balance &gt;= #{balanceMin}
  46. </if>
  47. <if test="balanceMax != null">
  48. AND wp.pre_balance &lt;= #{balanceMax}
  49. </if>
  50. order by update_time Desc
  51. </select>
  52. <!-- 分页查询待履约/预付余额汇总 -->
  53. <select id="selectWalletPrepaidSummary" resultType="com.sckw.payment.pojo.vo.res.WalletPrepaidSummary">
  54. SELECT sum(wp.pre_balance) as balanceTotal, sum(wp.trading_amount) as tradingAmountTotal
  55. FROM wallet_prepaid wp WHERE wp.DEL_FLAG = '0'
  56. <choose>
  57. <when test="entType == 1">
  58. AND wp.sup_ent_id = #{curEntId}
  59. </when>
  60. <when test="entType == 2">
  61. AND wp.pro_ent_id = #{curEntId}
  62. </when>
  63. </choose>
  64. order by update_time Desc
  65. </select>
  66. <select id="selectByProEntIdAndSupEntId" resultMap="walletPrepaidMap">
  67. SELECT
  68. <include refid="allColumns" />
  69. FROM wallet_prepaid wp WHERE wp.pro_ent_id = #{proEntId} AND wp.sup_ent_id = #{supEntId} and wp.del_flag = 0
  70. </select>
  71. <!-- BI大屏查询所有供应商待履约金额汇总 -->
  72. <select id="selectAllSupplierPrepaidSummary" resultType="java.math.BigDecimal">
  73. SELECT COALESCE(SUM(wp.pre_balance), 0)
  74. FROM wallet_prepaid wp
  75. WHERE wp.DEL_FLAG = '0'
  76. </select>
  77. <!-- 根据主键ID列表查询预付清单列表 -->
  78. <select id="selectWalletPrepaidByIds" resultMap="walletPrepaidMap">
  79. SELECT
  80. <include refid="allColumns" />
  81. FROM wallet_prepaid wp WHERE wp.id IN
  82. <foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
  83. #{id}
  84. </foreach>
  85. </select>
  86. </mapper>