Commit e1269c17 authored by wangyihao's avatar wangyihao

优化 店铺接口返回值 新增 接口

parent 655297a5
package cn.com.fqy.controller.mgt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
......@@ -15,7 +17,6 @@ import cn.com.fqy.core.common.BaseController;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Administrators;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.service.AdministratorsService;
@Controller
@RequestMapping("administrators")
......@@ -77,23 +78,26 @@ public class AdministratorsController extends BaseController{
}
/**
* 获取店铺信息
* 获取店铺管理员信息(针对系统用户)
*/
@RequestMapping("getAdministrators")
@ResponseBody
public ResultInfo<List<Administrators>> getAdministrators(){
ResultInfo<List<Administrators>> result = new ResultInfo<>();
List<Administrators> admListQuery = new ArrayList<>();
public ResultInfo<List<Map<String,Object>>> getAdministrators(){
ResultInfo<List<Map<String,Object>>> result = new ResultInfo<>();
List<Map<String,Object>> admListQuery = new ArrayList<>();
Administrators administrators = new Administrators();
administrators.setIsDeleted(0);
List<Administrators> administratorsList = administratorsService.getAdministratorsList(new Query(administrators));
if (administratorsList.size()>0) {
if (administratorsList.size()>0 && administratorsList != null) {
for(Administrators list:administratorsList) {
if(list.getSystemId() == null || "".equals(list.getSystemId())) {
admListQuery.add(list);
Map<String,Object> map = new HashMap<>();
map.put("administratorsId", list.getAdministratorsId());
map.put("administratorsName", list.getAdministratorsName());
admListQuery.add(map);
}
}
if(admListQuery.size()>0) {
if(admListQuery.size()>0 && admListQuery != null) {
result.setCode("1");
result.setData(admListQuery);
}else {
......@@ -106,4 +110,36 @@ public class AdministratorsController extends BaseController{
}
return result;
}
/**
* 获取店铺管理员信息(针对店铺)
*/
@RequestMapping("getStoreAdministrators")
@ResponseBody
public ResultInfo<List<Map<String,Object>>> getStoreAdministrators(){
ResultInfo<List<Map<String,Object>>> result = new ResultInfo<>();
List<Map<String,Object>> listQuery = new ArrayList<>();
Administrators administrators = new Administrators();
administrators.setIsDeleted(0);
List<Administrators> administratorsList = administratorsService.getAdministratorsList(new Query(administrators));
if (administratorsList.size()>0 && administratorsList != null) {
for(Administrators list:administratorsList) {
Map<String,Object> map = new HashMap<>();
map.put("administratorsId",list.getAdministratorsId());
map.put("administratorsName",list.getAdministratorsName());
listQuery.add(map);
}
if(listQuery.size()>0 && listQuery != null) {
result.setCode("1");
result.setData(listQuery);
}else {
result.setCode("0");
result.setMsg("暂无可用店铺管理员数据");
}
}else {
result.setCode("0");
result.setMsg("暂无店铺管理员数据");
}
return result;
}
}
package cn.com.fqy.controller.mgt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
......@@ -78,15 +81,27 @@ public class StoreController extends BaseController {
*/
@RequestMapping("getStores")
@ResponseBody
public ResultInfo<List<Store>> getStores(){
ResultInfo<List<Store>> result = new ResultInfo<>();
public ResultInfo<List<Map<String,Object>>> getStores(){
ResultInfo<List<Map<String,Object>>> result = new ResultInfo<>();
List<Map<String,Object>> listQuery = new ArrayList<>();
Store store = new Store();
store.setIsDeleted(0);
store.setIsAuditing(1);
List<Store> storeList = storeService.getStoreList(new Query(store));
if (storeList.size()>0) {
result.setCode("1");
result.setData(storeList);
if (storeList.size()>0 && storeList !=null) {
for(Store list: storeList) {
Map<String,Object> map = new HashMap<>();
map.put("storeId", list.getStoreId());
map.put("storeName",list.getStoreName());
listQuery.add(map);
}
if(listQuery.size()>0 && listQuery != null) {
result.setCode("1");
result.setData(listQuery);
}else {
result.setCode("0");
result.setMsg("暂无可用店铺数据");
}
}else {
result.setCode("0");
result.setMsg("暂无店铺数据");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment