CustomerGradeMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.platform.yijia.dao.CustomerGradeMapper">
  4. <!-- 查询直降优惠方案 -->
  5. <select id="getCustomerGradeList" resultType="map" parameterType="map">
  6. SELECT
  7. id AS id,
  8. grade AS grade,
  9. discount_way AS discountWay,
  10. gasoil_discount_litre AS gasoilDiscountLitre,
  11. gasoil_discount_litre AS dieseloilDiscountLitre,
  12. member_condit AS memberCondit,
  13. station_id AS stationId,
  14. station_name AS stationName,
  15. oil_name AS oilName
  16. FROM customer_grade_setting
  17. <where>
  18. <if test="stationId != null and stationId != ''">
  19. station_id = #{stationId}
  20. </if>
  21. <if test="oilName != null and oilName != ''">
  22. AND oil_name = #{oilName}
  23. </if>
  24. </where>
  25. </select>
  26. <!--查询客户等级直降信息-->
  27. <select id="getCustomerGradeInfo" parameterType="map" resultType="map">
  28. SELECT
  29. T2.station_name AS stationName,
  30. T2.member_grade AS memberGradeId,
  31. T3.grade AS grade,
  32. T3.discount_way AS discountWay,
  33. T3.oil_name AS oilName,
  34. T3.gasoil_discount_litre AS gasoilDiscountLitre,
  35. T3.member_condit_start AS memberConditStart,
  36. T3.member_condit_end AS memberConditEnd,
  37. T3.member_condit AS memberCondit
  38. FROM
  39. app_user_info AS T1
  40. LEFT JOIN customer_manage AS T2 ON T1.mobile_phone = T2.phone_number
  41. LEFT JOIN customer_grade_setting AS T3 ON T2.station_id = T3.station_id AND T2.oil_name = T3.oil_name
  42. <!-- <if test="grade !=null and grade != ''"> AND T3.grade = T2.member_grade </if>-->
  43. <where>
  44. <if test="mobilePhone != null and mobilePhone !=''">
  45. T1.mobile_phone = #{mobilePhone}
  46. </if>
  47. <if test="userType != null and userType !=''">
  48. AND T1.user_type = #{userType}
  49. </if>
  50. <if test="oilName != null and oilName !=''">
  51. AND T2.oil_name = #{oilName}
  52. </if>
  53. <if test="stationId != null and stationId != ''">
  54. AND T2.station_id = #{stationId}
  55. </if>
  56. <if test="blogOpenid != null and blogOpenid != ''">
  57. AND T1.blog_openid = #{blogOpenid}
  58. </if>
  59. <if test="minaOpenid != null and minaOpenid != ''">
  60. AND T1.mina_openid = #{minaOpenid}
  61. </if>
  62. </where>
  63. </select>
  64. <!--查询客户等级优惠信息-->
  65. <select id="getCustomerGradeInfoByYouHui" parameterType="map" resultType="map">
  66. SELECT
  67. T2.station_name AS stationName,
  68. T3.oil_name AS oilName,
  69. T2.member_grade AS memberGradeId,
  70. T3.grade AS grade,
  71. T3.discount_term AS discountTerm,
  72. T3.gasoil_discount_amt AS gasoilDiscountAmt,
  73. T3.discount_amt AS discountAmt,
  74. T3.vip_discounty_plus AS vipDiscountyPlus,
  75. T3.coupon_plus AS couponPlus,
  76. T3.discount_plan_type AS discountPlanType
  77. FROM
  78. app_user_info AS T1
  79. LEFT JOIN customer_manage AS T2 ON T1.mobile_phone = T2.phone_number
  80. LEFT JOIN markert_plan AS T3 ON T3.station_id = T2.station_id AND T3.oil_name = T2.oil_name
  81. <!-- <if test="grade !=null and grade != ''"> AND T3.grade = T2.member_grade </if>-->
  82. <where>
  83. <if test="mobilePhone != null and mobilePhone !=''">
  84. T1.mobile_phone = #{mobilePhone}
  85. </if>
  86. <if test="userType != null and userType !=''">
  87. AND T1.user_type = #{userType}
  88. </if>
  89. <if test="oilName != null and oilName !=''">
  90. AND T2.oil_name = #{oilName}
  91. </if>
  92. <if test="discountPlanType != null and discountPlanType !=''">
  93. AND T3.discount_plan_type = #{discountPlanType}
  94. </if>
  95. <if test="stationId != null and stationId != ''">
  96. AND T2.station_id = #{stationId}
  97. </if>
  98. <if test="blogOpenid != null and blogOpenid != ''">
  99. AND T1.blog_openid = #{blogOpenid}
  100. </if>
  101. <if test="minaOpenid != null and minaOpenid != ''">
  102. AND T1.mina_openid = #{minaOpenid}
  103. </if>
  104. </where>
  105. </select>
  106. <!-- 营销立减-->
  107. <select id="getMarkertPlanListByDiscountPlanType" resultType="map">
  108. SELECT
  109. id AS id,
  110. grade AS grade,
  111. discount_term AS discountWay,
  112. discount_amt AS discountAmt,
  113. gasoil_discount_amt AS gasoilDiscountAmt,
  114. dieseloil_discount_amt AS dieseloilDiscountAmt,
  115. vip_discounty_plus AS vipDiscountyPlus,
  116. coupon_plus AS couponPlus,
  117. discount_plan_type AS discountPlanType
  118. FROM
  119. markert_plan
  120. <where>
  121. discount_plan_type = "2"
  122. </where>
  123. </select>
  124. </mapper>