OrderInfoMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.miaxis.order.mapper.OrderInfoMapper">
  6. <resultMap type="OrderInfo" id="OrderInfoResult">
  7. <result property="id" column="id" />
  8. <result property="goodsName" column="goods_name" />
  9. <result property="userId" column="user_id" />
  10. <result property="userName" column="user_name" />
  11. <result property="logincode" column="logincode" />
  12. <result property="outTradeNo" column="out_trade_no" />
  13. <result property="outRefundNo" column="out_refund_no" />
  14. <result property="tradeType" column="trade_type" />
  15. <result property="successTime" column="success_time" />
  16. <result property="payType" column="pay_type" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateTime" column="update_time" />
  19. <result property="isShare" column="is_share" />
  20. <result property="dqbh" column="dqbh" />
  21. <result property="dqmc" column="dqmc" />
  22. <result property="school" column="school" />
  23. <result property="schoolName" column="school_name" />
  24. <result property="schoolCommission" column="school_commission" />
  25. <result property="phoneType" column="phone_type" />
  26. <result property="refundReason" column="refund_reason" />
  27. </resultMap>
  28. <sql id="selectOrderInfoVo">
  29. select * from order_info
  30. </sql>
  31. <select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
  32. <include refid="selectOrderInfoVo"/>
  33. <where>
  34. <if test="isShare != null"> and is_share = #{isShare }</if>
  35. <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
  36. <if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
  37. <if test="userId != null "> and user_id = #{userId}</if>
  38. <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
  39. <if test="logincode != null and logincode != ''"> and logincode = #{logincode} </if>
  40. <if test="outTradeNo != null and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
  41. <if test="outRefundNo != null and outRefundNo != ''"> and out_refund_no = #{outRefundNo}</if>
  42. <if test="tradeType != null and tradeType != ''"> and trade_type = #{tradeType}</if>
  43. <if test="successTime != null "> and success_time = #{successTime}</if>
  44. <if test="payType != null "> and pay_type = #{payType}</if>
  45. </where>
  46. order by success_time desc
  47. </select>
  48. <select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.order.domain.OrderInfo">
  49. select * from order_info where out_trade_no =#{outTradeNo}
  50. </select>
  51. <select id="selectSchoolOrderInfoList" resultType="com.miaxis.order.vo.QuerySchoolOrderListVo">
  52. select
  53. school,
  54. school_name,
  55. sum(school_commission) as school_commission,
  56. sum(total) as orderTotal
  57. from order_info
  58. <where>
  59. <if test="isShare != null">
  60. and is_share = #{isShare }
  61. </if>
  62. <if test="tradeType != null">
  63. and trade_type = #{tradeType }
  64. </if>
  65. <if test="dqbh != null and dqbh != ''">
  66. and dqbh = #{dqbh}
  67. </if>
  68. <if test="schoolName != null and schoolName != ''">
  69. and school_name like concat('%', #{schoolName}, '%')
  70. </if>
  71. <if test="startTime != null">
  72. and DATE_FORMAT(create_time,'%Y%m%d')<![CDATA[ >= ]]> #{startTime}
  73. </if>
  74. <if test="endTime != null">
  75. and DATE_FORMAT(create_time,'%Y%m%d') <![CDATA[ < ]]> #{endTime}
  76. </if>
  77. </where>
  78. group by school,school_name
  79. </select>
  80. <select id="getTotalMoney" resultType="string">
  81. select
  82. sum(total) as orderTotal
  83. from order_info
  84. <where>
  85. <if test="isShare != null">
  86. and is_share = #{isShare }
  87. </if>
  88. <if test="tradeType != null">
  89. and trade_type = #{tradeType }
  90. </if>
  91. <if test="dqbh != null and dqbh != ''">
  92. and dqbh = #{dqbh}
  93. </if>
  94. <if test="schoolName != null and schoolName != ''">
  95. and school_name like concat('%', #{schoolName}, '%')
  96. </if>
  97. <if test="startTime != null">
  98. and DATE_FORMAT(create_time,'%Y%m%d')<![CDATA[ >= ]]> #{startTime}
  99. </if>
  100. <if test="endTime != null">
  101. and DATE_FORMAT(create_time,'%Y%m%d') <![CDATA[ < ]]> #{endTime}
  102. </if>
  103. </where>
  104. </select>
  105. <select id="selectSchoolOrderDetailed" resultType="com.miaxis.order.domain.OrderInfo">
  106. select * from order_info
  107. <where>
  108. <if test="isShare != null">
  109. and is_share = #{isShare }
  110. </if>
  111. <if test="tradeType != null">
  112. and trade_type = #{tradeType }
  113. </if>
  114. <if test="schoolName != null and schoolName != ''">
  115. and school_name like concat('%', #{schoolName}, '%')
  116. </if>
  117. <if test="startTime != null">
  118. and DATE_FORMAT(create_time,'%Y%m%d')<![CDATA[ >= ]]> #{startTime}
  119. </if>
  120. <if test="endTime != null">
  121. and DATE_FORMAT(create_time,'%Y%m%d') <![CDATA[ < ]]> #{endTime}
  122. </if>
  123. </where>
  124. order by success_time desc
  125. </select>
  126. <select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.order.domain.OrderInfo">
  127. select * from order_info where out_trade_no =#{outTradeNo}
  128. </select>
  129. <select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.order.domain.OrderInfo">
  130. select * from order_info where out_trade_no =#{outTradeNo}
  131. </select>
  132. </mapper>