OrderVoMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.xingxi.web.controller.business.order.mapper.OrderVoMapper">
  4. <resultMap type="OrderVo" id="OrderVoResult">
  5. <result property="orderId" column="orderId" />
  6. <result property="orderNo" column="orderNo" />
  7. <result property="orderTime" column="orderTime" />
  8. <result property="payTime" column="payTime" />
  9. <result property="orderStatus" column="orderStatus" />
  10. <result property="orderAmount" column="orderAmount" />
  11. <result property="payAmount" column="payAmount" />
  12. <result property="prodQuantity" column="prodQuantity" />
  13. <result property="buyerId" column="buyerId" />
  14. <result property="sellerId" column="sellerId" />
  15. <result property="cancelTime" column="cancelTime" />
  16. <result property="finishTime" column="finishTime" />
  17. <result property="recProv" column="recProv" />
  18. <result property="recCity" column="recCity" />
  19. <result property="recDistrict" column="recDistrict" />
  20. <result property="recAddress" column="recAddress" />
  21. <result property="recName" column="recName" />
  22. <result property="recMobile" column="recMobile" />
  23. <result property="remark" column="remark" />
  24. <result property="delFlag" column="delFlag" />
  25. <result property="createTime" column="createTime" />
  26. <result property="createUser" column="createUser" />
  27. <result property="updateUser" column="updateUser" />
  28. <result property="updateTime" column="updateTime" />
  29. <result property="sellerName" column="sellerName" />
  30. <result property="sellerMobile" column="sellerMobile" />
  31. <result property="buyerName" column="buyerName" />
  32. <result property="prodName" column="prodName" />
  33. </resultMap>
  34. <sql id="selectOrderVo">
  35. select t_order.orderId
  36. , t_order.orderNo
  37. , t_order.orderTime
  38. , t_order.payTime
  39. , t_order.orderStatus
  40. , t_order.orderAmount
  41. , t_order.payAmount
  42. , t_order.prodQuantity
  43. , t_order.buyerId
  44. , t_order.sellerId
  45. , t_order.cancelTime
  46. , t_order.finishTime
  47. , t_order.recProv
  48. , t_order.recCity
  49. , t_order.recDistrict
  50. , t_order.recAddress
  51. , t_order.recName
  52. , t_order.recMobile
  53. , t_order.remark
  54. , t_order.delFlag
  55. , t_order.createUser
  56. , t_order.createTime
  57. , t_order.updateUser
  58. , t_order.updateTime
  59. , m_merchant.mercName as sellerName
  60. , m_merchant.mobile as sellerMobile
  61. , sys_user.user_name as buyerName
  62. from t_order
  63. inner join m_merchant on m_merchant.mercId = t_order.sellerId
  64. inner join sys_user on sys_user.user_id = t_order.buyerId
  65. </sql>
  66. <select id="selectOrderVoByOrderId" parameterType="Long" resultMap="OrderVoResult">
  67. <include refid="selectOrderVo"/>
  68. where t_order.orderId = #{orderId}
  69. </select>
  70. <select id="selectOrderVoList" parameterType="OrderVo" resultMap="OrderVoResult">
  71. <include refid="selectOrderVo"/>
  72. <where>
  73. <if test="orderNo != null and orderNo != ''"> and t_order.orderNo like concat('%', #{orderNo}, '%')</if>
  74. <if test="orderStatus != null and orderStatus != ''"> and t_order.orderStatus = #{orderStatus}</if>
  75. <if test="recProv != null and recProv != ''"> and t_order.recProv like concat('%', #{recProv}, '%')</if>
  76. <if test="recCity != null and recCity != ''"> and t_order.recCity like concat('%', #{recCity}, '%')</if>
  77. <if test="recDistrict != null and recDistrict != ''"> and t_order.recDistrict like concat('%', #{recDistrict}, '%')</if>
  78. <if test="recName != null and recName != ''"> and t_order.recName like concat('%', #{recName}, '%')</if>
  79. <if test="recMobile != null and recMobile != ''"> and t_order.recMobile like concat('%', #{recMobile}, '%')</if>
  80. <if test="delFlag != null and delFlag != ''"> and t_order.delFlag = #{delFlag}</if>
  81. <if test="params.orderTimeFrom != null and params.orderTimeFrom != ''"><!-- 开始时间检索 -->
  82. and date_format(t_order.orderTime,'%y%m%d') &gt;= date_format(#{params.orderTimeFrom},'%y%m%d')
  83. </if>
  84. <if test="params.orderTimeTo != null and params.orderTimeTo != ''"><!-- 结束时间检索 -->
  85. and date_format(t_order.orderTime,'%y%m%d') &lt;= date_format(#{params.orderTimeTo},'%y%m%d')
  86. </if>
  87. <if test="params.cancelTimeFrom != null and params.cancelTimeFrom != ''"><!-- 开始时间检索 -->
  88. and date_format(t_order.cancelTime,'%y%m%d') &gt;= date_format(#{params.cancelTimeFrom},'%y%m%d')
  89. </if>
  90. <if test="params.cancelTimeTo != null and params.cancelTimeTo != ''"><!-- 结束时间检索 -->
  91. and date_format(t_order.cancelTime,'%y%m%d') &lt;= date_format(#{params.cancelTimeTo},'%y%m%d')
  92. </if>
  93. <if test="buyerName != null and buyerName != ''"> and sys_user.user_name like concat('%', #{buyerName}, '%')</if>
  94. <if test="sellerName != null and sellerName != ''"> and m_merchant.mercName like concat('%', #{sellerName}, '%')</if>
  95. <if test="prodName != null and prodName != '' ">
  96. and exists(select t_order_detail.id from t_order_detail
  97. where t_order_detail.prodName like concat('%', #{prodName}, '%')
  98. )
  99. </if>
  100. </where>
  101. </select>
  102. </mapper>