Browse Source

呵呵商城首页楼层版本

Aslee 3 years ago
parent
commit
fcdd8c60c2
22 changed files with 1616 additions and 126 deletions
  1. 24 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheFloorDao.java
  2. 24 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheFloorProductDao.java
  3. 0 7
      src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java
  4. 72 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheFloor.java
  5. 108 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheFloorProduct.java
  6. 88 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheFloorProduct1.java
  7. 0 19
      src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java
  8. 107 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheFloorProductService.java
  9. 64 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheFloorService.java
  10. 1 13
      src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java
  11. 164 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheFloorController.java
  12. 140 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheFloorProductController.java
  13. 0 51
      src/main/java/com/caimei/modules/hehe/web/CmHeheProductController.java
  14. 10 1
      src/main/java/com/caimei/modules/product/entity/Product.java
  15. 119 0
      src/main/resources/mappings/modules/hehe/CmHeheFloorMapper.xml
  16. 154 0
      src/main/resources/mappings/modules/hehe/CmHeheFloorProductMapper.xml
  17. 2 16
      src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml
  18. 118 0
      src/main/webapp/WEB-INF/views/modules/hehe/addFloorProduct.jsp
  19. 78 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorForm.jsp
  20. 145 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorList.jsp
  21. 197 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorProductList.jsp
  22. 1 19
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductList.jsp

+ 24 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheFloorDao.java

@@ -0,0 +1,24 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.hehe.entity.CmHeheFloor;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct1;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 呵呵商品商品楼层DAO接口
+ * @author Aslee
+ * @version 2021-06-17
+ */
+@MyBatisDao
+public interface CmHeheFloorDao extends CrudDao<CmHeheFloor> {
+
+    void updateStatusByFloorId(@Param("status") Integer status, @Param("floorId") Integer floorId);
+
+    void saveSort(@Param("sort") String sort, @Param("floorId") String id);
+
+    List<CmHeheFloorProduct1> getProductList(CmHeheFloorProduct1 floorProduct);
+}

+ 24 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheFloorProductDao.java

@@ -0,0 +1,24 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 呵呵商城楼层商品DAO接口
+ * @author Aslee
+ * @version 2021-06-18
+ */
+@MyBatisDao
+public interface CmHeheFloorProductDao extends CrudDao<CmHeheFloorProduct> {
+
+    void updateSort(@Param("sort") String sort,@Param("id") String id);
+
+    List<Integer> findFloorProductId();
+
+    List<Product> findAllProduct(Product product);
+}

+ 0 - 7
src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java

@@ -32,13 +32,6 @@ public interface CmHeheProductDao extends CrudDao<CmHeheProduct> {
      */
     List<Product> findAllProduct(Product product);
 
-    /**
-     * 保存排序值
-     *
-     * @param sort
-     * @param id
-     */
-    void saveSort(@Param("sort") String sort, @Param("id") String id);
 
     /**
      * 删除活动商品

+ 72 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheFloor.java

@@ -0,0 +1,72 @@
+package com.caimei.modules.hehe.entity;
+
+import org.hibernate.validator.constraints.Length;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.util.Date;
+
+/**
+ * 呵呵商品商品楼层Entity
+ * @author Aslee
+ * @version 2021-06-17
+ */
+public class CmHeheFloor extends DataEntity<CmHeheFloor> {
+	
+	private static final long serialVersionUID = 1L;
+	private String title;		// 楼层标题
+	private String description;		// 楼层描述
+	private String sort;		// 排序
+	private String status;		// 状态
+	private Date createTime;		// 创建时间
+
+	public CmHeheFloor() {
+		super();
+	}
+
+	public CmHeheFloor(String id){
+		super(id);
+	}
+
+	@Length(min=1, max=20, message="楼层标题长度必须介于 1 和 20 之间")
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	
+	@Length(min=1, max=255, message="楼层描述长度必须介于 1 和 255 之间")
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	
+	public String getSort() {
+		return sort;
+	}
+
+	public void setSort(String sort) {
+		this.sort = sort;
+	}
+	
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+}

+ 108 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheFloorProduct.java

@@ -0,0 +1,108 @@
+package com.caimei.modules.hehe.entity;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 呵呵商城楼层商品Entity
+ * @author Aslee
+ * @version 2021-06-18
+ */
+public class CmHeheFloorProduct extends DataEntity<CmHeheFloorProduct> {
+	
+	private static final long serialVersionUID = 1L;
+	private Integer floorId;		// floorId
+	private Integer productId;		// productId
+	private Integer validFlag;		// 上架状态:1上架,0下架
+	private Integer recommend;		// 是否为推荐商品(0 没推荐,1 推荐商品)
+	private Integer sort;		// 排序值
+	private Date addTime;		// 添加时间
+
+	private String productName;		//商品名称
+	private String mainImage;		//商品图片
+	private String shopName;		//供应商名称
+	private String productIds;		//商品id,以,隔开
+
+
+	public Integer getFloorId() {
+		return floorId;
+	}
+
+	public void setFloorId(Integer floorId) {
+		this.floorId = floorId;
+	}
+
+	public Integer getProductId() {
+		return productId;
+	}
+
+	public void setProductId(Integer productId) {
+		this.productId = productId;
+	}
+
+	public Integer getValidFlag() {
+		return validFlag;
+	}
+
+	public void setValidFlag(Integer validFlag) {
+		this.validFlag = validFlag;
+	}
+
+	public Integer getRecommend() {
+		return recommend;
+	}
+
+	public void setRecommend(Integer recommend) {
+		this.recommend = recommend;
+	}
+
+	public Integer getSort() {
+		return sort;
+	}
+
+	public void setSort(Integer sort) {
+		this.sort = sort;
+	}
+
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+
+	public String getProductName() {
+		return productName;
+	}
+
+	public void setProductName(String productName) {
+		this.productName = productName;
+	}
+
+	public String getMainImage() {
+		return mainImage;
+	}
+
+	public void setMainImage(String mainImage) {
+		this.mainImage = mainImage;
+	}
+
+	public String getShopName() {
+		return shopName;
+	}
+
+	public void setShopName(String shopName) {
+		this.shopName = shopName;
+	}
+
+	public String getProductIds() {
+		return productIds;
+	}
+
+	public void setProductIds(String productIds) {
+		this.productIds = productIds;
+	}
+}

+ 88 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheFloorProduct1.java

@@ -0,0 +1,88 @@
+package com.caimei.modules.hehe.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.util.Date;
+
+/**
+ * 呵呵商品商品楼层Entity
+ * @author Aslee
+ * @version 2021-06-17
+ */
+public class CmHeheFloorProduct1 extends DataEntity<CmHeheFloorProduct1> {
+
+	private static final long serialVersionUID = 1L;
+	private Integer floorId;		// 楼层id
+	private Integer productId;		// 商品id
+	private Integer validFlag;		// 上架状态,0下架,1上架
+	private Integer recommend;		// 是否为推荐商品(0 没推荐,1 推荐商品)
+	private String sort;		// 排序
+	private Date addTime;		// 添加时间
+
+	private String productName;		//商品名称
+	private String mainImage;		//商品图片
+
+	public Integer getFloorId() {
+		return floorId;
+	}
+
+	public void setFloorId(Integer floorId) {
+		this.floorId = floorId;
+	}
+
+	public Integer getProductId() {
+		return productId;
+	}
+
+	public void setProductId(Integer productId) {
+		this.productId = productId;
+	}
+
+	public Integer getValidFlag() {
+		return validFlag;
+	}
+
+	public void setValidFlag(Integer validFlag) {
+		this.validFlag = validFlag;
+	}
+
+	public Integer getRecommend() {
+		return recommend;
+	}
+
+	public void setRecommend(Integer recommend) {
+		this.recommend = recommend;
+	}
+
+	public String getSort() {
+		return sort;
+	}
+
+	public void setSort(String sort) {
+		this.sort = sort;
+	}
+
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+
+	public String getProductName() {
+		return productName;
+	}
+
+	public void setProductName(String productName) {
+		this.productName = productName;
+	}
+
+	public String getMainImage() {
+		return mainImage;
+	}
+
+	public void setMainImage(String mainImage) {
+		this.mainImage = mainImage;
+	}
+}

+ 0 - 19
src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java

@@ -18,8 +18,6 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
 
     private static final long serialVersionUID = 1L;
     private Integer productId;        // 对应采美商品id
-    private Integer sort;        // 排序值
-    private String recommend;        // 是否为推荐商品(0 没推荐,1 推荐商品)
     private String validFlag;        // 上架状态:1上架,2下架
     private BigDecimal price;        // 售价
     private String includedTax;        // 是否含税 0不含税,1含税
@@ -51,23 +49,6 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
         this.productId = productId;
     }
 
