jk-GitHub-coder 4 lat temu
rodzic
commit
b471450379

+ 19 - 3
YijiaRestful/src/main/java/com/platform/yijia/controller/CustomerGradeController.java

@@ -1,11 +1,18 @@
 package com.platform.yijia.controller;
 
+import com.google.gson.Gson;
 import com.platform.yijia.service.CustomerGradeServices;
+import com.platform.yijia.utils.CodeMsg;
+import com.platform.yijia.utils.ResultData;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -20,10 +27,19 @@ public class CustomerGradeController {
     private CustomerGradeServices customerGradeServices;
 
     //查询直降客户等级条件和优惠
-    @RequestMapping("/getCustomerGradeList")
+    @RequestMapping(value = "/getCustomerGradeList", method = RequestMethod.GET)
     @ResponseBody
-    public List<Map> getCustomerGradeList(){
-        return customerGradeServices.getCustomerGradeList();
+    public String getCustomerGradeList(@RequestParam("stationId") String stationId){
+        Gson gson =new Gson();
+        ResultData resultData =null;
+        if(StringUtils.isNotBlank(stationId)){
+            Map params = new HashMap();
+            params.put("stationId", stationId);
+            resultData = ResultData.success(customerGradeServices.getCustomerGradeList(params));
+        }else {
+            resultData=ResultData.error(CodeMsg.SEARCH_FAIL);
+        }
+        return gson.toJson(resultData);
     }
 
     // 营销:立减方案

+ 1 - 1
YijiaRestful/src/main/java/com/platform/yijia/dao/CustomerGradeMapper.java

@@ -6,7 +6,7 @@ import java.util.Map;
 public interface CustomerGradeMapper {
 
     //查询直降
-    List<Map> getCustomerGradeList();
+    List<Map> getCustomerGradeList(Map map);
 
     //营销 立减
     List<Map> getMarkertPlanListByDiscountPlanType();

+ 1 - 1
YijiaRestful/src/main/java/com/platform/yijia/service/CustomerGradeServices.java

@@ -9,7 +9,7 @@ import java.util.Map;
 public interface CustomerGradeServices {
 
     //查询直降方式
-    List<Map> getCustomerGradeList();
+    List<Map> getCustomerGradeList(Map map);
 
     //立减
     List<Map> getMarkertPlanListByDiscountPlanType();

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/service/impl/CustomerGradeServiceImpl.java

@@ -16,8 +16,8 @@ public class CustomerGradeServiceImpl implements CustomerGradeServices {
 
     //查询直降
     @Override
-    public List<Map> getCustomerGradeList() {
-        return customerGradeMapper.getCustomerGradeList();
+    public List<Map> getCustomerGradeList(Map map) {
+        return customerGradeMapper.getCustomerGradeList(map);
     }
 
     //营销立减

+ 8 - 2
YijiaRestful/src/main/resources/mapper/CustomerGradeMapper.xml

@@ -3,17 +3,23 @@
 <mapper namespace="com.platform.yijia.dao.CustomerGradeMapper">
 
   <!-- 查询直降优惠方案 -->
-  <select id="getCustomerGradeList"  resultType="map">
+  <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
+        member_condit               AS memberCondit,
+        station_id                  AS stationId,
+        station_name                AS stationName,
+        oil_name                    AS oilName
       FROM customer_grade_setting
     <where>
       discount_way = "直降"
+      <if test="stationId != null and stationId != ''">
+          AND station_id = #{stationId}
+      </if>
     </where>
   </select>