|
@@ -1,60 +1,34 @@
|
|
|
-// package com.bofeng.controller;
|
|
|
-//
|
|
|
-// import com.bofeng.Consts;
|
|
|
-// import com.bofeng.entity.Place;
|
|
|
-// import com.bofeng.service.PlaceService;
|
|
|
-// import com.google.common.base.Strings;
|
|
|
-// import com.yvan.Model;
|
|
|
-// import com.yvan.ModelOps;
|
|
|
-// import com.yvan.mvc.Pd;
|
|
|
-// import lombok.val;
|
|
|
-// import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
-// import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-// import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-// import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-// import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-// import org.springframework.web.bind.annotation.RestController;
|
|
|
-// import org.springframework.web.servlet.ModelAndView;
|
|
|
-//
|
|
|
-// import java.util.List;
|
|
|
-//
|
|
|
-// @RestController
|
|
|
-// @RequiresPermissions(Consts.USER_TYPE_ADMIN)
|
|
|
-// public class AdminAreaController {
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private PlaceService placeService;
|
|
|
-//
|
|
|
-// @GetMapping("/admin/place.html")
|
|
|
-// public ModelAndView placeView() {
|
|
|
-// return new ModelAndView("/admin/place.ftl");
|
|
|
-// }
|
|
|
-//
|
|
|
-// @GetMapping("/admin/sysArea")
|
|
|
-// public Model<List<Place>> getArea() {
|
|
|
-// return Model.newSuccess(placeService.selectAll());
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/admin/place_addnew.json")
|
|
|
-// public ModelOps placeAddNew(@RequestBody Place place) {
|
|
|
-// val msg = placeService.insert(place);
|
|
|
-// if (Strings.isNullOrEmpty(msg)) {
|
|
|
-// return ModelOps.newSuccess();
|
|
|
-// }
|
|
|
-// return ModelOps.newFail(msg);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/admin/place_edit")
|
|
|
-// public ModelOps placeEdit(@RequestBody Place place) {
|
|
|
-// val msg = placeService.updateById(place);
|
|
|
-// if (Strings.isNullOrEmpty(msg)) {
|
|
|
-// return ModelOps.newSuccess();
|
|
|
-// }
|
|
|
-// return ModelOps.newFail(msg);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/admin/place_delete.json")
|
|
|
-// public ModelOps placeDelete(@Pd(name = "placeId", desc = "") Long placeId) {
|
|
|
-// return ModelOps.newSuccess(placeService.deleteById(placeId));
|
|
|
-// }
|
|
|
-// }
|
|
|
+package com.bofeng.controller;
|
|
|
+
|
|
|
+import com.bofeng.entity.SysArea;
|
|
|
+import com.bofeng.service.SysAreaService;
|
|
|
+import com.yvan.Model;
|
|
|
+import com.yvan.mvc.Pd;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+public class AdminAreaController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysAreaService sysAreaService;
|
|
|
+
|
|
|
+ @GetMapping("/admin/selectProvince")
|
|
|
+ public Model<List<SysArea>> selectProvince() {
|
|
|
+ return Model.newSuccess(sysAreaService.selectProvince());
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/admin/selectCityByProvince")
|
|
|
+ public Model<List<SysArea>> selectCityByProvince(@Pd(name = "areaId") Long areaId) {
|
|
|
+ return Model.newSuccess(sysAreaService.selectCityByProvince(areaId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/admin/selectAreaByCity")
|
|
|
+ public Model<List<SysArea>> selectAreaByCity(@Pd(name = "areaId") Long areaId) {
|
|
|
+ return Model.newSuccess(sysAreaService.selectAreaByCity(areaId));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|