| 
					
				 | 
			
			
				@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="grade"    column="grade"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="discountTerm"    column="discount_term"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="discountAmt"    column="discount_amt"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result property="discountAmtEnd"    column="discount_amt_end"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="gasoilDiscountAmt"    column="gasoil_discount_amt"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="vipDiscountyPlus"    column="vip_discounty_plus"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="couponPlus"    column="coupon_plus"    /> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -30,14 +31,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <sql id="selectMarkertPlanVo"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        select p.id, p.grade, p.discount_term, p.discount_amt, p.gasoil_discount_amt, p.vip_discounty_plus, p.coupon_plus, p.discount_plan_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          p.oil_name, p.station_id,d.dept_name as station_name, p.status,p.create_by,p.create_time,p.update_by,p.update_time, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         p.discount_setting_flag,p.discount_type,p.discount_date,p.discount_activity_amt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         p.discount_setting_flag,p.discount_type,p.discount_date,p.discount_activity_amt,p.discount_amt_end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           from markert_plan p join sys_dept d on p.station_id = d.dept_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectMarkertPlanList" parameterType="MarkertPlan" resultMap="MarkertPlanResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select  p.id,  p.grade, p.discount_term,  p.discount_amt,  p.gasoil_discount_amt, p.vip_discounty_plus, p.coupon_plus, p.discount_plan_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         p.oil_name, station_id, p.status,p.create_by,p.create_time,p.update_by,p.update_time,d.dept_name as station_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        p.discount_setting_flag,p.discount_type,p.discount_date,p.discount_activity_amt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        p.discount_setting_flag,p.discount_type,p.discount_date,p.discount_activity_amt,p.discount_amt_end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         from markert_plan p join sys_dept d on  d.dept_id =p.station_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="grade != null  and grade != ''"> and p.grade = #{grade}</if> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,9 +48,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="vipDiscountyPlus != null  and vipDiscountyPlus != ''"> and p.vip_discounty_plus = #{vipDiscountyPlus}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="couponPlus != null  and couponPlus != ''"> and p.coupon_plus = #{couponPlus}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountPlanType != null  and discountPlanType != ''"> and p.discount_plan_type = #{discountPlanType}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="oilName != null  and oilName != ''"> and p.oil_name like concat('%', #{oilName}, '%')</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="oilName != null  and oilName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and p.oil_name like concat('%', #{oilName}, '%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="stationId != null "> and p.station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="status != null  and status != ''"> and p.status = #{status}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationId != null "> and station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="stationIdList != null "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 and station_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <foreach item="item" index="index" collection="stationIdList" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -58,16 +62,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by p.oil_name,p.discount_amt_end+0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectMarkertPlanById" parameterType="Long" resultMap="MarkertPlanResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           select  p.id,  p.grade, p.discount_term,  p.discount_amt,  p.gasoil_discount_amt, p.vip_discounty_plus, p.coupon_plus, p.discount_plan_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           p.oil_name, station_id, p.status,p.create_by,p.create_time,p.update_by,p.update_time,d.dept_name as station_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          p.discount_setting_flag,p.discount_type,p.discount_date,p.discount_activity_amt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          p.discount_setting_flag,p.discount_type,p.discount_date,p.discount_activity_amt,p.discount_amt_end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           from markert_plan p join sys_dept d on  d.dept_id =p.station_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where id = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="searchMarkertPlanList" parameterType="Long" resultMap="MarkertPlanResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         SELECT DISTINCT grade,oil_name,station_id,discount_type,discount_date,coupon_plus,discount_plan_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         vip_discounty_plus,discount_term,discount_setting_flag,d.dept_name as station_name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from markert_plan p join sys_dept d on  d.dept_id =p.station_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="grade != null  and grade != ''"> and p.grade = #{grade}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountPlanType != null  and discountPlanType != ''"> and p.discount_plan_type = #{discountPlanType}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="status != null  and status != ''"> and p.status = #{status}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationId != null "> and station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationIdList != null "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and station_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <foreach item="item" index="index" collection="stationIdList" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by oil_name desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <insert id="insertMarkertPlan" parameterType="MarkertPlan" useGeneratedKeys="true" keyProperty="id"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         insert into markert_plan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <trim prefix="(" suffix=")" suffixOverrides=","> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -89,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountType != null">discount_type,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountDate != null">discount_date,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountActivityAmt != null">discount_activity_amt,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountAmtEnd != null">discount_amt_end,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <trim prefix="values (" suffix=")" suffixOverrides=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="grade != null">#{grade},</if> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -109,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountType != null">#{discountType},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountDate != null">#{discountDate},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountActivityAmt != null">#{discountActivityAmt},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountAmtEnd != null">#{discountAmtEnd},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -133,6 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountType != null">discount_type=#{discountType},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountDate != null">discount_date =#{discountDate},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="discountActivityAmt != null">discount_activity_amt = #{discountActivityAmt},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountAmtEnd != null">discount_amt_end = #{discountAmtEnd},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where id = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </update> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -147,5 +175,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <delete id="deleteMarkertPlan" parameterType="MarkertPlan"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        delete from markert_plan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="grade != null  and grade != ''"> and grade = #{grade}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountTerm != null  and discountTerm != ''"> and discount_term = #{discountTerm}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountAmt != null  and discountAmt != ''"> and discount_amt = #{discountAmt}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="gasoilDiscountAmt != null  and gasoilDiscountAmt != ''"> and gasoil_discount_amt = #{gasoilDiscountAmt}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="vipDiscountyPlus != null  and vipDiscountyPlus != ''"> and vip_discounty_plus = #{vipDiscountyPlus}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="couponPlus != null  and couponPlus != ''"> and coupon_plus = #{couponPlus}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="discountPlanType != null  and discountPlanType != ''"> and discount_plan_type = #{discountPlanType}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="oilName != null  and oilName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and oil_name = #{oilName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationId != null "> and station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="status != null  and status != ''"> and status = #{status}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationId != null "> and station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationIdList != null "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and station_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <foreach item="item" index="index" collection="stationIdList" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </mapper> 
			 |