-    public Integer getSort() {
-        return sort;
-    }
-
-    public void setSort(Integer sort) {
-        this.sort = sort;
-    }
-
-    @Length(min = 0, max = 2, message = "是否为推荐商品(0 没推荐,1 推荐商品)长度必须介于 0 和 2 之间")
-    public String getRecommend() {
-        return recommend;
-    }
-
-    public void setRecommend(String recommend) {
-        this.recommend = recommend;
-    }
-
     @Length(min = 0, max = 2, message = "上架状态:1上架,2下架长度必须介于 0 和 2 之间")
     public String getValidFlag() {
         return validFlag;

+ 107 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheFloorProductService.java

@@ -0,0 +1,107 @@
+package com.caimei.modules.hehe.service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.caimei.utils.StringUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct;
+import com.caimei.modules.hehe.dao.CmHeheFloorProductDao;
+
+import javax.annotation.Resource;
+
+/**
+ * 呵呵商城楼层商品Service
+ * @author Aslee
+ * @version 2021-06-18
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheFloorProductService extends CrudService<CmHeheFloorProductDao, CmHeheFloorProduct> {
+	@Resource
+	private CmHeheFloorProductDao cmHeheFloorProductDao;
+
+	public CmHeheFloorProduct get(String id) {
+		return super.get(id);
+	}
+	
+	public List<CmHeheFloorProduct> findList(CmHeheFloorProduct cmHeheFloorProduct) {
+		return super.findList(cmHeheFloorProduct);
+	}
+	
+	public Page<CmHeheFloorProduct> findPage(Page<CmHeheFloorProduct> page, CmHeheFloorProduct cmHeheFloorProduct) {
+		Page<CmHeheFloorProduct> productPage = super.findPage(page, cmHeheFloorProduct);
+		List<CmHeheFloorProduct> productList = productPage.getList();
+		String wwwServer = Global.getConfig("wwwServer");
+		productList.forEach(item -> {
+			if (StringUtil.isNotBlank(item.getMainImage())) {
+				item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+			}
+		});
+		return productPage;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmHeheFloorProduct cmHeheFloorProduct) {
+		super.save(cmHeheFloorProduct);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmHeheFloorProduct cmHeheFloorProduct) {
+		super.delete(cmHeheFloorProduct);
+	}
+
+	@Transactional(readOnly = false)
+	public void saveSort(String sort, String id) {
+		cmHeheFloorProductDao.updateSort(sort, id);
+	}
+
+	public Page<Product> findProductPage(Page<Product> productPage, Product product) {
+		List<Integer> ids = cmHeheFloorProductDao.findFloorProductId();
+		product.setIds(ids);
+		product.setPage(productPage);
+		List<Product> productList = cmHeheFloorProductDao.findAllProduct(product);
+		String wwwServer = Global.getConfig("wwwServer");
+		productList.forEach(item -> {
+			if (StringUtil.isNotBlank(item.getMainImage())) {
+				item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+			}
+		});
+		productPage.setList(productList);
+		return productPage;
+	}
+
+	@Transactional(readOnly = false)
+	public Map<String, Object> addProduct(CmHeheFloorProduct cmHeheFloorProduct) {
+		HashMap<String, Object> map = new HashMap<>();
+		String productIds = cmHeheFloorProduct.getProductIds();
+		if (StringUtils.isNotEmpty(productIds)) {
+			String[] split = productIds.split(",");
+			for (int i = 0; i < split.length; i++) {
+				Integer productId = Integer.parseInt(split[i]);
+				CmHeheFloorProduct newProduct = new CmHeheFloorProduct();
+				newProduct.setProductId(productId);
+				newProduct.setFloorId(cmHeheFloorProduct.getFloorId());
+				newProduct.setRecommend(0);
+				newProduct.setSort(1);
+				newProduct.setValidFlag(1);
+				newProduct.setAddTime(new Date());
+				super.save(newProduct);
+			}
+		}
+		map.put("success", true);
+		map.put("msg", "添加楼层商品成功");
+		return map;
+	}
+}

+ 64 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheFloorService.java

@@ -0,0 +1,64 @@
+package com.caimei.modules.hehe.service;
+
+import java.util.List;
+
+import com.caimei.modules.hehe.entity.CmHeheFloor;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct1;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.thinkgem.jeesite.common.config.Global;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.caimei.modules.hehe.dao.CmHeheFloorDao;
+
+import javax.annotation.Resource;
+
+/**
+ * 呵呵商品商品楼层Service
+ * @author Aslee
+ * @version 2021-06-17
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheFloorService extends CrudService<CmHeheFloorDao, CmHeheFloor> {
+    @Resource
+    private CmHeheFloorDao cmHeheFloorDao;
+
+	public CmHeheFloor get(String id) {
+		return super.get(id);
+	}
+	
+	public List<CmHeheFloor> findList(CmHeheFloor cmHeheFloor) {
+		return super.findList(cmHeheFloor);
+	}
+	
+	public Page<CmHeheFloor> findPage(Page<CmHeheFloor> page, CmHeheFloor cmHeheFloor) {
+		return super.findPage(page, cmHeheFloor);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmHeheFloor cmHeheFloor) {
+		super.save(cmHeheFloor);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmHeheFloor cmHeheFloor) {
+		super.delete(cmHeheFloor);
+	}
+
+	public Page<CmHeheFloorProduct1> findProductPage(Page<CmHeheFloorProduct1> page, CmHeheFloorProduct1 floorProduct) {
+		floorProduct.setPage(page);
+		List<CmHeheFloorProduct1> productList = cmHeheFloorDao.getProductList(floorProduct);
+		String wwwServer = Global.getConfig("wwwServer");
+		productList.forEach(item -> {
+			if (StringUtil.isNotBlank(item.getMainImage())) {
+				item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+			}
+		});
+		page.setList(productList);
+		return page;
+	}
+}

+ 1 - 13
src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java

@@ -85,10 +85,7 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
         return productPage;
     }
 
-    @Transactional(readOnly = false)
-    public void saveSort(String sort, String id) {
-        cmHeheProductDao.saveSort(sort, id);
-    }
+
 
     @Transactional(readOnly = false)
     public void updateValidFlag(CmHeheProduct cmHeheProduct) {
@@ -100,13 +97,4 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
         cmHeheProductDao.update(cmHeheProduct);
     }
 
-    @Transactional(readOnly = false)
-    public void updateRecommend(CmHeheProduct cmHeheProduct) {
-        if ("0".equals(cmHeheProduct.getRecommend())) {
-            cmHeheProduct.setRecommend("1");
-        } else {
-            cmHeheProduct.setRecommend("0");
-        }
-        cmHeheProductDao.update(cmHeheProduct);
-    }
 }

+ 164 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheFloorController.java

@@ -0,0 +1,164 @@
+package com.caimei.modules.hehe.web;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.hehe.dao.CmHeheFloorDao;
+import com.caimei.modules.hehe.entity.CmHeheFloor;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct1;
+import com.google.common.collect.Maps;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.caimei.modules.hehe.service.CmHeheFloorService;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 呵呵商品商品楼层Controller
+ * @author Aslee
+ * @version 2021-06-17
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheFloor")
+public class CmHeheFloorController extends BaseController {
+
+	@Autowired
+	private CmHeheFloorService cmHeheFloorService;
+
+	@Resource
+	private CmHeheFloorDao cmHeheFloorDao;
+	
+	@ModelAttribute
+	public CmHeheFloor get(@RequestParam(required=false) String id) {
+		CmHeheFloor entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmHeheFloorService.get(id);
+		}
+		if (entity == null){
+			entity = new CmHeheFloor();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(CmHeheFloor cmHeheFloor, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmHeheFloor> page = cmHeheFloorService.findPage(new Page<CmHeheFloor>(request, response), cmHeheFloor);
+		model.addAttribute("page", page);
+		return "modules/hehe/cmHeheFloorList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(CmHeheFloor cmHeheFloor, Model model) {
+		model.addAttribute("cmHeheFloor", cmHeheFloor);
+		return "modules/hehe/cmHeheFloorForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(CmHeheFloor cmHeheFloor, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmHeheFloor)){
+			return form(cmHeheFloor, model);
+		}
+		if (cmHeheFloor.getIsNewRecord()) {
+			cmHeheFloor.setCreateTime(new Date());
+		}
+		cmHeheFloorService.save(cmHeheFloor);
+		addMessage(redirectAttributes, "保存商品楼层成功");
+		return "redirect:"+Global.getAdminPath()+"/hehe/cmHeheFloor/?repage";
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(CmHeheFloor cmHeheFloor, RedirectAttributes redirectAttributes) {
+		cmHeheFloorService.delete(cmHeheFloor);
+		addMessage(redirectAttributes, "删除商品楼层成功");
+		return "redirect:"+Global.getAdminPath()+"/hehe/cmHeheFloor/?repage";
+	}
+
+	@RequestMapping(value = "updateStatus")
+	@ResponseBody
+	public Map<String,Object> updateStatus(Integer status, Integer floorId) {
+		HashMap<String, Object> result = new HashMap<>(2);
+		cmHeheFloorDao.updateStatusByFloorId(status, floorId);
+		result.put("success", true);
+		result.put("msg", (status == 1 ? "启用" : "停用") + "商品楼层成功");
+		return result;
+	}
+
+
+	/**
+	 * 批量更新排序值
+	 */
+	@RequestMapping(value = "batchSaveSort")
+	@ResponseBody
+	public Map<String, Object> batchSaveSort(String sortList) {
+		Map<String, Object> map = Maps.newLinkedHashMap();
+		try {
+			String[] newPageLists = sortList.split(",");
+			for (String list : newPageLists) {
+				String[] split = list.split("-");
+				if (split.length == 1 || split.length < 1) {
+					String id = split[0];
+					String sort = null;
+					cmHeheFloorDao.saveSort(sort, id);
+				} else {
+					String id = split[0];
+					String sort = split[1];
+					if (isInteger(sort)) {
+						if (StringUtils.equals("0", sort)) {
+							map.put("success", false);
+							map.put("msg", "排序值只能填写大于等于1的整数");
+							return map;
+						}
+						cmHeheFloorDao.saveSort(sort, id);
+					} else {
+						map.put("success", false);
+						map.put("msg", "排序值只能为数字");
+						return map;
+					}
+				}
+			}
+			map.put("success", true);
+			map.put("msg", "更新排序成功");
+			return map;
+		} catch (Exception e) {
+			map.put("success", false);
+			map.put("msg", "更新排序失败");
+			return map;
+		}
+	}
+
+	/**
+	 * 楼层商品列表
+	 */
+	@RequestMapping(value = "productList")
+	public String productList(CmHeheFloorProduct1 floorProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmHeheFloorProduct1> page = cmHeheFloorService.findProductPage(new Page<CmHeheFloorProduct1>(request, response), floorProduct);
+		model.addAttribute("floorProduct", floorProduct);
+		model.addAttribute("page", page);
+		return "modules/hehe/cmHeheFloorProductList";
+	}
+
+	/**
+	 * 添加楼层商品
+	 */
+	@RequestMapping(value = "addProduct")
+	public void addProduct(Integer floorId, Integer productId) {
+
+	}
+
+}

