TenantAlbumPurchaseMapper.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.yonge.cooleshow.biz.dal.mapper.TenantAlbumPurchaseMapper">
  4. <!-- 表字段 -->
  5. <sql id="baseColumns">
  6. t.id_ AS id
  7. , t.tenant_id_ AS tenantId
  8. , t.tenant_album_id_ AS tenantAlbumId
  9. , t.purchase_time_ AS purchaseTime
  10. , t.order_no_ AS orderNo
  11. , t.purchase_quantity_ AS purchaseQuantity
  12. , t.purchase_cycle_ AS purchaseCycle
  13. , t.active_quantity_ AS activeQuantity
  14. , t.purchase_price_ AS purchasePrice
  15. , t.purchase_status_ AS purchaseStatus
  16. , t.update_time_ AS updateTime
  17. , t.create_time_ AS createTime
  18. </sql>
  19. <select id="selectPage"
  20. resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumPurchaseWrapper$TenantAlbumPurchase">
  21. SELECT
  22. <include refid="baseColumns"/>,ta.name_ as tenantAlbumName,ta.cover_img_ as tenantAlbumImg
  23. FROM tenant_album_purchase t
  24. LEFT JOIN tenant_album ta on t.tenant_album_id_ = ta.id_
  25. left join user_order t2 on t2.order_no_ = t.order_no_
  26. <where>
  27. <if test="param.tenantId != null">
  28. AND t.tenant_id_ = #{param.tenantId}
  29. </if>
  30. <if test="param.purchaseStatus != null and param.purchaseStatus.trim() != ''">
  31. <if test="param.purchaseStatus == 'WAIT_PAY'">
  32. AND t2.status_ in ( 'WAIT_PAY','PAYING')
  33. </if>
  34. <if test="param.purchaseStatus == 'PAID'">
  35. AND t2.status_ in ( 'PAID')
  36. </if>
  37. <if test="param.purchaseStatus == 'CLOSE'">
  38. AND t2.status_ in ( 'CLOSE','FAIL')
  39. </if>
  40. </if>
  41. </where>
  42. <choose>
  43. <when test="param.orderBy != null and param.orderBy.trim() != ''">
  44. order by #{param.orderBy}
  45. </when>
  46. <otherwise>
  47. order by t.id_ desc
  48. </otherwise>
  49. </choose>
  50. </select>
  51. </mapper>