選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

153 行
5.5 KiB

  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.iformall.mapper.TtOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.tt.TtOrder">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
  9. <result column="product_id" jdbcType="BIGINT" property="productId"/>
  10. <result column="type" jdbcType="TINYINT" property="type"/>
  11. <result column="payment_type" jdbcType="INTEGER" property="paymentType"/>
  12. <result column="payment" jdbcType="INTEGER" property="payment"/>
  13. <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/>
  14. <result column="order_status" jdbcType="INTEGER" property="orderStatus"/>
  15. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  16. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  17. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  18. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  19. <result column="product_title" jdbcType="VARCHAR" property="productTitle"/>
  20. <result column="product_pic" jdbcType="VARCHAR" property="productPic"/>
  21. <result column="author" jdbcType="VARCHAR" property="author"/>
  22. <result column="author_pic" jdbcType="VARCHAR" property="authorPic"/>
  23. </resultMap>
  24. <sql id="allColumns">
  25. o.`id`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`,o.`payment_type`,o.`payment`,
  26. o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,
  27. u.`nick_name`,u.`phone`,
  28. c.`title` product_title,c.`coverImg` product_pic,
  29. m.`name` author,m.`imgUrl` author_pic
  30. </sql>
  31. <sql id="dynamicWhereConditions">
  32. where 1 = 1
  33. <if test=" null != id ">
  34. and o.`id` = #{id}
  35. </if>
  36. <if test=" null != tenantId and '' != tenantId">
  37. and o.`tenant_id` = #{tenantId}
  38. </if>
  39. <if test=" null != parentTenantId and '' != parentTenantId">
  40. and o.`parent_tenant_id` = #{parentTenantId}
  41. </if>
  42. <if test=" null != cUserId ">
  43. and o.`c_user_id` = #{cUserId}
  44. </if>
  45. <if test=" null != productId ">
  46. and o.`product_id` = #{productId}
  47. </if>
  48. <if test=" null != type ">
  49. and o.`type` = #{type}
  50. </if>
  51. <if test=" null != paymentType ">
  52. and o.`payment_type` = #{paymentType}
  53. </if>
  54. <if test="startdate != null">
  55. and o.`payment_time` &gt;= #{startdate}
  56. </if>
  57. <if test="enddate != null">
  58. and o.`payment_time` &lt;= #{enddate}
  59. </if>
  60. <if test=" null != orderStatus ">
  61. and o.`order_status` = #{orderStatus}
  62. </if>
  63. <if test=" null != nickName ">
  64. and u.`nick_name` like concat('%', #{nickName},'%')
  65. </if>
  66. <if test=" null != phone ">
  67. and u.`phone` like concat('%', #{phone},'%')
  68. </if>
  69. <if test=" null != productTitle ">
  70. and c.`title` like concat('%', #{productTitle},'%')
  71. </if>
  72. <if test=" null != authorId ">
  73. and c.merchant_id = #{authorId}
  74. </if>
  75. <if test=" null != author ">
  76. and m.`name` like concat('%', #{author},'%')
  77. </if>
  78. <if test=" null != statusS ">
  79. and o.`order_status` in
  80. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  81. #{sItem}
  82. </foreach>
  83. </if>
  84. <if test=" null != ids ">
  85. and o.`id` in
  86. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  87. #{idItem}
  88. </foreach>
  89. </if>
  90. order by o.`update_date` desc
  91. </sql>
  92. <select id="findList" parameterType="com.iformall.domain.po.tt.TtOrder" resultMap="BaseResultMap">
  93. select
  94. <include refid="allColumns"/>
  95. from tt_order o
  96. left join tt_c_user u on o.c_user_id = u.id
  97. left join tt_coupon c on o.product_id = c.id
  98. left join wx_merchant m on c.merchant_id = m.id
  99. <include refid="dynamicWhereConditions"/>
  100. </select>
  101. <select id="findListCount" parameterType="com.iformall.domain.po.tt.TtOrder" resultType="Integer">
  102. select count(1)
  103. from tt_order
  104. where 1 = 1
  105. <if test=" null != tenantId and '' != tenantId">
  106. and `tenant_id` = #{tenantId}
  107. </if>
  108. <if test=" null != parentTenantId and '' != parentTenantId">
  109. and `parent_tenant_id` = #{parentTenantId}
  110. </if>
  111. <if test=" null != cUserId ">
  112. and `c_user_id` = #{cUserId}
  113. </if>
  114. <if test=" null != productId ">
  115. and `product_id` = #{productId}
  116. </if>
  117. <if test=" null != orderStatus ">
  118. and `order_status` = #{orderStatus}
  119. </if>
  120. <if test=" null != statusS ">
  121. and `order_status` in
  122. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  123. #{sItem}
  124. </foreach>
  125. </if>
  126. </select>
  127. </mapper>