admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
fanli/src/main/java/com/yeshi/fanli/controller/admin/shop/BanLiShopGoodsSetsPayAdminController.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;
@@ -13,8 +14,11 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService;
import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -27,6 +31,23 @@
   
   @Resource
   private BanLiShopGoodsSetPayService banLiShopGoodsSetPayService;
   @Resource
   private BanLiShopGoodsSetService banLiShopGoodsSetService;
   @RequestMapping(value = "save")
   public void save(String callback, BanLiShopGoodsSetsPay record, HttpServletRequest request, PrintWriter out) {
      try {
         banLiShopGoodsSetPayService.saveObject(record);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
      } catch (BanLiShopGoodsSetPayException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         e.printStackTrace();
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
      }
   }
   
   
    /** 
@@ -68,7 +89,7 @@
    * @param out
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer payType, PrintWriter out) {
   public void query(String callback, Integer pageIndex, Integer pageSize, Long setId, String key, Integer payType, PrintWriter out) {
      try {
         if (pageIndex == null || pageIndex < 1)
            pageIndex = 1;
@@ -76,13 +97,20 @@
         if (pageSize == null || pageSize < 1) 
            pageSize = Constant.PAGE_SIZE;
   
         List<BanLiShopGoodsSetsPay> list = banLiShopGoodsSetPayService.listQuery(pageIndex, pageSize, key, payType);
         List<BanLiShopGoodsSetsPay> list = banLiShopGoodsSetPayService.listQuery(pageIndex, pageSize, key, payType, setId);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
         }
         
         long count = banLiShopGoodsSetPayService.countQuery(key, payType);
         for (BanLiShopGoodsSetsPay setsPay: list) {
            BanLiShopGoodsSets goodsSet = setsPay.getGoodsSet();
            if (goodsSet != null) {
               setsPay.setGoodsSet(banLiShopGoodsSetService.selectByPrimaryKey(goodsSet.getId()));
            }
         }
         long count = banLiShopGoodsSetPayService.countQuery(key, payType, setId);
         
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);