yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java
@@ -69,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()));
@@ -92,8 +92,7 @@
    * @param out
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer sex, PrintWriter out) {
      if (pageIndex == null || pageIndex < 1) {
         pageIndex = 1;
      }
@@ -103,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);
@@ -124,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();
      }
   }
@@ -141,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("请选择操作的数据"));
@@ -157,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();
      }
   }
}