| | |
| | | package com.yeshi.fanli.controller.client.v1;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | 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.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar.NavbarTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/v1/navbar")
|
| | | public class HomeNavbarController<E> {
|
| | |
|
| | | @Resource
|
| | | private HomeNavbarService homeNavbarService;
|
| | |
|
| | |
|
| | | /**
|
| | | * 获取导航栏内容
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "gethomenavbar", method = RequestMethod.POST)
|
| | | public void gethomenavbar(AcceptData acceptData, PrintWriter out) {
|
| | | |
| | | List<HomeNavbar> list = new ArrayList<HomeNavbar>();
|
| | | |
| | | List<HomeNavbar> listNavbar = homeNavbarService.listQueryDefaultNavbar(0);
|
| | | if (listNavbar != null) {
|
| | | list.addAll(listNavbar);
|
| | | }
|
| | | |
| | | for (int i = 0; i < list.size(); i ++) {
|
| | | NavbarTypeEnum type = list.get(i).getType();
|
| | | if (type == NavbarTypeEnum.commonTemplate) {
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", list.size());
|
| | | data.put("listNavbar", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.controller.client.v1; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | 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.RequestMethod; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar; |
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar.NavbarTypeEnum; |
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v1/navbar") |
| | | public class HomeNavbarController<E> { |
| | | |
| | | @Resource |
| | | private HomeNavbarService homeNavbarService; |
| | | |
| | | |
| | | /** |
| | | * 获取导航栏内容 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "gethomenavbar", method = RequestMethod.POST) |
| | | public void gethomenavbar(AcceptData acceptData, PrintWriter out) { |
| | | |
| | | List<HomeNavbar> list = new ArrayList<HomeNavbar>(); |
| | | |
| | | List<HomeNavbar> listNavbar = homeNavbarService.listQueryDefaultNavbar(0,acceptData.getSystem()); |
| | | if (listNavbar != null) { |
| | | list.addAll(listNavbar); |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i ++) { |
| | | NavbarTypeEnum type = list.get(i).getType(); |
| | | if (type == NavbarTypeEnum.commonTemplate) { |
| | | list.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", list.size()); |
| | | data.put("listNavbar", JsonUtil.getApiCommonGson().toJson(list)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | } |