yujian
2019-12-19 626d711cb15896055c13fe344eb7fcc824589715
fanli/src/main/java/com/yeshi/fanli/controller/admin/shop/BanLiShopGoodsSetAdminController.java
@@ -5,6 +5,7 @@
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -14,6 +15,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
@@ -28,6 +30,26 @@
   @Resource
   private BanLiShopGoodsSetService banLiShopGoodsSetService;
   
   /**
    * 保存信息
    *
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "save")
   public void save(String callback, BanLiShopGoodsSets record, HttpServletRequest request, PrintWriter out) {
      try {
         banLiShopGoodsSetService.saveObject(record);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
      } catch (BanLiShopGoodsSetException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         e.printStackTrace();
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
      }
   }
   
    /** 
    * 删除
@@ -68,7 +90,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, Long goodsId, PrintWriter out) {
      try {
         if (pageIndex == null || pageIndex < 1)
            pageIndex = 1;
@@ -76,13 +98,13 @@
         if (pageSize == null || pageSize < 1) 
            pageSize = Constant.PAGE_SIZE;
   
         List<BanLiShopGoodsSets> list = banLiShopGoodsSetService.listQuery(pageIndex, pageSize, key);
         List<BanLiShopGoodsSets> list = banLiShopGoodsSetService.listQuery(pageIndex, pageSize, key, goodsId);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
         }
         
         long count = banLiShopGoodsSetService.countQuery(key);
         long count = banLiShopGoodsSetService.countQuery(key, goodsId);
         
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);