OrderFundMapper.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. <mapper namespace="com.dayou.mapper.OrderFundMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.OrderFund">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="business_type" property="businessType" />
  11. <result column="business_id" property="businessId" />
  12. <result column="should_amount" property="shouldAmount" />
  13. <result column="real_amount" property="realAmount" />
  14. <result column="remark" property="remark" />
  15. </resultMap>
  16. <!-- 通用查询结果列 -->
  17. <sql id="Base_Column_List">
  18. id,
  19. deleted,
  20. created,
  21. modified,
  22. business_type, business_id, should_amount, real_amount, remark
  23. </sql>
  24. <update id="updateRealAmount">
  25. update order_fund set real_amount = (ifnull(real_amount,0) + #{thisTimeAmount}) where id = #{id}
  26. </update>
  27. <update id="updateRealAmountByOrderId">
  28. update order_fund set real_amount = (ifnull(real_amount,0) + #{thisTimeAmount}) where order_id = #{orderId} and deleted = 0
  29. </update>
  30. <select id="residueNotAllotAmount" parameterType="java.lang.Long" resultType="java.math.BigDecimal">
  31. SELECT ( of.real_amount-( SELECT ifnull( sum( real_amount ), 0 ) AS ca FROM production_fund WHERE deleted = 0 AND order_fund_id = #{orderFundId} )
  32. ) AS notClaimAmount
  33. FROM
  34. order_fund of
  35. WHERE
  36. of.deleted = 0
  37. </select>
  38. </mapper>