AppMapper.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.gree.mall.miniapp.commonmapper.AppMapper">
  4. <select id="queryShoppingCartList" resultType="com.gree.mall.miniapp.bean.order.ShoppingCartList">
  5. SELECT
  6. a.*,
  7. b.price,
  8. c.goods_name,
  9. b.spec_value,
  10. b.org_price,
  11. b.price * num AS 'totalPrice', c.img_url 'goodsImg',
  12. IFNULL(d.stock_qty, 0) AS stock_qty
  13. FROM shopping_cart a
  14. JOIN goods_spec b ON a.goods_spec_id = b.goods_spec_id
  15. JOIN goods c ON c.goods_id = a.goods_id
  16. LEFT JOIN goods_material_storage d ON b.goods_code = d.goods_material_id
  17. WHERE a.user_id = #{userId}
  18. <if test="storageId != null and storageId != ''">
  19. AND a.storage_id = #{storageId}
  20. </if>
  21. </select>
  22. <select id="orderStatusCount" resultType="com.gree.mall.miniapp.bean.order.OrderStatusBean">
  23. select sum(if(order_status = 'NOPAY', 1, 0)) noPay,
  24. sum(if(order_status in ('YFH','DFH'), 1, 0)) yfh,
  25. sum(if(order_status = 'DFH', 1, 0)) dfh,
  26. sum(if(order_status in ('REFUND'), 1, 0)) sh,
  27. sum(if(order_status = 'OVER' and comment_goods=0, 1, 0)) ywc
  28. from order_info
  29. where user_id = #{userId}
  30. </select>
  31. <select id="queryNewGoods" resultType="com.gree.mall.miniapp.bean.goods.GoodsNewBean">
  32. select
  33. a.*
  34. <if test="objId != null and objId != ''">
  35. ,b.obj_id
  36. </if>
  37. from goods a
  38. <if test="objId != null and objId != ''">
  39. join goods_news_category_goods b on a.goods_id = b.goods_id
  40. </if>
  41. where
  42. a.company_wechat_id = #{companyWechatId} and a.del=0 and a.status=1
  43. <if test="objId != null and objId != ''">
  44. and b.obj_id = #{objId}
  45. </if>
  46. <if test="type != null and type != ''">
  47. and b.type = #{type}
  48. </if>
  49. <if test="sort != null and sort==0">
  50. order by a.sort_num
  51. </if>
  52. <if test="sort != null and sort==1">
  53. order by a.sold_num desc
  54. </if>
  55. <if test="sort != null and sort==2">
  56. order by goods_price asc
  57. </if>
  58. <if test="sort != null and sort==3">
  59. order by goods_price desc
  60. </if>
  61. <if test="sort != null and sort==4">
  62. order by a.create_time desc
  63. </if>
  64. </select>
  65. </mapper>