OrderInfoMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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="outTradeNo" column="out_trade_no" />
  11. <result property="outRefundNo" column="out_refund_no" />
  12. <result property="tradeType" column="trade_type" />
  13. <result property="successTime" column="success_time" />
  14. <result property="payType" column="pay_type" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="isShare" column="is_share" />
  18. <result property="dqbh" column="dqbh" />
  19. <result property="dqmc" column="dqmc" />
  20. <result property="school" column="school" />
  21. <result property="schoolName" column="school_name" />
  22. <result property="schoolCommission" column="school_commission" />
  23. <result property="phoneType" column="phone_type" />
  24. <result property="refundReason" column="refund_reason" />
  25. </resultMap>
  26. <sql id="selectOrderInfoVo">
  27. select * from order_info
  28. </sql>
  29. <select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
  30. <include refid="selectOrderInfoVo"/>
  31. <where>
  32. <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
  33. <if test="userId != null "> and user_id = #{userId}</if>
  34. <if test="outTradeNo != null and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
  35. <if test="outRefundNo != null and outRefundNo != ''"> and out_refund_no = #{outRefundNo}</if>
  36. <if test="tradeType != null and tradeType != ''"> and trade_type = #{tradeType}</if>
  37. <if test="successTime != null "> and success_time = #{successTime}</if>
  38. <if test="payType != null "> and pay_type = #{payType}</if>
  39. </where>
  40. order by success_time desc
  41. </select>
  42. <select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.order.domain.OrderInfo">
  43. select * from order_info where out_trade_no =#{outTradeNo}
  44. </select>
  45. <select id="selectSchoolOrderInfoList" resultType="com.miaxis.order.vo.QuerySchoolOrderListVo">
  46. select
  47. school,
  48. school_name,
  49. sum(school_commission) as school_commission,
  50. sum(total) as orderTotal
  51. from order_info
  52. <where>
  53. <if test="isShare != null">
  54. and is_share = #{isShare }
  55. </if>
  56. <if test="tradeType != null">
  57. and trade_type = #{tradeType }
  58. </if>
  59. <if test="schoolName != null and schoolName != ''">
  60. and school_name like concat('%', #{schoolName}, '%')
  61. </if>
  62. <if test="startTime != null">
  63. and DATE_FORMAT(create_time,'%Y%m%d')<![CDATA[ >= ]]> #{startTime}
  64. </if>
  65. <if test="endTime != null">
  66. and DATE_FORMAT(create_time,'%Y%m%d') <![CDATA[ < ]]> #{endTime}
  67. </if>
  68. </where>
  69. group by school,school_name
  70. </select>
  71. <select id="selectSchoolOrderDetailed" resultType="com.miaxis.order.domain.OrderInfo">
  72. select * from order_info
  73. <where>
  74. <if test="isShare != null">
  75. and is_share = #{isShare }
  76. </if>
  77. <if test="tradeType != null">
  78. and trade_type = #{tradeType }
  79. </if>
  80. <if test="schoolName != null and schoolName != ''">
  81. and school_name like concat('%', #{schoolName}, '%')
  82. </if>
  83. <if test="startTime != null">
  84. and DATE_FORMAT(create_time,'%Y%m%d')<![CDATA[ >= ]]> #{startTime}
  85. </if>
  86. <if test="endTime != null">
  87. and DATE_FORMAT(create_time,'%Y%m%d') <![CDATA[ < ]]> #{endTime}
  88. </if>
  89. </where>
  90. order by success_time desc
  91. </select>
  92. </mapper>