Browse Source

新增获取区划列表的接口

master
牧羊人 4 years ago
parent
commit
9f5e8b15d2
3 changed files with 64 additions and 9 deletions
  1. +24
    -8
      src/main/java/com/taauav/admin/controller/LsCityController.java
  2. +1
    -1
      src/main/java/com/taauav/admin/service/impl/SysCityServiceImpl.java
  3. +39
    -0
      src/main/java/com/taauav/front/controller/LSCityController.java

+ 24
- 8
src/main/java/com/taauav/admin/controller/LsCityController.java View File

@@ -3,6 +3,7 @@ package com.taauav.admin.controller;

import com.taauav.admin.entity.SysCity;
import com.taauav.admin.service.ILsCityService;
import com.taauav.admin.service.ISysCityService;
import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.math.BigInteger;
import java.util.List;

/**
* <p>
@@ -26,11 +28,14 @@ import java.math.BigInteger;
public class LsCityController {

@Autowired
private ILsCityService tauvAgencyService;
private ILsCityService lsCityService;

@Autowired
private Response response;

@Autowired
private ISysCityService cityService;

private static final String controllerName = "lscity";

/**
@@ -41,7 +46,7 @@ public class LsCityController {
@PostMapping("/index")
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION)
public Response index() {
return tauvAgencyService.getList();
return lsCityService.getList();
}

/**
@@ -58,7 +63,7 @@ public class LsCityController {
String message = bindingResult.getFieldError().getDefaultMessage();
return response.failure(message);
}
return tauvAgencyService.add(entity);
return lsCityService.add(entity);
}

/**
@@ -70,7 +75,7 @@ public class LsCityController {
@GetMapping("/info")
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION)
public Response info(BigInteger id) {
return tauvAgencyService.info(id);
return lsCityService.info(id);
}

/**
@@ -87,7 +92,7 @@ public class LsCityController {
String message = bindingResult.getFieldError().getDefaultMessage();
return response.failure(message);
}
return tauvAgencyService.edit(entity);
return lsCityService.edit(entity);
}

/**
@@ -99,7 +104,7 @@ public class LsCityController {
@PostMapping("/drop")
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION)
public Response delete(BigInteger id) {
return tauvAgencyService.delete(id);
return lsCityService.delete(id);
}

/**
@@ -111,7 +116,7 @@ public class LsCityController {
@PostMapping("/setStatus")
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION)
public Response setStatus(@RequestBody SysCity entity) {
return tauvAgencyService.setStatus(entity);
return lsCityService.setStatus(entity);
}

/**
@@ -122,7 +127,18 @@ public class LsCityController {
*/
@GetMapping("/getChildCityList")
public Response getChildCityList(BigInteger pid) {
return response.success(tauvAgencyService.getChildCityList(pid));
return response.success(lsCityService.getChildCityList(pid));
}

/**
* 获取区划列表
*
* @return
*/
@PostMapping("/getCityList")
public Response getCityList() {
List<SysCity> cityList = cityService.getCityList(BigInteger.valueOf(Long.valueOf("320117")));
return response.success(cityList);
}

}

+ 1
- 1
src/main/java/com/taauav/admin/service/impl/SysCityServiceImpl.java View File

@@ -78,13 +78,13 @@ public class SysCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> impl
if (!list.isEmpty()) {
// 获取子级
list.forEach(item -> {
cityList.add(item);
List<SysCity> children = this.getCityList(BigInteger.valueOf(Long.valueOf(item.getId().toString())));
if (!children.isEmpty()) {
for (SysCity child : children) {
cityList.add(child);
}
}
cityList.add(item);
});
}
return cityList;

+ 39
- 0
src/main/java/com/taauav/front/controller/LSCityController.java View File

@@ -0,0 +1,39 @@
package com.taauav.front.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.taauav.admin.entity.SysCity;
import com.taauav.admin.service.ISysCityService;
import com.taauav.common.bean.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;
import java.util.List;

/**
* 前台城市管理
*/
@RestController
@RequestMapping("/front/lscity")
public class LSCityController {

@Autowired
private ISysCityService cityService;

@Autowired
private Response response;

/**
* 获取区划列表
*
* @return
*/
@PostMapping("/getCityList")
public Response getCityList() {
List<SysCity> cityList = cityService.getCityList(BigInteger.valueOf(Long.valueOf("320117")));
return response.success(cityList);
}

}

Loading…
Cancel
Save