+ 140 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheFloorProductController.java

@@ -0,0 +1,140 @@
+package com.caimei.modules.hehe.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.product.entity.Product;
+import com.google.common.collect.Maps;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct;
+import com.caimei.modules.hehe.service.CmHeheFloorProductService;
+
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 呵呵商城楼层商品Controller
+ * @author Aslee
+ * @version 2021-06-18
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheFloorProduct")
+public class CmHeheFloorProductController extends BaseController {
+
+	@Autowired
+	private CmHeheFloorProductService cmHeheFloorProductService;
+	
+	@ModelAttribute
+	public CmHeheFloorProduct get(@RequestParam(required=false) String id) {
+		CmHeheFloorProduct entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmHeheFloorProductService.get(id);
+		}
+		if (entity == null){
+			entity = new CmHeheFloorProduct();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(CmHeheFloorProduct cmHeheFloorProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmHeheFloorProduct> page = cmHeheFloorProductService.findPage(new Page<CmHeheFloorProduct>(request, response), cmHeheFloorProduct); 
+		model.addAttribute("page", page);
+		return "modules/hehe/cmHeheFloorProductList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(CmHeheFloorProduct cmHeheFloorProduct, Model model) {
+		model.addAttribute("cmHeheFloorProduct", cmHeheFloorProduct);
+		return "modules/hehe/cmHeheFloorProductForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(CmHeheFloorProduct cmHeheFloorProduct, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmHeheFloorProduct)){
+			return form(cmHeheFloorProduct, model);
+		}
+		cmHeheFloorProductService.save(cmHeheFloorProduct);
+		addMessage(redirectAttributes, "保存楼层商品成功");
+		return "redirect:"+Global.getAdminPath()+"/hehe/cmHeheFloorProduct/?repage&floorId=" + cmHeheFloorProduct.getFloorId();
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(CmHeheFloorProduct cmHeheFloorProduct, RedirectAttributes redirectAttributes) {
+		cmHeheFloorProductService.delete(cmHeheFloorProduct);
+		addMessage(redirectAttributes, "删除楼层商品成功");
+		return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheFloorProduct/?repage&floorId=" + cmHeheFloorProduct.getFloorId();
+	}
+
+
+	/**
+	 * 批量更新排序值
+	 */
+	@RequestMapping(value = "batchSaveSort")
+	@ResponseBody
+	public Map<String, Object> batchSaveSort(String sortList) {
+		Map<String, Object> map = Maps.newLinkedHashMap();
+		try {
+			String[] newPageLists = sortList.split(",");
+			for (String list : newPageLists) {
+				String[] split = list.split("-");
+				if (split.length == 1 || split.length < 1) {
+					String id = split[0];
+					String sort = null;
+					cmHeheFloorProductService.saveSort(sort, id);
+				} else {
+					String id = split[0];
+					String sort = split[1];
+					if (isInteger(sort)) {
+						if (StringUtils.equals("0", sort)) {
+							map.put("success", false);
+							map.put("msg", "排序值只能填写大于等于1的整数");
+							return map;
+						}
+						cmHeheFloorProductService.saveSort(sort, id);
+					} else {
+						map.put("success", false);
+						map.put("msg", "排序值只能为数字");
+						return map;
+					}
+				}
+			}
+			map.put("success", true);
+			map.put("msg", "更新排序成功");
+			return map;
+		} catch (Exception e) {
+			e.printStackTrace();
+			map.put("success", false);
+			map.put("msg", "更新排序失败");
+			return map;
+		}
+	}
+
+	@RequestMapping(value = "findProductPage")
+	public String findProductPage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+		Page<Product> page = cmHeheFloorProductService.findProductPage(new Page<Product>(request, response), product);
+		model.addAttribute("page", page);
+		return "modules/hehe/addFloorProduct";
+	}
+
+	@RequestMapping(value = "addProduct")
+	public Map<String,Object> addProduct(CmHeheFloorProduct cmHeheFloorProduct) {
+		return cmHeheFloorProductService.addProduct(cmHeheFloorProduct);
+	}
+
+}

