TOrderMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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.ylx.massage.mapper.TOrderMapper">
  4. <resultMap id="getAllMap" type="com.ylx.massage.domain.TOrder">
  5. <id column="c_id" property="cId"/>
  6. <result column="order_no" property="orderNo"/>
  7. <result column="atlas_add" property="atlasAdd"/>
  8. <result column="pay_type" property="payType"/>
  9. <result column="preferential" property="preferential"/>
  10. <result column="order_type" property="orderType"/>
  11. <result column="virtual_order_flag" property="virtualOrderFlag"/>
  12. <result column="virtual_order_allocation" property="virtualOrderAllocation"/>
  13. <result column="price_difference" property="priceDifference"/>
  14. <result column="c_js_id" property="cJsId"/>
  15. <result column="tape" property="tape"/>
  16. <result column="dept_id" property="deptId"/>
  17. <result column="distance" property="distance"/>
  18. <result column="dept_name" property="deptName"/>
  19. <result column="order_type" property="orderType"/>
  20. <result column="price_difference" property="priceDifference"/>
  21. <result column="new_js_id" property="newJsId"/>
  22. <result column="fare" property="fare"/>
  23. <result column="total_price" property="totalPrice"/>
  24. <result column="parent_no" property="parentNo"/>
  25. <result column="c_open_id" property="cOpenId"/>
  26. <result column="timeout_cause" property="timeoutCause"/>
  27. <result column="coupon_receive_id" property="couponReceiveId"/>
  28. <result column="c_goods" property="cGoods"
  29. typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
  30. <result column="d_total_money" property="dTotalMoney"/>
  31. <result column="n_status" property="nStatus"/>
  32. <result column="c_address" property="cAddress"/>
  33. <result column="c_name" property="cName"/>
  34. <result column="c_phone" property="cPhone"/>
  35. <result column="c_note" property="cNote"/>
  36. <result column="c_time" property="cTime"/>
  37. <result column="name" property="name"/>
  38. <result column="address" property="address"/>
  39. <result column="longitude" property="longitude"/>
  40. <result column="latitude" property="latitude"/>
  41. <result column="arrival_longitude" property="arrivalLongitude"/>
  42. <result column="arrival_latitude" property="arrivalLatitude"/>
  43. <result column="depart_longitude" property="departLongitude"/>
  44. <result column="depart_latitude" property="departLatitude"/>
  45. <result column="arrival_photo" property="arrivalPhoto"/>
  46. <result column="depart_time" property="departTime"/>
  47. <result column="c_tj_open_id" property="cTjOpenId"/>
  48. <result column="old_js_id" property="oldJsId"/>
  49. <result column="dt_create_time" property="dtCreateTime"/>
  50. <result column="acceptance_time" property="acceptanceTime"/>
  51. <result column="reach_time" property="reachTime"/>
  52. <result column="start_time" property="startTime"/>
  53. <result column="pay_time" property="payTime"/>
  54. <result column="end_time" property="endTime"/>
  55. <result column="reason_refusal" property="reasonRefusal"/>
  56. <association property="js" javaType="com.ylx.massage.domain.TJs">
  57. <id column="jsc_id" property="cOpenId"/>
  58. <result column="jsc_bh_list" property="cBhList"/>
  59. <result column="jsc_img_list" property="cImgList"
  60. typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
  61. <result column="jsn_sex" property="nSex"/>
  62. <result column="jsc_nick_name" property="cNickName"/>
  63. <result column="jsc_portrait" property="cPortrait"/>
  64. <result column="jsc_name" property="cName"/>
  65. <result column="jsc_phone" property="cPhone"/>
  66. <result column="jsc_jianjie" property="cJianjie"/>
  67. <result column="jsn_star" property="nStar"/>
  68. <result column="jsn_bili" property="nBili"/>
  69. <result column="jsn_num" property="nNum"/>
  70. <result column="jsn_status" property="nStatus"/>
  71. <result column="jsn_status2" property="nStatus2"/>
  72. <result column="jsn_tong" property="nTong"/>
  73. <result column="jsc_time" property="cTime"/>
  74. <result column="jsn_b1" property="nB1"/>
  75. <result column="jsn_b2" property="nB2"/>
  76. <result column="jsn_b3" property="nB3"/>
  77. <result column="jsn_b3" property="nB3"/>
  78. </association>
  79. <association property="wxUser" javaType="com.ylx.massage.domain.TWxUser">
  80. <id column="wxUserc_openid" property="cOpenid"/>
  81. <result column="wxUsercc_icon" property="cIcon"/>
  82. <result column="wxc_nick_name" property="cNickName"/>
  83. </association>
  84. </resultMap>
  85. <!-- 查询所有订单(PC端) -->
  86. <select id="getAll" resultMap="getAllMap">
  87. select t_order.c_id,
  88. t_order.order_no,
  89. t_order.atlas_add,
  90. t_order.pay_type,
  91. t_order.c_js_id,
  92. t_order.order_type,
  93. t_order.virtual_order_flag,
  94. t_order.virtual_order_allocation,
  95. t_order.price_difference,
  96. t_order.tape,
  97. t_order.fare,
  98. t_order.total_price,
  99. t_order.parent_no,
  100. t_order.c_open_id,
  101. t_order.c_goods,
  102. t_order.d_total_money,
  103. t_order.n_status,
  104. t_order.c_address,
  105. t_order.c_name,
  106. t_order.c_phone,
  107. t_order.c_note,
  108. t_order.c_time,
  109. t_order.pay_time,
  110. t_order.timeout_cause,
  111. t_order.name,
  112. t_order.dept_id,
  113. t_order.dept_name,
  114. t_order.latitude,
  115. t_order.longitude,
  116. t_order.address,
  117. t_order.c_tj_open_id,
  118. t_order.dt_create_time,
  119. t_order.acceptance_time,
  120. t_order.reach_time,
  121. t_order.old_js_id,
  122. t_order.start_time,
  123. t_order.arrival_longitude,
  124. t_order.arrival_latitude,
  125. t_order.depart_longitude,
  126. t_order.depart_latitude,
  127. t_order.arrival_photo,
  128. t_order.depart_time,
  129. t_order.end_time,
  130. t_order.preferential,
  131. t_order.distance,
  132. t_order.reason_refusal,
  133. t_js.c_open_id as jsc_open_id,
  134. t_js.c_bh_list as jsc_bh_list,
  135. t_js.c_img_list as jsc_img_list,
  136. t_js.c_sfz_img as jsc_sfz_img,
  137. t_js.n_sex as jsn_sex,
  138. t_js.c_nick_name as jsc_nick_name,
  139. t_js.c_portrait as jsc_portrait,
  140. t_js.c_name as jsc_name,
  141. t_js.c_phone as jsc_phone,
  142. t_js.c_address as jsc_address,
  143. t_js.c_jianjie as jsc_jianjie,
  144. t_js.n_star as jsn_star,
  145. t_js.n_bili as jsn_bili,
  146. t_js.n_num as jsn_num,
  147. t_js.n_status as jsn_status,
  148. t_js.n_status2 as jsn_status2,
  149. t_js.n_tong as jsn_tong,
  150. t_js.c_time as jsc_time,
  151. t_js.n_b1 as jsn_b1,
  152. t_js.n_b2 as jsn_b2,
  153. t_js.n_b3 as jsn_b3,
  154. t_js.dt_create_time as jsdt_create_time,
  155. t_wx_user.c_openid as wxUserc_openid,
  156. t_wx_user.c_icon as wxUsercc_icon,
  157. t_wx_user.c_nick_name as wxc_nick_name
  158. from t_order
  159. left join
  160. t_js on
  161. t_order.c_js_id = t_js.id
  162. left join
  163. t_wx_user on
  164. t_wx_user.c_openid = t_order.c_open_id
  165. <where>
  166. t_order.is_delete = 0 and t_js.is_delete = 0 and t_wx_user.is_delete = 0
  167. <if test="param.cId != null and param.cId != ''">
  168. and t_order.c_id = #{ param.cId }
  169. </if>
  170. <if test="param.cName != null and param.cName != ''">
  171. and t_order.c_name like concat('%',#{param.cName},'%')
  172. </if>
  173. <if test="param.cNickName != null and param.cNickName != ''">
  174. and t_js.c_nick_name like concat('%',#{param.cNickName},'%')
  175. </if>
  176. <if test="param.jsName != null and param.jsName != ''">
  177. and t_js.c_name like concat('%',#{param.jsName},'%')
  178. </if>
  179. <if test="param.jsPhone != null and param.jsPhone != ''">
  180. and t_js.c_phone like concat('%',#{param.jsPhone},'%')
  181. </if>
  182. <if test="param.cPhone != null and param.cPhone != ''">
  183. and t_order.c_phone = #{param.cPhone}
  184. </if>
  185. <if test="param.orderNo != null and param.orderNo != ''">
  186. and t_order.order_no = #{ param.orderNo }
  187. </if>
  188. <if test="param.nStatus != null and param.nStatus != 10 and param.nStatus != -10 and param.nStatus != 100">
  189. and t_order.n_status = #{ param.nStatus }
  190. </if>
  191. <if test="param.nStatus == 10">
  192. and t_order.n_status in(0,1,2,3)
  193. </if>
  194. <if test="param.nStatus == -10">
  195. and t_order.n_status in(-2,-3)
  196. </if>
  197. <if test="param.cJsId != null and param.cJsId != ''">
  198. and t_order.c_js_id = #{ param.cJsId }
  199. </if>
  200. <if test="param.deptId != null and param.deptId != '' and param.deptId != 100">
  201. and t_order.dept_id = #{ param.deptId }
  202. </if>
  203. <if test="param.cOpenId != null and param.cOpenId != ''">
  204. and t_order.c_open_id = #{ param.cOpenId }
  205. </if>
  206. </where>
  207. order by
  208. t_order.dt_create_time desc
  209. </select>
  210. <select id="getOrderNum" resultType="java.lang.Integer">
  211. SELECT count(1)
  212. FROM t_order
  213. WHERE is_delete = 0
  214. AND c_js_id = #{jsid}
  215. AND end_time BETWEEN #{startDate} AND #{endDate}
  216. AND n_status in (4, 5)
  217. </select>
  218. <select id="getAddNum" resultType="java.lang.Integer">
  219. SELECT count(1)
  220. FROM t_order
  221. WHERE is_delete = 0
  222. AND c_js_id = #{jsid}
  223. AND end_time BETWEEN #{startDate} AND #{endDate}
  224. AND n_status in (4, 5)
  225. and order_type = 1
  226. </select>
  227. <select id="getUpgradeNum" resultType="java.lang.Integer">
  228. SELECT count(1)
  229. FROM t_order
  230. WHERE is_delete = 0
  231. AND c_js_id = #{jsid}
  232. AND end_time BETWEEN #{startDate} AND #{endDate}
  233. AND n_status in (4, 5)
  234. and order_type = 2
  235. </select>
  236. <select id="getTurnover" resultType="java.math.BigDecimal">
  237. SELECT sum(total_price)
  238. FROM t_order
  239. WHERE is_delete = 0
  240. AND c_js_id = #{jsid}
  241. AND end_time BETWEEN #{startDate} AND #{endDate}
  242. AND n_status in (4, 5)
  243. </select>
  244. <select id="getBlock" resultType="com.ylx.massage.domain.vo.HomeBlock">
  245. SELECT
  246. DATE_FORMAT( end_time, '%Y-%m' ) AS month,
  247. SUM( total_price ) AS turnover,
  248. count(1) orderNum
  249. FROM
  250. t_order
  251. WHERE
  252. is_delete = 0
  253. AND end_time IS NOT NULL
  254. AND end_time BETWEEN #{start} AND #{end}
  255. AND n_status in (4, 5)
  256. <if test="deptId != 100 and deptId != ''">
  257. AND dept_id = #{deptId}
  258. </if>
  259. GROUP BY
  260. month
  261. ORDER BY
  262. month;
  263. </select>
  264. </mapper>