Commit 08459128 authored by 扫地僧's avatar 扫地僧

修改返回值

parent d1f2f2c4
package cn.com.fqy.controller.mapi;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.AdvertService;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
/**
* H5首页数据服务类
* @author Administrator
*
*/
@Controller
@RequestMapping("/h5/index")
public class IndexController {
@Resource
private AdvertService advertService;
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
@RequestMapping("fqy")
@ResponseBody
public String fqy (){
return "fqy";
}
/**
* 分页展示广告
*/
@RequestMapping("getAdvertList")
@ResponseBody
public PageFinder<Advert> getAdvertList(@ModelAttribute("advert") Advert advert,Query query) {
Query q = new Query(query.getPageNo(),query.getPageSize(),advert);
return advertService.getAdvertPagedList(q);
}
/**
* 推荐商家
*/
@RequestMapping("getStoreList")
@ResponseBody
public PageFinder<Store> getStoreList() {
Store store = new Store();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
store.setIsRecommend(1); //店铺推荐状态
Query q = new Query(store);
return storeService.getStorePagedList(q);
}
/**
* 推荐员工
*/
@RequestMapping("getWorkerList")
@ResponseBody
public PageFinder<Worker> getWorkerList() {
Worker worker = new Worker();
worker.setIsDeleted(0); //未删除
worker.setIsAuditing(1);//已审核
worker.setIsShopping(1);//已展示
worker.setIsRecommend(1);//已推荐
Query q = new Query(worker);
return workerService.getWorkerPagedList(q);
}
/**
* 搜索查询 - 待需求明确
*/
@RequestMapping("searchShop")
@ResponseBody
public PageFinder<Store> searchShopResult(String addkey){
Store store = new Store();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
Query q = new Query(store);
return storeService.getStorePagedList(q);
}
}
package cn.com.fqy.controller.mapi;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.AdvertService;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
/**
* H5首页数据服务类
* @author Administrator
*
*/
@Controller
@RequestMapping("/h5/index")
public class IndexController {
@Resource
private AdvertService advertService;
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
@RequestMapping("fqy")
@ResponseBody
public String fqy (){
return "fqy";
}
/**
* 分页展示广告
*/
@RequestMapping("getAdvertList")
@ResponseBody
public ResultInfo<List<Advert>> getAdvertList() {
ResultInfo<List<Advert>> resultInfo = new ResultInfo<List<Advert>>();
Advert advert = new Advert();
advert.setIsAvailable(1); //可用
Query q = new Query(advert);
PageFinder<Advert> pageResult = advertService.getAdvertPagedList(q);
if(null != pageResult && pageResult.getData().size()>0) {
List<Advert> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
return resultInfo;
}
/**
* 推荐商家
*/
@RequestMapping("getStoreList")
@ResponseBody
public ResultInfo<List<Store>> getStoreList() {
ResultInfo<List<Store>> resultInfo = new ResultInfo<List<Store>>();
Store store = new Store();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
store.setIsRecommend(1); //店铺推荐状态
Query q = new Query(store);
PageFinder<Store> pageResult = storeService.getStorePagedList(q);
if(null != pageResult && pageResult.getData().size() > 0) {
List<Store> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
return resultInfo;
}
/**
* 推荐员工
*/
@RequestMapping("getWorkerList")
@ResponseBody
public ResultInfo<List<Worker>> getWorkerList() {
ResultInfo<List<Worker>> resultInfo = new ResultInfo<List<Worker>>();
Worker worker = new Worker();
worker.setIsDeleted(0); //未删除
worker.setIsAuditing(1);//已审核
worker.setIsShopping(1);//已展示
worker.setIsRecommend(1);//已推荐
Query q = new Query(worker);
PageFinder<Worker> pageResult = workerService.getWorkerPagedList(q);
if(null != pageResult && pageResult.getData().size() > 0) {
List<Worker> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
return resultInfo;
}
/**
* 搜索查询 - 待需求明确
*/
@RequestMapping("searchShop")
@ResponseBody
public PageFinder<Store> searchShopResult(String addkey){
Store store = new Store();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
Query q = new Query(store);
return storeService.getStorePagedList(q);
}
}
package cn.com.fqy.controller.mapi;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.AdvertService;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
/**
* H5商家数据服务类
* @author Administrator
*
*/
@Controller
@RequestMapping("/h5/shop")
public class ShopController {
@Resource
private AdvertService advertService;
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
/**
* 根据条件查询商家列表
* @param store
* @return
*/
@RequestMapping("getStoreList")
@ResponseBody
public PageFinder<Store> getStoreList(Store store) {
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
Query q = new Query(store);
return storeService.getStorePagedList(q);
}
/**
* 商家店铺详情信息
*/
@RequestMapping("storeDetails")
@ResponseBody
public ResultInfo<Store> getStores(Store store){
ResultInfo<Store> resultInfo = new ResultInfo<>();
Store res = storeService.getStore(store.getStoreId());
if (null != res ) {
resultInfo.setCode("1");
resultInfo.setData(res);
}else {
resultInfo.setCode("0");
resultInfo.setMsg("店铺数据丢失");
}
return resultInfo;
}
}
package cn.com.fqy.controller.mapi;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.AdvertService;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
/**
* H5商家数据服务类
* @author Administrator
*
*/
@Controller
@RequestMapping("/h5/shop")
public class ShopController {
@Resource
private AdvertService advertService;
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
/**
* 根据条件查询商家列表
* @param store
* @return
*/
@RequestMapping("getStoreList")
@ResponseBody
public ResultInfo<List<Store>> getStoreList(Store store) {
ResultInfo<List<Store>> resultInfo = new ResultInfo<List<Store>>();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
Query q = new Query(store);
PageFinder<Store> pageResult = storeService.getStorePagedList(q);
if(null != pageResult && pageResult.getData().size() > 0) {
List<Store> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
return resultInfo;
}
/**
* 商家店铺详情信息
*/
@RequestMapping("storeDetails")
@ResponseBody
public ResultInfo<Store> getStores(Store store){
ResultInfo<Store> resultInfo = new ResultInfo<>();
Store res = storeService.getStore(store.getStoreId());
if (null != res ) {
resultInfo.setCode("1");
resultInfo.setData(res);
}else {
resultInfo.setCode("0");
resultInfo.setMsg("店铺数据丢失");
}
return resultInfo;
}
}
package cn.com.fqy.controller.mapi;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.AdvertService;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
/**
* H5员工数据服务类
* @author Administrator
*
*/
@Controller
@RequestMapping("/h5/worker")
public class WorkerController {
@Resource
private AdvertService advertService;
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
/**
* 根据条件查询员工列表
* @param store
* @return
*/
@RequestMapping("getWorkerList")
@ResponseBody
public PageFinder<Worker> getStoreList(Worker worker) {
worker.setIsDeleted(0); //未删除
worker.setIsAuditing(1);//已审核
worker.setIsShopping(1);//已展示
Query q = new Query(worker);
return workerService.getWorkerPagedList(q);
}
/**
* 员工详情信息
*/
@RequestMapping("workerDetails")
@ResponseBody
public ResultInfo<Worker> workerDetails(Worker worker){
ResultInfo<Worker> resultInfo = new ResultInfo<>();
Worker res = workerService.getWorker(worker.getWorkerId());
if (null != res ) {
resultInfo.setCode("1");
resultInfo.setData(res);
}else {
resultInfo.setCode("0");
resultInfo.setMsg("员工信息丢失");
}
return resultInfo;
}
}
package cn.com.fqy.controller.mapi;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.AdvertService;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
/**
* H5员工数据服务类
* @author Administrator
*
*/
@Controller
@RequestMapping("/h5/worker")
public class WorkerController {
@Resource
private AdvertService advertService;
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
/**
* 根据条件查询员工列表
* @param store
* @return
*/
@RequestMapping("getWorkerList")
@ResponseBody
public ResultInfo<List<Worker>> getStoreList(Worker worker) {
ResultInfo<List<Worker>> resultInfo = new ResultInfo<List<Worker>>();
worker.setIsDeleted(0); //未删除
worker.setIsAuditing(1);//已审核
worker.setIsShopping(1);//已展示
Query q = new Query(worker);
PageFinder<Worker> pageResult = workerService.getWorkerPagedList(q);
if(null != pageResult && pageResult.getData().size() > 0) {
List<Worker> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
return resultInfo;
}
/**
* 员工详情信息
*/
@RequestMapping("workerDetails")
@ResponseBody
public ResultInfo<Worker> workerDetails(Worker worker){
ResultInfo<Worker> resultInfo = new ResultInfo<>();
Worker res = workerService.getWorker(worker.getWorkerId());
if (null != res ) {
resultInfo.setCode("1");
resultInfo.setData(res);
}else {
resultInfo.setCode("0");
resultInfo.setMsg("员工信息丢失");
}
return resultInfo;
}
}
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