+ 0 - 51
src/main/java/com/caimei/modules/hehe/web/CmHeheProductController.java

@@ -88,48 +88,6 @@ public class CmHeheProductController extends BaseController {
         return "modules/hehe/heheAddProduct";
     }
 
-    /**
-     * 批量更新排序值
-     */
-    @RequestMapping(value = "batchSaveSort")
-    @ResponseBody
-    public Map<String, Object> batchSaveSort(String sortList) {
-        Map<String, Object> map = Maps.newLinkedHashMap();
-        try {
-            String[] newPageLists = sortList.split(",");
-            for (String list : newPageLists) {
-                String[] split = list.split("-");
-                if (split.length == 1 || split.length < 1) {
-                    String id = split[0];
-                    String sort = null;
-                    cmHeheProductService.saveSort(sort, id);
-                } else {
-                    String id = split[0];
-                    String sort = split[1];
-                    if (isInteger(sort)) {
-                        if (StringUtils.equals("0", sort)) {
-                            map.put("success", false);
-                            map.put("msg", "排序值只能填写大于等于1的整数");
-                            return map;
-                        }
-                        cmHeheProductService.saveSort(sort, id);
-                    } else {
-                        map.put("success", false);
-                        map.put("msg", "排序值只能为数字");
-                        return map;
-                    }
-                }
-            }
-            map.put("success", true);
-            map.put("msg", "更新排序成功");
-            return map;
-        } catch (Exception e) {
-            map.put("success", false);
-            map.put("msg", "更新排序失败");
-            return map;
-        }
-    }
-
     /**
      * 商品上下架
      */
@@ -139,14 +97,5 @@ public class CmHeheProductController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheProduct/?repage";
     }
 
