123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.platform.yijia.dao.CustomerGradeMapper">
- <!--根据油站ID查询该油站会员成长规则-->
- <select id="customerGrouthRuleByStationId" parameterType="String" resultType="map">
- SELECT
- grouth_value_name AS grouthValueName,
- grouth_value_consume AS grouthValueConsume,
- grouth_value AS grouthValue
- FROM
- customer_grouth_rule
- <where>
- <if test="stationId != null and stationId != ''">
- station_id = #{stationId}
- </if>
- </where>
- </select>
- <!-- 查询立减满减优惠方案 -->
- <select id="getCustomerMarkertPlanList" resultType="map" parameterType="map">
- SELECT
- id AS id,
- grade AS grade,
- discount_term AS discountTerm,
- discount_amt AS discountAmt,
- station_id AS stationId,
- vip_discounty_plus AS vipDiscountyPlus,
- coupon_plus AS couponPlus,
- discount_plan_type AS discountWay,
- station_name AS stationName,
- oil_name AS oilName
- FROM markert_plan
- <where>
- <if test="stationId != null and stationId != ''">
- station_id = #{stationId}
- </if>
- <if test="oilName != null and oilName != ''">
- AND oil_name = #{oilName}
- </if>
- </where>
- ORDER BY discount_amt DESC
- </select>
- <!-- 查询直降优惠方案 -->
- <select id="getCustomerGradeList" resultType="map" parameterType="map">
- SELECT
- id AS id,
- grade AS grade,
- discount_way AS discountWay,
- gasoil_discount_litre AS gasoilDiscountLitre,
- gasoil_discount_litre AS dieseloilDiscountLitre,
- member_condit AS memberCondit,
- station_id AS stationId,
- member_condit_start AS memberConditStart,
- member_condit_end AS memberConditEnd,
- station_name AS stationName,
- oil_name AS oilName
- FROM customer_grade_setting
- <where>
- <if test="stationId != null and stationId != ''">
- station_id = #{stationId}
- </if>
- <if test="oilName != null and oilName != ''">
- AND oil_name = #{oilName}
- </if>
- </where>
- </select>
- <!--查询客户等级直降信息-->
- <select id="getCustomerGradeInfo" parameterType="map" resultType="map">
- SELECT
- T2.station_name AS stationName,
- T2.member_grade AS memberGradeId,
- T3.grade AS grade,
- T3.discount_way AS discountWay,
- T3.oil_name AS oilName,
- T3.gasoil_discount_litre AS gasoilDiscountLitre,
- T3.member_condit_start AS memberConditStart,
- T3.member_condit_end AS memberConditEnd,
- T3.member_condit AS memberCondit
- FROM
- app_user_info AS T1
- LEFT JOIN customer_manage AS T2 ON T1.mobile_phone = T2.phone_number
- LEFT JOIN customer_grade_setting AS T3 ON T2.station_id = T3.station_id AND T2.oil_name = T3.oil_name
- <!-- <if test="grade !=null and grade != ''"> AND T3.id = T2.member_grade </if>-->
- <where>
- <if test="mobilePhone != null and mobilePhone !=''">
- T1.mobile_phone = #{mobilePhone}
- </if>
- <if test="userType != null and userType !=''">
- AND T1.user_type = #{userType}
- </if>
- <if test="oilName != null and oilName !=''">
- AND T2.oil_name = #{oilName}
- </if>
- <if test="stationId != null and stationId != ''">
- AND T2.station_id = #{stationId}
- </if>
- <if test="blogOpenid != null and blogOpenid != ''">
- AND T1.blog_openid = #{blogOpenid}
- </if>
- <if test="minaOpenid != null and minaOpenid != ''">
- AND T1.mina_openid = #{minaOpenid}
- </if>
- <if test="grade != null and grade != ''">
- AND T3.id = #{grade}
- </if>
- </where>
- ORDER BY T3.member_condit_end ASC
- </select>
- <!--查询客户等级优惠信息-->
- <select id="getCustomerGradeInfoByYouHui" parameterType="map" resultType="map">
- SELECT
- T2.station_name AS stationName,
- T3.oil_name AS oilName,
- T2.member_grade AS memberGradeId,
- T3.grade AS grade,
- T3.discount_term AS discountTerm,
- T3.gasoil_discount_amt AS gasoilDiscountAmt,
- T3.discount_amt AS discountAmt,
- T3.vip_discounty_plus AS vipDiscountyPlus,
- T3.coupon_plus AS couponPlus,
- T3.discount_plan_type AS discountWay
- FROM
- app_user_info AS T1
- LEFT JOIN customer_manage AS T2 ON T1.mobile_phone = T2.phone_number
- LEFT JOIN markert_plan AS T3 ON T3.station_id = T2.station_id AND T3.oil_name = T2.oil_name
- <!-- <if test="grade !=null and grade != ''"> AND T3.id = T2.member_grade </if>-->
- <where>
- <if test="mobilePhone != null and mobilePhone !=''">
- T1.mobile_phone = #{mobilePhone}
- </if>
- <if test="userType != null and userType !=''">
- AND T1.user_type = #{userType}
- </if>
- <if test="oilName != null and oilName !=''">
- AND T2.oil_name = #{oilName}
- </if>
- <if test="discountPlanType != null and discountPlanType !=''">
- AND T3.discount_plan_type = #{discountPlanType}
- </if>
- <if test="stationId != null and stationId != ''">
- AND T2.station_id = #{stationId}
- </if>
- <if test="blogOpenid != null and blogOpenid != ''">
- AND T1.blog_openid = #{blogOpenid}
- </if>
- <if test="minaOpenid != null and minaOpenid != ''">
- AND T1.mina_openid = #{minaOpenid}
- </if>
- <if test="grade != null and grade != ''">
- AND T3.id = #{grade}
- </if>
- </where>
- ORDER BY T3.discount_amt ASC
- </select>
- <!-- 判断客户表是否已存在-->
- <select id="isExistCustomerByStationIdAndPhoneNumber" parameterType="com.platform.yijia.pojo.CustomerManage" resultType="com.platform.yijia.pojo.CustomerManage">
- SELECT
- id AS id,
- member_id AS memberId,
- member_grade AS memberGrade,
- phone_number AS phoneNumber,
- regtime AS regtime,
- station_name AS stationName,
- oil_name AS oilName,
- liters AS liters,
- amt AS amt
- FROM
- customer_manage
- <where>
- <if test="phoneNumber !=null and phoneNumber !='' ">
- phone_number = #{phoneNumber}
- </if>
- <if test="stationId !=null and stationId !='' ">
- AND station_id = #{stationId}
- </if>
- <if test="oilName !=null and oilName !='' ">
- AND oil_name = #{oilName}
- </if>
- </where>
- </select>
- <!-- 营销立减-->
- <select id="getMarkertPlanListByDiscountPlanType" resultType="map">
- SELECT
- id AS id,
- grade AS grade,
- discount_term AS discountWay,
- discount_amt AS discountAmt,
- gasoil_discount_amt AS gasoilDiscountAmt,
- dieseloil_discount_amt AS dieseloilDiscountAmt,
- vip_discounty_plus AS vipDiscountyPlus,
- coupon_plus AS couponPlus,
- discount_plan_type AS discountPlanType
- FROM
- markert_plan
- <where>
- discount_plan_type = "2"
- </where>
- </select>
- </mapper>
|