From 7e7db2fa55a9a3af46d4fd8ede0dee147f101d64 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 09 五月 2020 21:41:27 +0800
Subject: [PATCH] 2.1需求

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java
index e0b5b5a..7e3685c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java
@@ -17,9 +17,7 @@
 import com.google.gson.reflect.TypeToken;
 import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
 import com.yeshi.fanli.exception.homemodule.HomeNavbarException;
-import com.yeshi.fanli.service.AdminUserService;
 import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
-import com.yeshi.fanli.service.inter.homemodule.SuperHomeNavbarService;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
@@ -29,18 +27,10 @@
 @Controller
 @RequestMapping("admin/new/api/v1/navbar")
 public class HomeNavbarAdminController {
-
-	@Resource
-	private AdminUserService adminUserService;
 	
 	@Resource
 	private HomeNavbarService homeNavbarService;
 	
-	@Resource
-	private SuperHomeNavbarService superHomeNavbarService;
-	
-	
-
 	
 	/**
 	 * 淇濆瓨淇℃伅
@@ -50,7 +40,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "save")
-	public void save(String callback, HomeNavbar homeNavbar, String jumpType, HttpServletRequest request,PrintWriter out) {
+	public void save(String callback, HomeNavbar homeNavbar, HttpServletRequest request, PrintWriter out) {
 		try {
 			// 1. 鍏堝垽鏂環ttpRequest 鏄惁鍚湁鏂囦欢绫诲瀷 
 			if (request instanceof MultipartHttpServletRequest) {
@@ -79,9 +69,9 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "updateOrder")
-	public void updateOrder(String callback, Long id, Integer moveType, PrintWriter out) {
+	public void updateOrder(String callback, Long id, Integer moveType, Integer sex, PrintWriter out) {
 		try {
-			homeNavbarService.updateOrder(id, moveType);
+			homeNavbarService.updateOrder(id, moveType, sex);
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛"));
 		} catch (HomeNavbarException e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -102,9 +92,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "query")
-	public void query(String callback, Integer pageIndex, Integer pageSize, String key,
-			Integer sort, PrintWriter out) {
-
+	public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer sex, PrintWriter out) {
 		if (pageIndex == null || pageIndex < 1) {
 			pageIndex = 1;
 		}
@@ -114,15 +102,13 @@
 		}
 
 		try {
-			List<HomeNavbar> list = homeNavbarService.listQuery((pageIndex - 1) * pageSize, pageSize, key);
-
+			List<HomeNavbar> list = homeNavbarService.listQuery((pageIndex - 1) * pageSize, pageSize, key, sex);
 			if (list == null || list.size() == 0) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
 				return;
 			}
 			
-			long count = homeNavbarService.countlistQuery(key);
-			
+			long count = homeNavbarService.countlistQuery(key, sex);
 			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
 
@@ -135,12 +121,10 @@
 			data.put("result_list", gson.toJson(list));
 
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
 			e.printStackTrace();
 		}
-
 	}
 
 
@@ -152,7 +136,6 @@
 	 */
 	@RequestMapping(value = "delete")
 	public void delete(String callback, String idArray, PrintWriter out) {
-
 		try {
 			if (StringUtil.isNullOrEmpty(idArray)) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇烽�夋嫨鎿嶄綔鐨勬暟鎹�"));
@@ -168,12 +151,29 @@
 			}
 			
 			int count = homeNavbarService.deleteBatchByPrimaryKey(list);
-			
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎴愬姛鍒犻櫎["+ count +"]鏉℃暟鎹�"));
-
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍒犻櫎澶辫触"));
 			e.printStackTrace();
 		}
 	}
+	
+	/**
+	 * 淇敼鐘舵��
+	 * @param callback
+	 * @param id
+	 * @param out
+	 */
+	@RequestMapping(value = "switchState")
+	public void switchState(String callback, Long id, PrintWriter out) {
+		try {
+			homeNavbarService.switchState(id);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛"));
+		} catch (HomeNavbarException e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触"));
+			e.printStackTrace();
+		}
+	}
 }

--
Gitblit v1.8.0