-    /**
-     * 商品修改推荐
-     */
-    @RequestMapping(value = "updateRecommend")
-    public String updateRecommend(CmHeheProduct cmHeheProduct) {
-        cmHeheProductService.updateRecommend(cmHeheProduct);
-        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheProduct/?repage";
-    }
-
 
 }

+ 10 - 1
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -180,6 +180,7 @@ public class Product extends DataEntity<Product> {
     private Integer organizeId; //组织Id
     private String productIdStr;//商品Id字符串格式
 
+
     //以下参数是搜索回显参数
     private String searchName;
     private String searchShopName;
@@ -200,7 +201,7 @@ public class Product extends DataEntity<Product> {
     private String editFlag;//编辑标记,1是编辑,其他都不是
     private String source;  //信息来源 1网站 2小程序 3后台 4小程序-协销
     private String dockingPeopleName; //对接人名称
-
+    private Integer floorId;//呵呵商城楼层id
 
     public String getProductIds() {
         return productIds;
@@ -1845,4 +1846,12 @@ public class Product extends DataEntity<Product> {
     public void setDockingPeopleName(String dockingPeopleName) {
         this.dockingPeopleName = dockingPeopleName;
     }
+
+    public Integer getFloorId() {
+        return floorId;
+    }
+
+    public void setFloorId(Integer floorId) {
+        this.floorId = floorId;
+    }
 }

+ 119 - 0
src/main/resources/mappings/modules/hehe/CmHeheFloorMapper.xml

@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.hehe.dao.CmHeheFloorDao">
+    
+	<sql id="cmHeheFloorColumns">
+		a.id AS "id",
+		a.title AS "title",
+		a.description AS "description",
+		a.sort AS "sort",
+		a.status AS "status",
+		a.createTime AS "createTime"
+	</sql>
+	
+	<sql id="cmHeheFloorJoins">
+	</sql>
+    
+	<select id="get" resultType="cmHeheFloor">
+		SELECT 
+			<include refid="cmHeheFloorColumns"/>
+		FROM cm_hehe_floor a
+		<include refid="cmHeheFloorJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="cmHeheFloor">
+		SELECT 
+			<include refid="cmHeheFloorColumns"/>
+		FROM cm_hehe_floor a
+		<include refid="cmHeheFloorJoins"/>
+		<where>
+			
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				order by a.sort asc,a.createTime desc
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="cmHeheFloor">
+		SELECT 
+			<include refid="cmHeheFloorColumns"/>
+		FROM cm_hehe_floor a
+		<include refid="cmHeheFloorJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="getProductList" resultType="com.caimei.modules.hehe.entity.CmHeheFloorProduct1">
+		select fp.id,fp.productId,p.mainImage, p.name as productName,fp.sort,fp.recommend,fp.addTime,fp.validFlag
+		from cm_hehe_floor_product fp
+		left join cm_hehe_product cp on fp.productId = cp.id
+		left join cm_hehe_floor cf on fp.floorId = cf.id
+		left join product p on cp.productId = p.productID
+		<where>
+			fp.floorId = #{floorId}
+			<if test="productId != null">
+				and cp.id = #{productId}
+			</if>
+			<if test="productName != null and productName != ''">
+				and p.productName like concat('%',#{productName},'%')
+			</if>
+			<if test="validFlag != null">
+				and fp.validFlag = #{validFlag}
+			</if>
+			<if test="recommend != null">
+				and fp.recommend = #{recommend}
+			</if>
+		</where>
+	</select>
+
+	<insert id="insert" parameterType="cmHeheFloor"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_floor(
+			title,
+			description,
+			sort,
+			status,
+			createTime
+		) VALUES (
+			#{title},
+			#{description},
+			#{sort},
+			#{status},
+		    #{createTime}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_hehe_floor SET
+			title = #{title},
+			description = #{description},
+			sort = #{sort},
+			status = #{status}
+		WHERE id = #{id}
+	</update>
+    <update id="updateStatusByFloorId">
+		update cm_hehe_floor set status = #{status} where id = #{floorId}
+	</update>
+	<update id="saveSort">
+		update cm_hehe_floor set sort = #{sort} where id = #{floorId}
+	</update>
+
+	<delete id="delete">
+		DELETE FROM cm_hehe_floor
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 154 - 0
src/main/resources/mappings/modules/hehe/CmHeheFloorProductMapper.xml

@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.hehe.dao.CmHeheFloorProductDao">
+    
+	<sql id="cmHeheFloorProductColumns">
+		a.id AS "id",
+		a.floorId,
+		a.productId,
+		a.validFlag,
+		a.recommend,
+		a.sort AS "sort",
+		a.addTime,
+		p.mainImage,
+		p.name as productName,
+		s.name as shopName
+	</sql>
+	
+	<sql id="cmHeheFloorProductJoins">
+		left join cm_hehe_product cp on a.productId = cp.id
+		left join cm_hehe_floor cf on a.floorId = cf.id
+		left join product p on cp.productId = p.productID
+		left join shop s on p.shopID = s.shopID
+	</sql>
+
+
+	<update id="updateSort">
+		update cm_hehe_floor_product set sort = #{sort} where id = #{id}
+	</update>
+
+	<select id="get" resultType="cmHeheFloorProduct">
+		SELECT 
+			<include refid="cmHeheFloorProductColumns"/>
+		FROM cm_hehe_floor_product a
+		<include refid="cmHeheFloorProductJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="cmHeheFloorProduct">
+		SELECT 
+			<include refid="cmHeheFloorProductColumns"/>
+		FROM cm_hehe_floor_product a
+		<include refid="cmHeheFloorProductJoins"/>
+		<where>
+			a.floorId = #{floorId}
+			<if test="productId != null">
+				and cp.id = #{productId}
+			</if>
+			<if test="productName != null and productName != ''">
+				and p.name like concat('%',#{productName},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				and s.name like concat('%',#{shopName},'%')
+			</if>
+			<if test="validFlag != null">
+				and a.validFlag = #{validFlag}
+			</if>
+			<if test="recommend != null">
+				and a.recommend = #{recommend}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				order by a.sort asc,a.addTime desc,a.productId desc
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="cmHeheFloorProduct">
+		SELECT 
+			<include refid="cmHeheFloorProductColumns"/>
+		FROM cm_hehe_floor_product a
+		<include refid="cmHeheFloorProductJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	<select id="findFloorProductId" resultType="java.lang.Integer">
+		select productId from cm_hehe_floor_product
+	</select>
+	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+		select hp.id as productID,p.mainImage,p.name,s.name as shopName
+		       from cm_hehe_product hp left join product p on hp.productId = p.productID
+				left join shop s on p.shopID = s.shopID
+		<where>
+			<if test="productID != null" >
+				AND hp.id = #{productID}
+			</if>
+			<if test="name != null and name != ''">
+				AND p.name LIKE concat('%',#{name},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE concat('%',#{shopName},'%')
+			</if>
+			<if test="ids != null and ids.size() > 0 ">
+				AND hp.id NOT IN
+				<foreach collection="ids" open="(" close=")" item="id" separator=",">
+					#{id}
+				</foreach>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				order by hp.id
+			</otherwise>
+		</choose>
+	</select>
+
+
+	<insert id="insert" parameterType="cmHeheFloorProduct"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_floor_product(
+			floorId, productId, validFlag, recommend, sort, addTime
+		) VALUES (
+			#{floorId},
+			#{productId},
+			#{validFlag},
+			#{recommend},
+		    #{sort},
+		    #{addTime}
+		)
+	</insert>
+
+
+	<update id="update" parameterType="cmHeheFloorProduct">
+		update cm_hehe_floor_product set validFlag = #{validFlag},recommend = #{recommend},sort = #{sort}
+		where id = #{id}
+	</update>
+
+<!--    <update id="updateStatusByFloorId">-->
+<!--		update cm_hehe_floor_product set status = #{status} where id = #{floorId}-->
+<!--	</update>-->
+<!--	-->
+<!--	<update id="saveSort">-->
+<!--		update cm_hehe_floor_product set sort = #{sort} where id = #{floorId}-->
+<!--	</update>-->
+
+	<delete id="delete">
+		DELETE FROM cm_hehe_floor_product
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 2 - 16
src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml

@@ -5,8 +5,6 @@
 	<sql id="cmHeheProductColumns">
 		a.id AS "id",
 		a.productId AS "productId",
-		a.sort AS "sort",
-		a.recommend AS "recommend",
 		a.validFlag AS "validFlag",
 		a.price AS "price",
 		a.includedTax AS "includedTax",
@@ -62,16 +60,13 @@
 			<if test="shopName != null and shopName != ''">
 				AND s.name LIKE CONCAT('%',#{shopName},'%')
 			</if>
-			<if test="recommend != null and recommend != ''">
-				AND a.recommend = #{recommend}
-			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
 			</when>
 			<otherwise>
-				ORDER BY -sort DESC
+				ORDER BY addTime DESC
 			</otherwise>
 		</choose>
 	</select>
@@ -96,8 +91,6 @@
 	<insert id="insert" parameterType="CmHeheProduct"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_hehe_product(
 			productId,
-			sort,
-			recommend,
 			validFlag,
 			price,
 			includedTax,
@@ -107,8 +100,6 @@
 			addTime
 		) VALUES (
 			#{productId},
-			#{sort},
-			#{recommend},
 			#{validFlag},
 			#{price},
 			#{includedTax},
@@ -122,8 +113,6 @@
 	<update id="update">
 		UPDATE cm_hehe_product SET 	
 			productId = #{productId},
-			sort = #{sort},
-			recommend = #{recommend},
 			validFlag = #{validFlag},
 			price = #{price},
 			includedTax = #{includedTax},
@@ -174,10 +163,7 @@
 		</choose>
 	</select>
 
-	<update id="saveSort">
-		UPDATE cm_hehe_product SET sort = #{sort} WHERE id = #{id}
-	</update>
-	
+
 	<update id="deleteActivityProduct">
 		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE productId = #{productId}
 	</update>

+ 118 - 0
src/main/webapp/WEB-INF/views/modules/hehe/addFloorProduct.jsp

@@ -0,0 +1,118 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>选择商品</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i {
+            margin: 0 2px;
+        }
+    </style>
+
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#searchForm").validate({
+                submitHandler: function (form) {
+                    var isSubMitFlag = true;
+                    var productID = $("#productID").val();
+                    if (isNaN(productID) || productID.indexOf('0') == 0 ) {
+                        alertx("请输入正确的商品ID");
+                        isSubMitFlag = false;
+                        return false;
+                    }
+                    if (isSubMitFlag) {
+                        form.submit();
+                    }
+                }
+            })
+        });
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="product" action="${ctx}/hehe/cmHeheFloorProduct/findProductPage?floorId=${product.floorId}" method="post"
+           class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini" onkeyup="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp;  <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+    <form:hidden path="floorId"/>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"><input type="checkbox" name="info" onclick="clickAllSelect(this)" /></th>
+        <th>商品ID</th>
+        <th>商品图片</th>
+        <th>商品名称</th>
+        <th>供应商名称</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.productID}" class="itemtr">
+                <th>
+                    <input class="check-item" type="checkbox" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img class="mainImage" src="${item.mainImage}" width="50px" height="50px"></td>
+                <td class="name">${item.name}</td>
+                <td id="shopName">${item.shopName}</td>
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty  page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+<script type="text/javascript">
+    $(document).ready(function () {
+        //弹出框去滚动条
+        top.$('#jbox-content').css("overflow-y", "hidden");
+        show_title(30);
+    });
+
+    function page(n, s) {
+        $("#pageNo").val(n);
+        $("#pageSize").val(s);
+        $("#searchForm").submit();
+        return false;
+    }
+
+    function getCheckedItems() {
+        debugger
+        var productIds = '';
+        var $items = $('.check-item:checked');
+        $items.each(function () {
+            productIds += $(this).val()+",";
+        });
+
+        return productIds;
+    }
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>
+

+ 78 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorForm.jsp

@@ -0,0 +1,78 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>商品楼层管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/cmHeheFloor/">商品楼层列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheFloor/form?id=${cmHeheFloor.id}">商品楼层${not empty cmHeheFloor.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmHeheFloor" action="${ctx}/hehe/cmHeheFloor/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>		
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>楼层标题:</label>
+			<div class="controls">
+				<form:input path="title" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>楼层描述:</label>
+			<div class="controls">
+				<form:input path="description" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序:</label>
+			<div class="controls">
+				<form:input path="sort" htmlEscape="false" onkeyup="onlynum(this)" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>状态:</label>
+			<div class="controls">
+				<form:select path="status" class="input-xlarge required">
+					<form:option value="1">启用</form:option>
+					<form:option value="0">停用</form:option>
+				</form:select>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+<script>
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 145 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorList.jsp

@@ -0,0 +1,145 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>商品楼层管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/hehe/cmHeheFloor/">商品楼层列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheFloor" action="${ctx}/hehe/cmHeheFloor/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序" />
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 70px" onclick="window.location='${ctx}/hehe/cmHeheFloor/form'" value="添加楼层" />
+			<div class="clearfix"></div>
+		</div>
+		<div style="margin-top: 10px">
+			<label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>ID</th>
+				<th>楼层标题</th>
+				<th>描述</th>
+				<th>排序</th>
+				<th>状态</th>
+				<th>创建时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmHeheFloor">
+			<tr>
+				<input class="check-item" type="hidden" id="saveSort${cmHeheFloor.id}" value='${cmHeheFloor.id}-${cmHeheFloor.sort}'/>
+				<td>
+					${cmHeheFloor.id}
+				</td>
+				<td>
+					${cmHeheFloor.title}
+				</td>
+				<td>
+					${cmHeheFloor.description}
+				</td>
+				<td>
+					<input id="sort" name="sort" style="width:50px;" value="${cmHeheFloor.sort}"  onkeyup="onlynum(this)"  onchange="changeSort(${cmHeheFloor.id},this)">
+				</td>
+				<td>
+					<c:if test="${cmHeheFloor.status eq 1 }">
+						<font color="green">已启用</font>
+						<a href="javascript:void(0);" onclick="updateStatus(0,${cmHeheFloor.id});" >
+							停用
+						</a>
+					</c:if>
+					<c:if test="${cmHeheFloor.status ne 1 }">
+						<font color="red">已停用</font>
+						<a href="javascript:void(0)" onclick="updateStatus(1,${cmHeheFloor.id});">
+							启用
+						</a>
+					</c:if>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheFloor.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/hehe/cmHeheFloor/form?id=${cmHeheFloor.id}">编辑</a>
+    				<a href="${ctx}/hehe/cmHeheFloorProduct/list?floorId=${cmHeheFloor.id}">商品列表</a>
+					<a href="${ctx}/hehe/cmHeheFloor/delete?id=${cmHeheFloor.id}" onclick="return confirmx('确认要删除该商品楼层吗?', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+<script>
+	function updateStatus(status, floorId) {
+		var msg='确定启用该楼层吗?';
+		if(0==status) {
+			msg = '确定停用该楼层吗?';
+		}
+		top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+			if(v=='ok'){
+				$.post("${ctx}/hehe/cmHeheFloor/updateStatus",{'status':status,'floorId':floorId}, function(data) {
+					if(true==data.success){
+						$.jBox.tip(data.msg, 'info');
+					} else {
+						$.jBox.tip(data.msg,'error');
+					}
+					setTimeout(function () {
+						$("#searchForm").submit();
+					},1000)
+				},"JSON");//这里返回的类型有:json,html,xml,text
+			}
+			return;
+		},{buttonsFocus:1,persistent: true});
+	}
+
+	//批量保存排序
+	function batchSaveSort() {
+		var items = new Array();
+		var $items = $('.check-item');
+		$items.each(function(){
+			items.push($(this).val());
+		});
+		//保存批量排序
+		$.post("${ctx}/hehe/cmHeheFloor/batchSaveSort?sortList="+items, function(data) {
+			if(true==data.success){
+				$.jBox.tip(data.msg, 'info');
+				setTimeout(function () {
+					window.location.href = '${ctx}/hehe/cmHeheFloor';
+				},1000)
+			} else {
+				$.jBox.tip(data.msg,'error');
+			}
+		},"JSON");//这里返回的类型有:json,html,xml,text
+	}
+
+	//修改排序值
+	function changeSort(id,sortThis) {
+		var value = sortThis.value;
+		$("#saveSort"+id).val(id+"-"+value);
+	}
+</script>
+</body>
+</html>

+ 197 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorProductList.jsp

@@ -0,0 +1,197 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵商品管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/cmHeheFloor/">商品楼层列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheFloorProduct/list?floorId=${cmHeheFloorProduct.floorId}">商品列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheFloorProduct" action="${ctx}/hehe/cmHeheFloorProduct/list" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			<form:hidden path="floorId"/>
+			 <label>商品ID:</label>
+				<form:input path="productId" htmlEscape="false" class="input-medium"/>
+			<label>商品名称:</label>
+				<form:input path="productName" htmlEscape="false" class="input-medium"/>
+			<label>供应商名称:</label>
+				<form:input path="shopName" htmlEscape="false" class="input-medium"/>
+			 <label>商品状态:</label>
+				<form:select path="validFlag" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="已上架"/>
+					<form:option value="0" label="已下架"/>
+				</form:select>
+			<label>推荐状态:</label>
+			<form:select path="recommend" class="input-small">
+				<form:option value="" label="请选择"/>
+				<form:option value="1" label="推荐"/>
+				<form:option value="0" label="不推荐"/>
+			</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="showSelect()" value="上线商品"/>
+			<div class="clearfix"></div>
+		</div>
+		<div style="margin-top: 10px">
+			<label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>商品ID</th>
+				<th>商品图片</th>
+				<th>商品名称</th>
+				<th>供应商名称</th>
+				<th>商品状态</th>
+				<th>排序</th>
+				<th>推荐状态</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="product">
+			<tr>
+				<input class="check-item" type="hidden" id="preferredProductSort${product.id}" value='${product.id}-${product.sort}'/>
+				<td>
+					${product.productId}
+				</td>
+				<td>
+					<img src="${product.mainImage}" width="50px" height="50px">
+				</td>
+				<td>
+						${product.productName}
+				</td>
+				<td>
+						${product.shopName}
+				</td>
+				<td>
+					<c:if test="${product.validFlag eq 1}">
+						<font color="green"><b>已上架</b></font>
+					</c:if>
+					<c:if test="${product.validFlag eq 0}">
+						<font color="red"><b>已下架</b></font>
+					</c:if>
+				</td>
+				<td>
+					<input id="sort" name="sort" style="width:50px;" value="${product.sort}" onkeyup="onlynum(this)" onchange="changeSort(${product.id},this)">
+				</td>
+				<td>
+					<img src="/static/images/${product.recommend eq "1" ? "yes" : "no"}.gif" width="15px" border="none"/>
+				</td>
+
+				<td>
+					<fmt:formatDate value="${product.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<a href="${ctx}/hehe/cmHeheFloorProduct/save?id=${product.id}&validFlag=${product.validFlag eq 1?0:1}&floorId=${product.floorId}" onclick="return confirmx('确认要${product.validFlag eq 1 ? "下架":"上架"}该商品吗?', this.href)">${product.validFlag eq 1 ? '下架':'上架'}</a>
+					<a href="${ctx}/hehe/cmHeheFloorProduct/save?id=${product.id}&recommend=${product.recommend eq 1?0:1}&floorId=${product.floorId}" onclick="return confirmx('${product.recommend eq 0 ? "确定将该商品设为推荐商品吗?":"确定取消推荐吗?"}', this.href)">${product.recommend eq 0 ? '设为':'取消'}推荐</a>
+					<a href="${ctx}/hehe/cmHeheFloorProduct/delete?id=${product.id}" onclick="return confirmx('确认要删除该商品吗?', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+
+<script>
+	//修改排序值
+	function changeSort(id, sortThis) {
+		var value = sortThis.value;
+		$("#preferredProductSort" + id).val(id + "-" + value);
+	}
+
+	//批量保存排序
+	function batchSaveSort() {
+		debugger
+		var items = new Array();
+		var $items = $('.check-item');
+		$items.each(function(){
+			items.push($(this).val());
+		});
+		//保存批量排序
+		$.post("${ctx}/hehe/cmHeheFloorProduct/batchSaveSort?sortList="+items, function(data) {
+			if(true==data.success){
+				$.jBox.tip(data.msg, 'info');
+				$("#searchForm").submit();
+			} else {
+				$.jBox.tip(data.msg,'error');
+			}
+		},"JSON");//这里返回的类型有:json,html,xml,text
+	}
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+
+	/**
+	 *
+	 */
+	<%--function showSelect() {--%>
+	<%--	var url = '${ctx}/hehe/cmHeheFloorProduct/findProductPage?floorId=${cmHeheFloorProduct.floorId}';--%>
+	<%--	window.location=--%>
+	<%--}--%>
+
+	//选择添加商品
+	function showSelect() {
+		var title = '选择商品';
+		var floorId = ${cmHeheFloorProduct.floorId};
+		var productUrl = '${ctx}/hehe/cmHeheFloorProduct/findProductPage?floorId=${cmHeheFloorProduct.floorId}';
+		var addUrl = '${ctx}/hehe/cmHeheFloorProduct/addProduct';
+		title = "选择商品";
+		top.$.jBox("iframe:" + productUrl, {
+			iframeScrolling: 'yes',
+			width: $(top.document).width() - 600,
+			height: $(top.document).height() - 160,
+			persistent: true,
+			title: title,
+			buttons: {"确定": '1', "关闭": '-1'},
+			submit: function (v, h, f) {
+				//确定
+				var $jboxFrame = top.$('#jbox-iframe');
+				var $mainFrame = top.$('#mainFrame');
+				if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+					var productIds = $jboxFrame[0].contentWindow.getCheckedItems();
+					if (productIds != '') {
+						$.post(addUrl,{"floorId":floorId, "productIds":productIds},function (data) {
+						})
+						$.jBox.tip('上线商品成功', 'info');
+						setTimeout(function () {
+							$("#searchForm").submit();
+						},1000)
+					}
+				}
+				return true;
+			}
+		});
+	}
+</script>
+</body>
+</html>

+ 1 - 19
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductList.jsp

@@ -53,15 +53,7 @@
 					<form:option value="2" label="增值税普通发票"/>
 					<form:option value="3" label="不能开票"/>
 				</form:select>
-			<br><br>
-			<label>推荐状态:</label>
-			<form:select path="recommend" class="input-small">
-				<form:option value="" label="请选择"/>
-				<form:option value="0" label="不推荐"/>
-				<form:option value="1" label="推荐"/>
-			</form:select>
 			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
-			<input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
 			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheProduct/form'" value="上线商品"/>
 			<div class="clearfix"></div>
 		</div>
@@ -81,8 +73,6 @@
 				<th>成本价</th>
 				<th>是否含税</th>
 				<th>商品状态</th>
-				<th>排序值</th>
-				<th>推荐状态</th>
 				<th>添加时间</th>
 				<th>操作</th>
 			</tr>
@@ -90,7 +80,6 @@
 		<tbody>
 		<c:forEach items="${page.list}" var="cmHeheProduct">
 			<tr>
-				<input class="check-item" type="hidden" id="preferredProductSort${cmHeheProduct.id}" value='${cmHeheProduct.id}-${cmHeheProduct.sort}'/>
 				<td>
 					${cmHeheProduct.id}
 				</td>
@@ -121,19 +110,12 @@
 						<font color="red"><b>已下架</b></font>
 					</c:if>
 				</td>
-				<td>
-						<input id="sort" name="sort" style="width:50px;" value="${cmHeheProduct.sort}" onkeyup="onlynum(this)" onchange="changeSort(${cmHeheProduct.id},this)">
-				</td>
-				<td>
-					<img src="/static/images/${cmHeheProduct.recommend eq "1" ? "yes" : "no"}.gif" width="15px" border="none"/>
-				</td>
 				<td>
 					<fmt:formatDate value="${cmHeheProduct.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
 				</td>
 				<td>
     				<a href="${ctx}/hehe/cmHeheProduct/form?id=${cmHeheProduct.id}">编辑</a>
 					<a href="${ctx}/hehe/cmHeheProduct/updateValidFlag?id=${cmHeheProduct.id}" onclick="return confirmx('确认要${cmHeheProduct.validFlag eq 1 ? "下架":"上架"}该商品吗?', this.href)">${cmHeheProduct.validFlag eq 1 ? '下架':'上架'}</a>
-					<a href="${ctx}/hehe/cmHeheProduct/updateRecommend?id=${cmHeheProduct.id}" onclick="return confirmx('${cmHeheProduct.recommend eq 0 ? "确定将该商品设为推荐商品吗?":"确定取消推荐吗?"}', this.href)">${cmHeheProduct.recommend eq 0 ? '设为':'取消'}推荐</a>
 					<a href="${ctx}/hehe/cmHeheProduct/delete?id=${cmHeheProduct.id}" onclick="return confirmx('确认要删除该商品吗?', this.href)">删除</a>
 				</td>
 			</tr>
@@ -160,7 +142,7 @@
 		$.post("${ctx}/hehe/cmHeheProduct/batchSaveSort?sortList="+items, function(data) {
 			if(true==data.success){
 				$.jBox.tip(data.msg, 'info');
-				window.location.href = "${ctx}/hehe/cmHeheProduct";
+				$("#searchForm").submit();
 			} else {
 				$.jBox.tip(data.msg,'error');
 			}