Browse Source

获取公众号油站信息

jk-GitHub-coder 4 years ago
parent
commit
083f4a9fec

+ 14 - 7
YijiaRestful/src/main/java/com/platform/yijia/controller/StationController.java

@@ -63,18 +63,25 @@ public class StationController {
         return gson.toJson(resultData);
     }
     /**
-     * 获取油站列表信息
+     * 根据公众号appId获取油站列表信息
      */
-    @RequestMapping(value = "/getStationList", method = RequestMethod.GET)
+    @RequestMapping(value = "/getGzhStationList", method = RequestMethod.GET)
     @ResponseBody
-    public String getStationList(@RequestParam StationRequest request){
+    public String getStationList(@RequestParam String appId){
         Gson gson =new Gson();
-        StationInfo stationInfo =new StationInfo();
-        List<StationInfo> stationInfoList = stationService.getStationList(stationInfo);
-        return gson.toJson(stationInfoList);
+        ResultData resultData=null;
+        if(appId !=null){
+            StationInfo stationInfo =new StationInfo();
+            stationInfo.setGzhAppId(appId);
+            List<StationInfo> stationInfoList = stationService.getStationList(stationInfo);
+            resultData = ResultData.success(stationInfoList);
+        }else {
+            resultData=ResultData.error(CodeMsg.REQUEST_FAIL);
+        }
+        return gson.toJson(resultData);
     }
     /**
-     * 获取油站列表信息
+     * 添加油站信息
      */
     @RequestMapping(value = "/addStationInfo", method = RequestMethod.POST)
     @ResponseBody

+ 9 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/StationInfo.java

@@ -119,6 +119,15 @@ public class StationInfo {
      */
 
     private String appId;       //小程序APPID
+    private  String gzhAppId;   //公众号APPID
+
+    public String getGzhAppId() {
+        return gzhAppId;
+    }
+
+    public void setGzhAppId(String gzhAppId) {
+        this.gzhAppId = gzhAppId;
+    }
 
     public String getAppId() {
         return appId;

+ 5 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/StationInfoExample.java

@@ -928,6 +928,11 @@ public class StationInfoExample {
             addCriterion("app_id =", value, "appId");
             return (Criteria) this;
         }
+
+        public Criteria andGzhAppIdEqualTo(String value) {
+            addCriterion("gzh_app_id =", value, "gzhAppId");
+            return (Criteria) this;
+        }
     }
 
     /**

+ 3 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/impl/StationServiceImpl.java

@@ -129,6 +129,9 @@ public class StationServiceImpl implements StationService {
     @Override
     public List<StationInfo> getStationList(StationInfo stationInfo) {
         StationInfoExample example = new StationInfoExample();
+        if (StringUtils.isNotBlank(stationInfo.getGzhAppId())){
+            example.or().andGzhAppIdEqualTo(stationInfo.getGzhAppId());
+        }
         List<StationInfo> stationInfolist = stationInfoMapper.selectByExample(example);
         return stationInfolist;
     }

+ 1 - 0
YijiaRestful/src/main/resources/mapper/StationInfoMapper.xml

@@ -17,6 +17,7 @@
     <result column="station_pic" jdbcType="VARCHAR" property="stationPic" />
     <result column="mno" jdbcType="INTEGER" property="mno" />
     <result column="app_id" jdbcType="VARCHAR" property="appId" />
+    <result column="gzh_app_id" jdbcType="VARCHAR" property="gzhAppId" />
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.platform.yijia.pojo.StationInfo">
     <!--