Bläddra i källkod

呵呵商城改版part1

Aslee 3 år sedan
förälder
incheckning
5a3ca396bc

+ 15 - 0
src/main/java/com/caimei/modules/hehe/dao/HeheHomeTypeDao.java

@@ -0,0 +1,15 @@
+package com.caimei.modules.hehe.dao;
+
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.hehe.entity.HeheHomeType;
+
+/**
+ * 呵呵商城首页分类DAO接口
+ * @author Aslee
+ * @version 2022-03-18
+ */
+@MyBatisDao
+public interface HeheHomeTypeDao extends CrudDao<HeheHomeType> {
+	
+}

+ 74 - 0
src/main/java/com/caimei/modules/hehe/entity/HeheHomeType.java

@@ -0,0 +1,74 @@
+package com.caimei.modules.hehe.entity;
+
+import org.hibernate.validator.constraints.Length;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 呵呵商城首页分类Entity
+ * @author Aslee
+ * @version 2022-03-18
+ */
+public class HeheHomeType extends DataEntity<HeheHomeType> {
+	
+	private static final long serialVersionUID = 1L;
+	private String name;		// 分类名称
+	private String icon;		// 图标
+	private Integer sort;		// 排序值
+	private Integer status;		// 状态:0已下架,1已上架
+	private Date addTime;		// 添加时间
+	
+	public HeheHomeType() {
+		super();
+	}
+
+	public HeheHomeType(String id){
+		super(id);
+	}
+
+	@Length(min=0, max=45, message="分类名称长度必须介于 0 和 45 之间")
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@Length(min=0, max=255, message="图标长度必须介于 0 和 255 之间")
+	public String getIcon() {
+		return icon;
+	}
+
+	public void setIcon(String icon) {
+		this.icon = icon;
+	}
+
+	public Integer getSort() {
+		return sort;
+	}
+
+	public void setSort(Integer sort) {
+		this.sort = sort;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+	
+}

+ 70 - 0
src/main/java/com/caimei/modules/hehe/service/HeheHomeTypeService.java

@@ -0,0 +1,70 @@
+package com.caimei.modules.hehe.service;
+
+import java.util.List;
+
+import com.caimei.modules.product.entity.CmBigtype;
+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.HeheHomeType;
+import com.caimei.modules.hehe.dao.HeheHomeTypeDao;
+
+import javax.annotation.Resource;
+
+/**
+ * 呵呵商城首页分类Service
+ * @author Aslee
+ * @version 2022-03-18
+ */
+@Service
+@Transactional(readOnly = true)
+public class HeheHomeTypeService extends CrudService<HeheHomeTypeDao, HeheHomeType> {
+
+	@Resource
+	private HeheHomeTypeDao heheHomeTypeDao;
+
+	public HeheHomeType get(String id) {
+		return super.get(id);
+	}
+	
+	public List<HeheHomeType> findList(HeheHomeType heheHomeType) {
+		return super.findList(heheHomeType);
+	}
+	
+	public Page<HeheHomeType> findPage(Page<HeheHomeType> page, HeheHomeType heheHomeType) {
+		return super.findPage(page, heheHomeType);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(HeheHomeType heheHomeType) {
+		super.save(heheHomeType);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(HeheHomeType heheHomeType) {
+		super.delete(heheHomeType);
+	}
+
+	@Transactional(readOnly = false)
+	public int update(HeheHomeType homeType){
+		return heheHomeTypeDao.update(homeType);
+	}
+
+	@Transactional(readOnly = false)
+	public void updateSortIndex(String typeIdSortIndexs) {
+		if (typeIdSortIndexs.contains(",")) {
+			String[] typeIdSortIndexArr = typeIdSortIndexs.split(",");
+			for (int i = 0; i < typeIdSortIndexArr.length; i++) {
+				String[] typeIdSortIndex = typeIdSortIndexArr[i].split("_");
+				if (typeIdSortIndex.length == 2) {
+					HeheHomeType homeType = new HeheHomeType();
+					homeType.setId(typeIdSortIndex[0]);
+					homeType.setSort(Integer.parseInt(typeIdSortIndex[1]));
+					heheHomeTypeDao.update(homeType);
+				}
+			}
+		}
+	}
+}

+ 135 - 0
src/main/java/com/caimei/modules/hehe/web/HeheHomeTypeController.java

@@ -0,0 +1,135 @@
+package com.caimei.modules.hehe.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.product.entity.CmBigtype;
+import com.caimei.vo.JsonModel;
+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.HeheHomeType;
+import com.caimei.modules.hehe.service.HeheHomeTypeService;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * 呵呵商城首页分类Controller
+ * @author Aslee
+ * @version 2022-03-18
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/heheHomeType")
+public class HeheHomeTypeController extends BaseController {
+
+	@Autowired
+	private HeheHomeTypeService heheHomeTypeService;
+	
+	@ModelAttribute
+	public HeheHomeType get(@RequestParam(required=false) String id) {
+		HeheHomeType entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = heheHomeTypeService.get(id);
+		}
+		if (entity == null){
+			entity = new HeheHomeType();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(HeheHomeType heheHomeType, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<HeheHomeType> page = heheHomeTypeService.findPage(new Page<HeheHomeType>(request, response), heheHomeType); 
+		model.addAttribute("page", page);
+		return "modules/hehe/heheHomeTypeList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(HeheHomeType heheHomeType, Model model) {
+		if (StringUtils.isEmpty(heheHomeType.getId())) {
+			heheHomeType.setSort(1);
+		}
+		model.addAttribute("heheHomeType", heheHomeType);
+		return "modules/hehe/heheHomeTypeForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(HeheHomeType heheHomeType, Model model, RedirectAttributes redirectAttributes) {
+		/*if (StringUtils.isEmpty(heheHomeType.getIcon())) {
+			model.addAttribute("errorMsg", "请上传图标");
+			return form(heheHomeType, model);
+		}*/
+		if (!beanValidator(model, heheHomeType)){
+			return form(heheHomeType, model);
+		}
+		if (StringUtils.isEmpty(heheHomeType.getId())) {
+			heheHomeType.setStatus(1);
+			heheHomeType.setAddTime(new Date());
+		}
+		heheHomeTypeService.save(heheHomeType);
+		addMessage(redirectAttributes, "保存分类成功");
+		return "redirect:"+Global.getAdminPath()+"/hehe/heheHomeType/?repage";
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(HeheHomeType heheHomeType, RedirectAttributes redirectAttributes) {
+		heheHomeTypeService.delete(heheHomeType);
+		addMessage(redirectAttributes, "删除分类成功");
+		return "redirect:"+Global.getAdminPath()+"/hehe/heheHomeType/?repage";
+	}
+
+	/**
+	 * 批量更新排序
+	 * @param bigTypeIdSortIndexs
+	 * @return
+	 */
+	@RequestMapping(value = "updateSortIndex")
+	@ResponseBody
+	public JsonModel updateSortIndex(String bigTypeIdSortIndexs){
+		JsonModel jsonModel = JsonModel.newInstance();
+		heheHomeTypeService.updateSortIndex(bigTypeIdSortIndexs);
+		return jsonModel.success("批量更新排序成功");
+	}
+
+	/**
+	 * 修改状态
+	 * @param type
+	 * @param id
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value="updateStatus")
+	public Map<String, Object> updateStatus(Integer status, String id, String type, HttpServletRequest request, HttpServletResponse response){
+		Map<String, Object> map = Maps.newLinkedHashMap();
+		try {
+			HeheHomeType heheHomeType = heheHomeTypeService.get(id);
+			if(StringUtils.equals("status", type)){
+				heheHomeType.setStatus(status);
+			}
+			heheHomeTypeService.update(heheHomeType);
+			map.put("success",true);
+			map.put("msg", "修改成功");
+		} catch (Exception e) {
+			logger.debug(e.toString(),e);
+			map.put("success",false);
+			map.put("msg", "修改失败");
+		}
+		return map;
+	}
+
+}

+ 9 - 0
src/main/java/com/caimei/modules/product/entity/CmBigtype.java

@@ -15,6 +15,7 @@ public class CmBigtype extends  DataEntity<CmBigtype> {
 	private static final long serialVersionUID = 1L;
 	private String bigTypeID;		// bigTypeID
     private String typeSort;       // 分类类型,1产品,2仪器
+	private Integer mallType;		// 商城类型:1采美商城,2呵呵商城
 	private String name;		// name
 	private String bigTypeCode; //大分类编码
 	private String wwwValidFlag;		// www启用标识,0停用,1启用
@@ -114,4 +115,12 @@ public class CmBigtype extends  DataEntity<CmBigtype> {
     public void setCrmIcon(String crmIcon) {
         this.crmIcon = crmIcon;
     }
+
+	public Integer getMallType() {
+		return mallType;
+	}
+
+	public void setMallType(Integer mallType) {
+		this.mallType = mallType;
+	}
 }

+ 9 - 0
src/main/java/com/caimei/modules/product/entity/CmSmalltype.java

@@ -15,6 +15,7 @@ public class CmSmalltype extends DataEntity<CmSmalltype> {
 	private static final long serialVersionUID = 1L;
 	private String smallTypeID;		// smallTypeID
 	private String bigTypeID;		// 一级分类Id
+	private Integer mallType;		// 商城类型:1采美商城,2呵呵商城
 	private String name;		// 名称
 	private String smallTypeCode; //小分类编码
 	private String wwwValidFlag;		// www启用标识,0停用,1启用
@@ -126,4 +127,12 @@ public class CmSmalltype extends DataEntity<CmSmalltype> {
 	public void setTypeSort(String typeSort) {
 		this.typeSort = typeSort;
 	}
+
+	public Integer getMallType() {
+		return mallType;
+	}
+
+	public void setMallType(Integer mallType) {
+		this.mallType = mallType;
+	}
 }

+ 38 - 19
src/main/java/com/caimei/modules/product/web/CmBigtypeController.java

@@ -61,14 +61,19 @@ public class CmBigtypeController extends BaseController {
 	@RequiresPermissions("product:cmBigtype:view")
 	@RequestMapping(value = {"list", ""})
 	public String list(CmBigtype cmBigtype, HttpServletRequest request, HttpServletResponse response, Model model) {
+		cmBigtype.setMallType(null == cmBigtype.getMallType() ? 1 : cmBigtype.getMallType());
 		Page<CmBigtype> page = cmBigtypeService.findPage(new Page<CmBigtype>(request, response), cmBigtype);
 		model.addAttribute("page", page);
-		if ("1".equals(cmBigtype.getTypeSort())) {
-			return "modules/product/cmProductBigtypeList";
-		} else if ("2".equals(cmBigtype.getTypeSort())) {
-			return "modules/product/cmInstrumentBigtypeList";
-		} else {
-			return "modules/product/cmProductBigtypeList";
+		if (2 == cmBigtype.getMallType()) {
+			return "modules/hehe/cmHeheBigtypeList";
+		}else {
+			if ("1".equals(cmBigtype.getTypeSort())) {
+				return "modules/product/cmProductBigtypeList";
+			} else if ("2".equals(cmBigtype.getTypeSort())) {
+				return "modules/product/cmInstrumentBigtypeList";
+			} else {
+				return "modules/product/cmProductBigtypeList";
+			}
 		}
 	}
 
@@ -78,13 +83,19 @@ public class CmBigtypeController extends BaseController {
 		if(null == cmBigtype.getSortIndex()){
 			cmBigtype.setSortIndex(1);
 		}
+		cmBigtype.setMallType(null == cmBigtype.getMallType() ? 1 : cmBigtype.getMallType());
 		model.addAttribute("cmBigtype", cmBigtype);
-		return "modules/product/cmBigtypeForm";
+		if (2 == cmBigtype.getMallType()) {
+			return "modules/hehe/cmHeheBigtypeForm";
+		} else {
+			return "modules/product/cmBigtypeForm";
+		}
 	}
 
 	@RequiresPermissions("product:cmBigtype:edit")
 	@RequestMapping(value = "save")
 	public String save(CmBigtype cmBigtype, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+		cmBigtype.setMallType(null == cmBigtype.getMallType() ? 1 : cmBigtype.getMallType());
 		if (checkValidator(model, cmBigtype)){
 			return form(cmBigtype, model);
 		}
@@ -92,12 +103,14 @@ public class CmBigtypeController extends BaseController {
 			cmBigtype.setAddTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
 		}
 		cmBigtypeService.save(cmBigtype);
-		cleanRedisCache();
+		if (1 == cmBigtype.getMallType()) {
+			cleanRedisCache();
+		}
 //		if (flag){
 //			cmBigtypeService.mutiUpdateCode(cmBigtype.getBigTypeID());
 //		}
 		addMessage(redirectAttributes, "保存一级分类成功");
-		return "redirect:"+Global.getAdminPath()+"/product/cmBigtype/?repage&typeSort="+cmBigtype.getTypeSort();
+		return "redirect:" + Global.getAdminPath() + "/product/cmBigtype/?repage&typeSort=" + cmBigtype.getTypeSort() + "&mallType=" + cmBigtype.getMallType();
 	}
 
 	private boolean checkValidator(Model model, CmBigtype cmBigtype) {
@@ -108,34 +121,38 @@ public class CmBigtypeController extends BaseController {
 			model.addAttribute("errorMsg", "请输入分类名称!");
 			return true;
 		}
-		if(StringUtils.getStringLength(cmBigtype.getName())>16){
+		if(1 == cmBigtype.getMallType() && StringUtils.getStringLength(cmBigtype.getName())>16){
 			model.addAttribute("errorMsg", "名称过长!");
 			return true;
 		}
-		if (StringUtils.isEmpty(cmBigtype.getBigTypeCode())) {
+		if (1 == cmBigtype.getMallType() && StringUtils.isEmpty(cmBigtype.getBigTypeCode())) {
 			model.addAttribute("errorMsg", "请输入编码!");
 			return true;
 		}
-		if (null!=cmBigtype&&cmBigtype.getBigTypeID()==null&&cmBigtypeService.getByCode(cmBigtype.getBigTypeCode())!=null){
+		if (1 == cmBigtype.getMallType() && cmBigtype.getBigTypeID()==null&&cmBigtypeService.getByCode(cmBigtype.getBigTypeCode())!=null){
 			model.addAttribute("errorMsg", "大分类编码不能相同!");
 			return true;
 		}
-		if (StringUtils.isEmpty(cmBigtype.getWwwIcon())) {
+		if (1 == cmBigtype.getMallType() && StringUtils.isEmpty(cmBigtype.getWwwIcon())) {
 			model.addAttribute("errorMsg", "请上传网站图标!");
 			return true;
 		}
-		if (StringUtils.isEmpty(cmBigtype.getCrmIcon())) {
+		if (1 == cmBigtype.getMallType() && StringUtils.isEmpty(cmBigtype.getCrmIcon())) {
 			model.addAttribute("errorMsg", "请上传小程序图标!");
 			return true;
 		}
-		if (StringUtils.isEmpty(cmBigtype.getTypeSort())) {
+		if (null ==cmBigtype.getSortIndex()) {
 			model.addAttribute("errorMsg", "请输入排序值!");
 			return true;
 		}
-		if (Integer.parseInt(cmBigtype.getTypeSort()) <= 0) {
+		if (cmBigtype.getSortIndex() <= 0) {
 			model.addAttribute("errorMsg", "排序值只能输入大于0的正整数!");
 			return true;
 		}
+		if (1 == cmBigtype.getMallType() && StringUtils.isEmpty(cmBigtype.getTypeSort()) ) {
+			model.addAttribute("errorMsg", "请输入分类类型!");
+			return true;
+		}
 		return false;
 	}
 
@@ -180,13 +197,15 @@ public class CmBigtypeController extends BaseController {
 	 * @param redirectAttributes
 	 * @return
 	 */
-	@RequiresPermissions("product:cmBigtype:delete")
 	@RequestMapping(value = "delete")
 	public String delete(CmBigtype cmBigtype, RedirectAttributes redirectAttributes) {
+		cmBigtype.setMallType(null == cmBigtype.getMallType() ? 1 : cmBigtype.getMallType());
 		cmBigtypeService.delete(cmBigtype);
-		cleanRedisCache();
+		if (1 == cmBigtype.getMallType()) {
+			cleanRedisCache();
+		}
 		addMessage(redirectAttributes, "删除大分类成功");
-		return "redirect:"+Global.getAdminPath()+"/product/cmBigtype/?repage";
+		return "redirect:" + Global.getAdminPath() + "/product/cmBigtype/?repage&mallType=" + cmBigtype.getMallType();
 	}
 
 	/**

+ 43 - 23
src/main/java/com/caimei/modules/product/web/CmSmalltypeController.java

@@ -65,29 +65,40 @@ public class CmSmalltypeController extends BaseController {
 	@RequiresPermissions("product:cmSmalltype:view")
 	@RequestMapping(value = {"list", ""})
 	public String list(CmSmalltype cmSmalltype, HttpServletRequest request, HttpServletResponse response, Model model) {
+		cmSmalltype.setMallType(null == cmSmalltype.getMallType() ? 1 : cmSmalltype.getMallType());
 		Page<CmSmalltype> page = cmSmalltypeService.findPage(new Page<CmSmalltype>(request, response), cmSmalltype);
 		model.addAttribute("page", page);
 		CmBigtype cmBigtype = cmBigtypeService.get(cmSmalltype.getBigTypeID());
 		model.addAttribute("bigTypeID", cmSmalltype.getBigTypeID());
 		model.addAttribute("bigTypeName", cmBigtype.getName());
 		model.addAttribute("typeSort", cmSmalltype.getTypeSort());
-		return "modules/product/cmSmalltypeList";
+		if (2 == cmSmalltype.getMallType()) {
+			return "modules/hehe/cmHeheSmalltypeList";
+		} else {
+			return "modules/product/cmSmalltypeList";
+		}
 	}
 
 	@RequiresPermissions("product:cmSmalltype:view")
 	@RequestMapping(value = "form")
 	public String form(CmSmalltype cmSmalltype, Model model) {
+ 		cmSmalltype.setMallType(null == cmSmalltype.getMallType() ? 1 : cmSmalltype.getMallType());
 		if(null == cmSmalltype.getSortIndex()){
 			cmSmalltype.setSortIndex(1);
 		}
 		model.addAttribute("cmSmalltype", cmSmalltype);
 		model.addAttribute("bigTypeID", cmSmalltype.getBigTypeID());
-		return "modules/product/cmSmalltypeForm";
+		if (2 == cmSmalltype.getMallType()) {
+			return "modules/hehe/cmHeheSmalltypeForm";
+		} else {
+			return "modules/product/cmSmalltypeForm";
+		}
 	}
 
 	@RequiresPermissions("product:cmSmalltype:edit")
 	@RequestMapping(value = "save")
 	public String save(CmSmalltype cmSmalltype, Model model, RedirectAttributes redirectAttributes,HttpServletRequest request) {
+		cmSmalltype.setMallType(null == cmSmalltype.getMallType() ? 1 : cmSmalltype.getMallType());
 		if (checkValidator(model, cmSmalltype)){
 			return form(cmSmalltype, model);
 		}
@@ -95,40 +106,48 @@ public class CmSmalltypeController extends BaseController {
 			cmSmalltype.setAddTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
 		}
 		cmSmalltypeService.save(cmSmalltype);
-		cleanRedisCache();
+		if (1 == cmSmalltype.getMallType()) {
+			cleanRedisCache();
+		}
 //		if (flag){
 //			cmSmalltypeService.mutiUpdateCode(cmSmalltype.getSmallTypeID());
 //		}
 		addMessage(redirectAttributes, "保存二级分类成功");
-		return "redirect:"+Global.getAdminPath()+"/product/cmSmalltype/?repage&bigTypeID="+cmSmalltype.getBigTypeID()+"&typeSort="+cmSmalltype.getTypeSort();
+		return "redirect:" + Global.getAdminPath() + "/product/cmSmalltype/?repage&bigTypeID=" + cmSmalltype.getBigTypeID() + "&typeSort=" + cmSmalltype.getTypeSort() + "&mallType=" + cmSmalltype.getMallType();
 	}
 
 	private boolean checkValidator(Model model, CmSmalltype cmSmalltype) {
 		if (!beanValidator(model, cmSmalltype)){
 			return true;
 		}
-		if(StringUtils.getStringLength(cmSmalltype.getName())>16){
+		if(1 == cmSmalltype.getMallType() && StringUtils.getStringLength(cmSmalltype.getName())>16){
 			model.addAttribute("errorMsg", "名称过长!");
 			return true;
 		}
-		List<CmSmalltype> cmSmalltypeList =  cmSmalltypeService.getByCode(cmSmalltype.getSmallTypeCode(),cmSmalltype.getBigTypeID());
-		if (null!=cmSmalltype&&cmSmalltype.getSmallTypeID()==null&&cmSmalltypeList!=null&&cmSmalltypeList.size()>0){
-			model.addAttribute("errorMsg", "同一大分类下小分类编码不能相同!");
-			return true;
+		if (1 == cmSmalltype.getMallType()) {
+			List<CmSmalltype> cmSmalltypeList =  cmSmalltypeService.getByCode(cmSmalltype.getSmallTypeCode(),cmSmalltype.getBigTypeID());
+			if (cmSmalltype.getSmallTypeID()==null&&cmSmalltypeList!=null&&cmSmalltypeList.size()>0){
+				model.addAttribute("errorMsg", "同一大分类下小分类编码不能相同!");
+				return true;
+			}
+			if (StringUtils.isEmpty(cmSmalltype.getWwwIcon())) {
+				model.addAttribute("errorMsg", "请上传网站图标!");
+				return true;
+			}
+			if (StringUtils.isEmpty(cmSmalltype.getTypeSort())) {
+				model.addAttribute("errorMsg", "请输入分类类型!");
+				return true;
+			}
 		}
-        if (StringUtils.isEmpty(cmSmalltype.getWwwIcon())) {
-            model.addAttribute("errorMsg", "请上传网站图标!");
-            return true;
-        }
-        if (StringUtils.isEmpty(cmSmalltype.getCrmIcon())) {
+        /*if (StringUtils.isEmpty(cmSmalltype.getCrmIcon())) {
             model.addAttribute("errorMsg", "请上传小程序图标!");
             return true;
-        }
-        if (StringUtils.isEmpty(cmSmalltype.getTypeSort())) {
-            model.addAttribute("errorMsg", "请输入排序值!");
-            return true;
-        }
-		if (Integer.parseInt(cmSmalltype.getTypeSort()) <= 0) {
+        }*/
+		if (null ==cmSmalltype.getSortIndex()) {
+			model.addAttribute("errorMsg", "请输入排序值!");
+			return true;
+		}
+		if (cmSmalltype.getSortIndex() <= 0) {
 			model.addAttribute("errorMsg", "排序值只能输入大于0的正整数!");
 			return true;
 		}
@@ -175,13 +194,14 @@ public class CmSmalltypeController extends BaseController {
 	 * @param redirectAttributes
 	 * @return
 	 */
-	@RequiresPermissions("product:cmSmalltype:delete")
 	@RequestMapping(value = "delete")
 	public String delete(CmSmalltype cmSmalltype, RedirectAttributes redirectAttributes) {
 		cmSmalltypeService.delete(cmSmalltype);
-		cleanRedisCache();
+		if (1 == cmSmalltype.getMallType()) {
+			cleanRedisCache();
+		}
 		addMessage(redirectAttributes, "删除小分类成功");
-		return "redirect:"+Global.getAdminPath()+"/product/cmSmalltype/?repage&bigTypeID="+cmSmalltype.getBigTypeID();
+		return "redirect:" + Global.getAdminPath() + "/product/cmSmalltype/?repage&bigTypeID=" + cmSmalltype.getBigTypeID() + "&mallType=" + cmSmalltype.getMallType();
 	}
 
 	/**

+ 17 - 6
src/main/resources/config/dev/caimei.properties

@@ -12,9 +12,16 @@
 #mysql database setting
 jdbc.type=mysql
 jdbc.driver=com.mysql.cj.jdbc.Driver
-jdbc.url=jdbc:mysql://192.168.2.100:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
-jdbc.username=developer
-jdbc.password=05bZ/OxTB:X+yd%1
+jdbc.url=jdbc:mysql://localhost:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
+jdbc.username=root
+jdbc.password=wndiqwe
+
+#mysql database setting
+#jdbc.type=mysql
+#jdbc.driver=com.mysql.cj.jdbc.Driver
+#jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
+#jdbc.username=developer
+#jdbc.password=J5p3tgOVazNl4ydf
 
 #jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #jdbc.username=developer
@@ -40,10 +47,14 @@ jdbc.pool.maxActive=20
 jdbc.testSql=SELECT 'x' FROM DUAL
 
 #redis settings
-redis.keyPrefix=caimei-manager
-redis.host=192.168.2.100
+#redis.keyPrefix=caimei-manager
+#redis.host=192.168.2.100
+#redis.port=6379
+#redis.pass=123456
+#redis.timeout=100000
+redis.host=47.119.112.46
 redis.port=6379
-redis.pass=123456
+redis.pass=6#xsI%b4o@5c3RoE
 redis.timeout=100000
 #\u6700\u5927\u8FDE\u63A5\u6570
 redis.pool.maxActive=300

+ 96 - 0
src/main/resources/mappings/modules/hehe/HeheHomeTypeMapper.xml

@@ -0,0 +1,96 @@
+<?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.HeheHomeTypeDao">
+    
+	<sql id="heheHomeTypeColumns">
+		a.id AS "id",
+		a.name AS "name",
+		a.icon AS "icon",
+		a.sort AS "sort",
+		a.status AS "status",
+		a.addTime AS "addTime"
+	</sql>
+	
+	<sql id="heheHomeTypeJoins">
+	</sql>
+    
+	<select id="get" resultType="HeheHomeType">
+		SELECT 
+			<include refid="heheHomeTypeColumns"/>
+		FROM hehe_home_type a
+		<include refid="heheHomeTypeJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="HeheHomeType">
+		SELECT 
+			<include refid="heheHomeTypeColumns"/>
+		FROM hehe_home_type a
+		<include refid="heheHomeTypeJoins"/>
+		<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="findAllList" resultType="HeheHomeType">
+		SELECT 
+			<include refid="heheHomeTypeColumns"/>
+		FROM hehe_home_type a
+		<include refid="heheHomeTypeJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="HeheHomeType"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO hehe_home_type(
+			name,
+			icon,
+			sort,
+			status,
+			addTime
+		) VALUES (
+			#{name},
+			#{icon},
+			#{sort},
+			#{status},
+			#{addTime}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE hehe_home_type
+		<set>
+			<if test="name != null and name != ''">
+				name = #{name},
+			</if>
+			<if test="icon != null and icon != ''">
+				icon = #{icon},
+			</if>
+			<if test="sort != null">
+				sort = #{sort},
+			</if>
+		</set>
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM hehe_home_type
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 11 - 3
src/main/resources/mappings/modules/product/CmBigtypeMapper.xml

@@ -69,9 +69,12 @@
 			<if test="sortIndex != null and sortIndex != ''">
 				AND a.sortIndex = #{sortIndex}
 			</if>
-			<if test="typeSort != null and typeSort != ''">
+			<if test="typeSort != null and typeSort != '' and typeSort != 'null'">
 				AND a.typeSort = #{typeSort}
 			</if>
+			<if test="null != mallType">
+				and mallType = #{mallType}
+			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -111,7 +114,8 @@
 			wwwIcon,
 			crmIcon,
 			addTime,
-			sortIndex
+			sortIndex,
+			mallType
 		) VALUES (
 			#{typeSort},
 			#{name},
@@ -121,7 +125,8 @@
 			#{wwwIcon},
 			#{crmIcon},
 			#{addTime},
-			#{sortIndex}
+			#{sortIndex},
+		    #{mallType}
 		)
 	</insert>
 
@@ -155,6 +160,9 @@
 			 <if test="sortIndex != null and sortIndex != ''">
 				 sortIndex = #{sortIndex},
 			 </if>
+			 <if test="mallType != null">
+				 mallType = #{mallType},
+			 </if>
 		 </set>
 		WHERE bigTypeID = #{bigTypeID}
 	</update>

+ 239 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheBigtypeForm.jsp

@@ -0,0 +1,239 @@
+<%@ 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>
+        .iconBox{
+            font-size: 0;
+        }
+        .controls .conList{
+            display: inline-block;
+            margin-right: 15px;
+        }
+        .conList .btn:nth-of-type(1){
+            margin-left: 25px;
+        }
+        .select2-choice{
+            width: 100px;
+        }
+        .upload-content {
+            margin-top: -70px;
+        }
+        .upload-content .conList .btn:nth-of-type(1) {
+            width: 90px;
+            height: 100px;
+            border: 2px solid #eee;
+            background: #fff;
+            position: relative;
+        }
+        .upload-content .conList .btn:nth-of-type(1)>div {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            color: #666;
+        }
+        .upload-content .conList .btn:nth-of-type(1) span {
+            font-size: 35px;
+        }
+        .upload-content .conList .btn:nth-of-type(1) h5 {
+            color: #666;
+        }
+        .cancel-upload {
+            background: transparent;
+            border: none;
+            box-shadow: none;
+            position: relative;
+            top: -38px;
+            left: -25px;
+            cursor: pointer;
+            z-index: 100;
+        }
+         .upload-content .conList ol li {
+            width: 114px;
+            min-height: 80px;
+            text-align: center;
+            background: #fff;
+            position: relative;
+            top: 120px;
+            margin-left: 2px;
+        }
+        .hide-pic {
+            display: none !important;
+        }
+    </style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					var name = $("#name").val();
+					if (isnull(name)) {
+						alertx("请输入分类名称")
+						return;
+					}
+					var code = $("#bigTypeCode").val();
+					if (isnull(code)) {
+						alertx("请输入编码");
+						return;
+					}
+					var sortIndex = $("#sortIndex").val();
+					if (isnull(sortIndex)) {
+						alertx("请输入排序值");
+						return;
+					}
+                    if (parseInt(sortIndex) <= 0) {
+                        alertx("排序值只允许输入大于0的正整数");
+                        return;
+                    }
+					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);
+					}
+				}
+			});
+		});
+		//错误提示
+		var errorMsg  = "${errorMsg}";
+		if(errorMsg){
+			alertx(errorMsg);
+		}
+
+
+		function isnull(val) {
+			var str = val.replace(/(^\s*)|(\s*$)/g, '');//去除空格;
+			if (str == '' || str == undefined || str == null) {
+				return true;
+			} else {
+				return false;
+			}
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/product/cmBigtype?mallType=2">商品分类管理</a></li>
+		<li class="active"><a href="${ctx}/product/cmBigtype/form?id=${cmBigtype.bigTypeID}&mallType=2">一级分类<shiro:hasPermission name="product:cmBigtype:edit">${not empty cmBigtype.bigTypeID?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="product:cmBigtype:edit">查看</shiro:lacksPermission></a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmBigtype" action="${ctx}/product/cmBigtype/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<form:hidden path="mallType"/>
+		<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="name" htmlEscape="false" placeholder="最多输入30个汉字" maxlength="30" class="input-xlarge" />
+			</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="sortIndex" htmlEscape="false" maxlength="11" class="input-xlarge digits"/>
+			</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="crmValidFlag" class="input-medium">
+					<form:option value="1" label="已上架"/>
+					<form:option value="0" label="已下架"/>
+				</form:select>
+			</div>
+		</div>
+<%--		<div class="control-group">
+			<label class="control-label">首页显示:</label>
+			<div class="controls">
+				<form:select path="displayOnHomePageFlag" class="input-xlarge ">
+					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+				</form:select>
+			</div>
+		</div>--%>
+		<div class="form-actions">
+			<shiro:hasPermission name="product:cmBigtype:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+    <script>
+        $(function () {
+            $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+            $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+            $('.upload-content .conList').find('.cancel-upload').hide();
+            var observeEle = document.getElementsByClassName('upload-content')[0];
+            var observeEle1 = document.getElementsByClassName('upload-content')[1];
+            var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+            var MutationObserverConfig = {
+                childList: true,
+                subtree: true,
+                characterData: true
+            };
+            var observer = new MutationObserver(function (mutations) {
+                $.each(mutations, function (index, item) {
+					if (item.type === 'childList') {
+                        // 在创建新的 element 时调用
+                        var target = $(item.target),
+                            thisWrapper = target.closest('.conList'),
+                            nextEle = thisWrapper.next();
+                        thisWrapper.find('li').css('z-index', 99);
+                        thisWrapper.find('.cancel-upload').show();
+                        if (nextEle.hasClass('hide-pic')) {
+                            nextEle.removeClass('hide-pic');
+                        }
+                    }
+                })
+            });
+            observer.observe(observeEle, MutationObserverConfig);
+            observer.observe(observeEle1, MutationObserverConfig);
+
+           /* $('body').on('click', '#wwwIconBox', function () {
+				str = 'wwwIconFinderOpen';
+                eval(str + '()');
+            });
+            $('body').on('click', '#crmIconBox', function () {
+				str = 'crmIconFinderOpen';
+                eval(str + '()');
+            });*/
+            $('body').on('click', '.cancel-upload', function () {
+                var wrapper = $(this).closest('.conList');
+                wrapper.find('li').css('z-index', '-1');
+                wrapper.find('input').val('');
+                $(this).hide();
+				wrapper.removeClass("hide-pic");
+                wrapper.parent().append(wrapper.clone());
+                wrapper.remove();
+                $(".conList").each(function (i, ele) {
+                    if ($(ele).find("input.input-xlarge").val()) {
+                        $(ele).next().removeClass("hide-pic")
+                    }
+                })
+            });
+            $(window).on("load", function () {
+                setTimeout(function () {
+                    $("#wwwIconBox").find("input.input-xlarge").each(function (i, ele) {
+                        if ($(ele).val()) {
+                            $(ele).next().find("li").css("z-index", "99");
+                            $(ele).parents(".conList").find(".cancel-upload").show();
+                            $(ele).parents(".conList").next().removeClass("hide-pic")
+                        }
+                    })
+					$("#crmIconBox").find("input.input-xlarge").each(function (i, ele) {
+                        if ($(ele).val()) {
+                            $(ele).next().find("li").css("z-index", "99");
+                            $(ele).parents(".conList").find(".cancel-upload").show();
+                            $(ele).parents(".conList").next().removeClass("hide-pic")
+                        }
+                    })
+                }, 500);
+            });
+        });
+    </script>
+</body>
+</html>

+ 180 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheBigtypeList.jsp

@@ -0,0 +1,180 @@
+<%@ 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;
+        }
+        //状态修改
+        function updateStatus(status, ids, type) {
+            <%--if('validFlag'==type && '1'==status){--%>
+            <%--$.post("${ctx}/product/cmBigtype/list",{'validFlag':'1'}, function(data) {--%>
+            <%--if(data.count>=10){--%>
+            <%--alertx("最多只能启用10项,请先停用");--%>
+            <%--}else{--%>
+            <%--update(status,ids,type);--%>
+            <%--}--%>
+            <%--},"JSON"); //这里返回的类型有:json,html,xml,text  ${ctx}/info/infoType/form--%>
+            <%--}else{--%>
+            update(status, ids, type);
+//            }
+        }
+        function update(status, ids, type) {
+            var msg = '确定上架该分类吗?';
+            if ('0' == status) {
+                msg = '确定下架该分类吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/product/cmBigtype/updateStatus", {
+                        'status': status,
+                        'id': ids,
+                        'type':type
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        $("#searchForm").submit();
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+        //验证输入的排序值是否合法
+        var bigTypeId_sortIndex = '';
+        function confirmSortIndex(index) {
+            var $sortIndex = $("#sortIndex" + index).val();
+            var $bigTypeId = $("#bigTypeId" + index).text();
+            if (!isNaN($sortIndex)) {
+                if($sortIndex % 1 === 0 && $sortIndex >0){
+                    bigTypeId_sortIndex += $bigTypeId+"_"+$sortIndex+","
+                }else{
+                    alertx("排序只能输入大于0的整数");
+                    $.get("${ctx}/product/cmBigtype/bigType",{'id':$bigTypeId}, function (data) {
+                        $("#sortIndex" + index).val(data.data.sortIndex);
+                    })
+                }
+            }else{
+                alertx("排序只能输入大于0的整数");
+                $.get("${ctx}/product/cmBigtype/bigType",{'id':$bigTypeId},function (data) {
+                    $("#sortIndex" + index).val(data.data.sortIndex);
+                })
+            }
+        }
+
+        //批量保存排序
+        function updateSortIndex() {
+            $.post("${ctx}/product/cmBigtype/updateSortIndex",{'bigTypeIdSortIndexs':bigTypeId_sortIndex},function(result){
+                $.jBox.tip(result.data, 'info');
+                setTimeout(function () {
+                    $("#searchForm").submit();
+                }, 500);
+            })
+        }
+
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active" style="width: 120px; text-align: center"><a href="${ctx}/product/cmBigtype?mallType=2"><label >商品分类管理</label></a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmBigtype" action="${ctx}/product/cmBigtype?mallType=2" 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>一级分类名称:</label>
+        <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/>
+        <label>状态:</label>
+        <form:select path="crmValidFlag" class="input-medium">
+            <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="查询" style="margin-left: 15px"/>
+          <input class="btn btn-primary" type="button" value="一键排序" onclick="updateSortIndex()" style="margin-left: 15px"/>
+        <a class="btn btn-primary" href="${ctx}/product/cmBigtype/form?mallType=2" style="margin-left: 15px">添加一级分类</a>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<label style="display: block;font-size: medium;margin-bottom: 5px">一级分类列表</label>
+<label style="display: block;margin-bottom: 5px">注:排序值越小越靠前</label>
+<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>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmBigtype" varStatus="state">
+        <tr>
+            <td>
+                    <label id="bigTypeId${state.index}">${cmBigtype.bigTypeID}</label>
+            </td>
+            <td>
+                    ${cmBigtype.name}
+            </td>
+            <td>
+                <c:if test="${cmBigtype.crmValidFlag eq 1 }">
+                    <font color="green" style="margin-right: 10px">已上架</font>
+<%--                    <a style="margin-left: 10px;text-decoration: underline" href="javascript:void(0);" onclick="updateStatus('0','${cmBigtype.bigTypeID}','crmValidFlag');">停用</a>--%>
+                </c:if>
+                <c:if test="${cmBigtype.crmValidFlag ne 1 }">
+                    <font color="red" style="margin-right: 10px">已下架</font>
+<%--                    <a style="margin-left: 10px;text-decoration: underline" href="javascript:void(0)" onclick="updateStatus('1','${cmBigtype.bigTypeID}','crmValidFlag');">启用</a>--%>
+                </c:if>
+            </td>
+            <td>
+                <input type="text" name="sortIndex" id="sortIndex${state.index}"
+                       onchange="confirmSortIndex(${state.index})"
+                       value="${cmBigtype.sortIndex}"
+                       style="width: 50px">
+            </td>
+            <td>
+                ${cmBigtype.addTime}
+            </td>
+            <td>
+                <a href="${ctx}/product/cmBigtype/form?id=${cmBigtype.bigTypeID}">编辑</a>
+                <c:if test="${cmBigtype.crmValidFlag eq 1 }">
+                    <a href="javascript:;" onclick="updateStatus('0','${cmBigtype.bigTypeID}','crmValidFlag')">下架</a>
+                </c:if>
+                <c:if test="${cmBigtype.crmValidFlag ne 1 }">
+                    <a href="javascript:;" onclick="updateStatus('1','${cmBigtype.bigTypeID}','crmValidFlag')">上架</a>
+                </c:if>
+                <a href="${ctx}/product/cmSmalltype/list?bigTypeID=${cmBigtype.bigTypeID}&typeSort=1&mallType=2">二级分类</a>
+                <a href="${ctx}/product/cmBigtype/delete?bigTypeID=${cmBigtype.bigTypeID}&mallType=2">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 247 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheSmalltypeForm.jsp

@@ -0,0 +1,247 @@
+<%@ 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>
+		.iconBox{
+			font-size: 0;
+		}
+		.controls .conList{
+			display: inline-block;
+			margin-right: 15px;
+		}
+		.conList .btn:nth-of-type(1){
+			margin-left: 25px;
+		}
+		.select2-choice{
+			width: 100px;
+		}
+		.upload-content {
+			margin-top: -70px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) {
+            width: 90px;
+            height: 100px;
+            border: 2px solid #eee;
+            background: #fff;
+            position: relative;
+        }
+		.upload-content .conList .btn:nth-of-type(1)>div {
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			transform: translate(-50%, -50%);
+			color: #666;
+		}
+		.upload-content .conList .btn:nth-of-type(1) span {
+			font-size: 35px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) h5 {
+			color: #666;
+		}
+		.cancel-upload {
+			background: transparent;
+			border: none;
+			box-shadow: none;
+			position: relative;
+			top: -38px;
+			left: -25px;
+			cursor: pointer;
+			z-index: 100;
+		}
+		 .upload-content .conList ol li {
+            width: 114px;
+            min-height: 80px;
+            text-align: center;
+            background: #fff;
+            position: relative;
+            top: 120px;
+            margin-left: 2px;
+        }
+		.hide-pic {
+			display: none !important;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					var name = $("#name").val();
+					if (isnull(name)) {
+						alertx("请输入分类名称")
+						return;
+					}
+					var code = $("#smallTypeCode").val();
+					if (isnull(code)) {
+						alertx("请输入编码");
+						return;
+					}
+					var sortIndex = $("#sortIndex").val();
+					if (isnull(sortIndex)) {
+						alertx("请输入排序值");
+						return;
+					}
+					if (parseInt(sortIndex) <= 0) {
+						alertx("排序值只允许输入大于0的正整数");
+						return;
+					}
+					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);
+					}
+				}
+			});
+		});
+		//错误提示
+		var errorMsg  = "${errorMsg}";
+		if(errorMsg){
+			alertx(errorMsg);
+		}
+
+		function isnull(val) {
+			var str = val.replace(/(^\s*)|(\s*$)/g, '');//去除空格;
+			if (str == '' || str == undefined || str == null) {
+				return true;
+			} else {
+				return false;
+			}
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/product/cmSmalltype/list?bigTypeID=${bigTypeID}&typeSort=${cmSmalltype.typeSort}">二级分类列表</a></li>
+		<li class="active"><a href="${ctx}/product/cmSmalltype/form?id=${cmSmalltype.smallTypeID}&typeSort=${cmSmalltype.typeSort}&mallType=2">二级分类<shiro:hasPermission name="product:cmSmalltype:edit">${not empty cmSmalltype.smallTypeID?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="product:cmSmalltype:edit">查看</shiro:lacksPermission></a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmSmalltype" action="${ctx}/product/cmSmalltype/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<form:hidden path="bigTypeID"/>
+		<form:hidden path="mallType"/>
+		<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="name" cssStyle="position: relative" htmlEscape="false" placeholder="最多输入30个汉字" maxlength="8" class="input-xlarge"/>
+			</div>
+		</div>
+		<div class="control-group iconBox">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>分类图片:</label>
+			<div class="controls upload-content" id="crmIconBox">
+				<div class="conList">
+					<form:hidden id="crmIcon" path="crmIcon" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+					<sys:ckfinder input="crmIcon" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+					<br>
+					<label style="margin-left: 150px">建议图片分辨率88px*88px</label>
+				</div>
+			</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="sortIndex" htmlEscape="false" maxlength="11" class="input-xlarge digits"/>
+			</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="crmValidFlag" class="input-medium">
+					<form:option value="1" label="已上架"/>
+					<form:option value="0" label="已下架"/>
+				</form:select>
+			</div>
+		</div>
+<%--		<div class="control-group">
+			<label class="control-label">首页显示:</label>
+			<div class="controls">
+				<form:select path="displayOnHomePageFlag" class="input-xlarge ">
+					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+				</form:select>
+			</div>
+		</div>--%>
+		<div class="form-actions">
+			<shiro:hasPermission name="product:cmSmalltype:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+	<script>
+		$(function () {
+			$('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+			$('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+			$('.upload-content .conList').find('.cancel-upload').hide();
+			var observeEle = document.getElementsByClassName('upload-content')[0];
+			var observeEle1 = document.getElementsByClassName('upload-content')[1];
+			var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+			var MutationObserverConfig = {
+				childList: true,
+				subtree: true,
+				characterData: true
+			};
+			var observer = new MutationObserver(function (mutations) {
+				$.each(mutations, function (index, item) {
+					if (item.type === 'childList') {
+						// 在创建新的 element 时调用
+						var target = $(item.target),
+								thisWrapper = target.closest('.conList'),
+								nextEle = thisWrapper.next();
+						thisWrapper.find('li').css('z-index', 99);
+						thisWrapper.find('.cancel-upload').show();
+						if (nextEle.hasClass('hide-pic')) {
+							nextEle.removeClass('hide-pic');
+						}
+					}
+				})
+			});
+			observer.observe(observeEle, MutationObserverConfig);
+			observer.observe(observeEle1, MutationObserverConfig);
+
+			$('body').on('click', '.upload-content li', function () {
+				var index = $(this).closest('.conList').index() + 1,
+						str = 'remarkImage' + index + 'FinderOpen';
+				eval(str + '()');
+			});
+			$('body').on('click', '.cancel-upload', function () {
+				var wrapper = $(this).closest('.conList');
+				wrapper.find('li').css('z-index', '-1');
+				wrapper.find('input').val('');
+				$(this).hide();
+				wrapper.removeClass("hide-pic");
+				wrapper.parent().append(wrapper.clone());
+				wrapper.remove();
+				$(".conList").each(function (i, ele) {
+					if ($(ele).find("input.input-xlarge").val()) {
+						$(ele).next().removeClass("hide-pic")
+					}
+				})
+			});
+			$(window).on("load", function () {
+				setTimeout(function () {
+					$("#wwwIconBox").find("input.input-xlarge").each(function (i, ele) {
+						if ($(ele).val()) {
+							$(ele).next().find("li").css("z-index", "99");
+							$(ele).parents(".conList").find(".cancel-upload").show();
+							$(ele).parents(".conList").next().removeClass("hide-pic")
+						}
+					})
+					$("#crmIconBox").find("input.input-xlarge").each(function (i, ele) {
+						if ($(ele).val()) {
+							$(ele).next().find("li").css("z-index", "99");
+							$(ele).parents(".conList").find(".cancel-upload").show();
+							$(ele).parents(".conList").next().removeClass("hide-pic")
+						}
+					})
+				}, 500);
+			});
+		});
+	</script>
+</body>
+</html>

+ 171 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheSmalltypeList.jsp

@@ -0,0 +1,171 @@
+<%@ 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;
+        }
+        //状态修改
+        function updateStatus(status, ids, type) {
+            <%--if('validFlag'==type && '1'==status){--%>
+            <%--$.post("${ctx}/product/cmBigtype/list",{'validFlag':'1'}, function(data) {--%>
+            <%--if(data.count>=10){--%>
+            <%--alertx("最多只能启用10项,请先停用");--%>
+            <%--}else{--%>
+            <%--update(status,ids,type);--%>
+            <%--}--%>
+            <%--},"JSON"); //这里返回的类型有:json,html,xml,text  ${ctx}/info/infoType/form--%>
+            <%--}else{--%>
+            update(status, ids, type);
+//            }
+        }
+        function update(status, ids, type) {
+            var msg = '确定上架该分类吗?';
+            if ('0' == status) {
+                msg = '确定下架该分类吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+					$.post("${ctx}/product/cmSmalltype/updateStatus", {
+						'status': status,
+						'id': ids,
+						'type':type
+					}, function (data) {
+						if (true == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							$.jBox.tip(data.msg, 'error');
+						}
+						$("#searchForm").submit();
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+		//验证输入的排序值是否合法
+		var smallTypeId_sortIndex = '';
+		function confirmSortIndex(index) {
+			var $sortIndex = $("#sortIndex" + index).val();
+			var $smallTypeId = $("#smallTypeId" + index).text();
+			if (!isNaN($sortIndex)) {
+				if($sortIndex % 1 === 0 && $sortIndex >0){
+					smallTypeId_sortIndex += $smallTypeId+"_"+$sortIndex+","
+				}else{
+					alertx("排序只能输入大于0的整数");
+					$.get("${ctx}/product/cmSmalltype/smallType",{'id':$smallTypeId}, function (data) {
+						$("#sortIndex" + index).val(data.data.sortIndex);
+					})
+				}
+			}else{
+				alertx("排序只能输入大于0的整数");
+				$.get("${ctx}/product/cmSmalltype/smallType",{'id':$smallTypeId},function (data) {
+					$("#sortIndex" + index).val(data.data.sortIndex);
+				})
+			}
+		}
+
+		//批量保存排序
+		function updateSortIndex() {
+			$.post("${ctx}/product/cmSmalltype/updateSortIndex",{'smallTypeIdSortIndexs':smallTypeId_sortIndex},function(result){
+				$.jBox.tip(result.data, 'info');
+				setTimeout(function () {
+					$("#searchForm").submit();
+				}, 500);
+			})
+		}
+
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active" style="width: 120px; text-align: center"><a href="${ctx}/product/cmSmalltype/list?bigTypeID=${bigTypeID}&mallType=2">二级分类列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmSmalltype" action="${ctx}/product/cmSmalltype/list?bigTypeID=${bigTypeID}&mallType=2" 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>二级分类名称:</label>
+			<form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/>
+			<label>状态:</label>
+			<form:select path="crmValidFlag" class="input-medium">
+				<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="updateSortIndex()" style="margin-left: 15px"/>
+			<a class="btn btn-primary" href="${ctx}/product/cmSmalltype/form?bigTypeID=${bigTypeID}&mallType=2" style="margin-left: 15px">添加二级分类</a>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<label style="display: block;margin-bottom: 5px">注:排序值越小越靠前</label>
+	<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>
+		</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmSmalltype"  varStatus="state">
+			<tr>
+				<td>
+					<label id="smallTypeId${state.index}">${cmSmalltype.smallTypeID}</label>
+				</td>
+				<td>
+						${cmSmalltype.name}
+				</td>
+				<td>
+					<c:if test="${cmSmalltype.crmValidFlag eq 1 }">
+						<font color="green" style="margin-right: 10px">已上架</font>
+<%--						<a style="margin-left: 10px;text-decoration: underline" href="javascript:void(0);" onclick="updateStatus('0','${cmSmalltype.smallTypeID}','crmValidFlag');">停用</a>--%>
+					</c:if>
+					<c:if test="${cmSmalltype.crmValidFlag ne 1 }">
+						<font color="red" style="margin-right: 10px">已下架</font>
+					</c:if>
+				</td>
+				<td>
+					<input type="text" name="sortIndex" id="sortIndex${state.index}"
+						   onchange="confirmSortIndex(${state.index})"
+						   value="${cmSmalltype.sortIndex}"
+						   style="width: 50px">
+				</td>
+				<td>
+						${cmSmalltype.addTime}
+				</td>
+				<td>
+					<a href="${ctx}/product/cmSmalltype/form?id=${cmSmalltype.smallTypeID}&typeSort=${typeSort}">编辑</a>
+					<c:if test="${cmSmalltype.crmValidFlag eq 1 }">
+						<a href="javascript:;" onclick="updateStatus('0','${cmSmalltype.smallTypeID}','crmValidFlag')">下架</a>
+					</c:if>
+					<c:if test="${cmSmalltype.crmValidFlag ne 1 }">
+						<a href="javascript:;" onclick="updateStatus('1','${cmSmalltype.smallTypeID}','crmValidFlag')">上架</a>
+					</c:if>
+					<a href="${ctx}/product/cmSmalltype/delete?smallTypeID=${cmSmalltype.smallTypeID}&bigTypeID=${bigTypeID}&mallType=2">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 218 - 0
src/main/webapp/WEB-INF/views/modules/hehe/heheHomeTypeForm.jsp

@@ -0,0 +1,218 @@
+<%@ 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>
+        .iconBox{
+            font-size: 0;
+        }
+        .controls .conList{
+            display: inline-block;
+            margin-right: 15px;
+        }
+        .conList .btn:nth-of-type(1){
+            margin-left: 25px;
+        }
+        .select2-choice{
+            width: 100px;
+        }
+        .upload-content {
+            margin-top: -70px;
+        }
+        .upload-content .conList .btn:nth-of-type(1) {
+            width: 90px;
+            height: 100px;
+            border: 2px solid #eee;
+            background: #fff;
+            position: relative;
+        }
+        .upload-content .conList .btn:nth-of-type(1)>div {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            color: #666;
+        }
+        .upload-content .conList .btn:nth-of-type(1) span {
+            font-size: 35px;
+        }
+        .upload-content .conList .btn:nth-of-type(1) h5 {
+            color: #666;
+        }
+        .cancel-upload {
+            background: transparent;
+            border: none;
+            box-shadow: none;
+            position: relative;
+            top: -38px;
+            left: -25px;
+            cursor: pointer;
+            z-index: 100;
+        }
+         .upload-content .conList ol li {
+            width: 114px;
+            min-height: 80px;
+            text-align: center;
+            background: #fff;
+            position: relative;
+            top: 120px;
+            margin-left: 2px;
+        }
+        .hide-pic {
+            display: none !important;
+        }
+    </style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					var name = $("#name").val();
+					if (isnull(name)) {
+						alertx("请输入分类名称")
+						return;
+					}
+					var sort = $("#sort").val();
+					if (isnull(sort)) {
+						alertx("请输入排序值");
+						return;
+					}
+                    if (parseInt(sort) <= 0) {
+                        alertx("排序值只允许输入大于0的正整数");
+                        return;
+                    }
+					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);
+					}
+				}
+			});
+		});
+		//错误提示
+		var errorMsg  = "${errorMsg}";
+		if(errorMsg){
+			alertx(errorMsg);
+		}
+
+
+		function isnull(val) {
+			var str = val.replace(/(^\s*)|(\s*$)/g, '');//去除空格;
+			if (str == '' || str == undefined || str == null) {
+				return true;
+			} else {
+				return false;
+			}
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/heheHomeType">首页分类导航</a></li>
+		<li class="active"><a href="${ctx}/hehe/heheHomeType/form?id=${heheHomeType.id}">菜单${not empty heheHomeType.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="heheHomeType" action="${ctx}/hehe/heheHomeType/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="name" htmlEscape="false" cssStyle="position: relative" placeholder="最多输入30个汉字" required="required" maxlength="30" class="input-xlarge" />
+			</div>
+		</div>
+		<div class="control-group iconBox">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>图标:</label>
+            <div class="controls upload-content" id="iconBox">
+                <div class="conList">
+                    <form:hidden path="icon" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+                    <sys:ckfinder input="icon" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+                    <br>
+                    <label style="margin-left: 150px">建议图片分辨率88px*88px</label>
+                </div>
+            </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" maxlength="11" required="required" class="input-xlarge digits"/>
+			</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>
+        $(function () {
+            $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+            $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+            $('.upload-content .conList').find('.cancel-upload').hide();
+            var observeEle = document.getElementsByClassName('upload-content')[0];
+            var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+            var MutationObserverConfig = {
+                childList: true,
+                subtree: true,
+                characterData: true
+            };
+            var observer = new MutationObserver(function (mutations) {
+                $.each(mutations, function (index, item) {
+					if (item.type === 'childList') {
+                        // 在创建新的 element 时调用
+                        var target = $(item.target),
+                            thisWrapper = target.closest('.conList'),
+                            nextEle = thisWrapper.next();
+                        thisWrapper.find('li').css('z-index', 99);
+                        thisWrapper.find('.cancel-upload').show();
+                        if (nextEle.hasClass('hide-pic')) {
+                            nextEle.removeClass('hide-pic');
+                        }
+                    }
+                })
+            });
+            observer.observe(observeEle, MutationObserverConfig);
+
+           /* $('body').on('click', '#iconBox', function () {
+				str = 'iconFinderOpen';
+                eval(str + '()');
+            });
+            $('body').on('click', '#crmIconBox', function () {
+				str = 'crmIconFinderOpen';
+                eval(str + '()');
+            });*/
+            $('body').on('click', '.cancel-upload', function () {
+                var wrapper = $(this).closest('.conList');
+                wrapper.find('li').css('z-index', '-1');
+                wrapper.find('input').val('');
+                $(this).hide();
+				wrapper.removeClass("hide-pic");
+                wrapper.parent().append(wrapper.clone());
+                wrapper.remove();
+                $(".conList").each(function (i, ele) {
+                    if ($(ele).find("input.input-xlarge").val()) {
+                        $(ele).next().removeClass("hide-pic")
+                    }
+                })
+            });
+            $(window).on("load", function () {
+                setTimeout(function () {
+                    $("#iconBox").find("input.input-xlarge").each(function (i, ele) {
+                        if ($(ele).val()) {
+                            $(ele).next().find("li").css("z-index", "99");
+                            $(ele).parents(".conList").find(".cancel-upload").show();
+                            $(ele).parents(".conList").next().removeClass("hide-pic")
+                        }
+                    })
+                }, 500);
+            });
+        });
+    </script>
+</body>
+</html>

+ 60 - 0
src/main/webapp/WEB-INF/views/modules/hehe/heheHomeTypeForm2.jsp

@@ -0,0 +1,60 @@
+<%@ 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/heheHomeType/">分类列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/heheHomeType/form?id=${heheHomeType.id}">分类<shiro:hasPermission name="hehe:heheHomeType:edit">${not empty heheHomeType.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="hehe:heheHomeType:edit">查看</shiro:lacksPermission></a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="heheHomeType" action="${ctx}/hehe/heheHomeType/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>		
+		<div class="control-group">
+			<label class="control-label">分类名称:</label>
+			<div class="controls">
+				<form:input path="name" htmlEscape="false" maxlength="45" class="input-xlarge "/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">图标:</label>
+			<div class="controls">
+				<form:input path="icon" htmlEscape="false" maxlength="255" class="input-xlarge "/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">排序值:</label>
+			<div class="controls">
+				<form:input path="sort" htmlEscape="false" class="input-xlarge "/>
+			</div>
+		</div>
+		<div class="form-actions">
+			<shiro:hasPermission name="hehe:heheHomeType:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+</body>
+</html>

+ 165 - 0
src/main/webapp/WEB-INF/views/modules/hehe/heheHomeTypeList.jsp

@@ -0,0 +1,165 @@
+<%@ 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;
+        }
+        //状态修改
+        function updateStatus(status, ids, type) {
+            <%--if('validFlag'==type && '1'==status){--%>
+            <%--$.post("${ctx}/hehe/cmBigtype/list",{'validFlag':'1'}, function(data) {--%>
+            <%--if(data.count>=10){--%>
+            <%--alertx("最多只能启用10项,请先停用");--%>
+            <%--}else{--%>
+            <%--update(status,ids,type);--%>
+            <%--}--%>
+            <%--},"JSON"); //这里返回的类型有:json,html,xml,text  ${ctx}/info/infoType/form--%>
+            <%--}else{--%>
+            update(status, ids, type);
+//            }
+        }
+        function update(status, ids, type) {
+            var msg = '确定上架该菜单吗?';
+            if ('0' == status) {
+                msg = '确定下架该菜单吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+					$.post("${ctx}/hehe/heheHomeType/updateStatus", {
+						'status': status,
+						'id': ids,
+						'type':type
+					}, function (data) {
+						if (true == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							$.jBox.tip(data.msg, 'error');
+						}
+						$("#searchForm").submit();
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+		//验证输入的排序值是否合法
+		var typeId_sort = '';
+		function confirmSortIndex(index) {
+			var $sort = $("#sort" + index).val();
+			var $smallTypeId = $("#smallTypeId" + index).text();
+			if (!isNaN($sort)) {
+				if($sort % 1 === 0 && $sort >0){
+					typeId_sort += $smallTypeId+"_"+$sort+","
+				}else{
+					alertx("排序只能输入大于0的整数");
+					$.get("${ctx}/hehe/heheHomeType/smallType",{'id':$smallTypeId}, function (data) {
+						$("#sort" + index).val(data.data.sort);
+					})
+				}
+			}else{
+				alertx("排序只能输入大于0的整数");
+				$.get("${ctx}/hehe/heheHomeType/smallType",{'id':$smallTypeId},function (data) {
+					$("#sort" + index).val(data.data.sort);
+				})
+			}
+		}
+
+		//批量保存排序
+		function updateSortIndex() {
+			$.post("${ctx}/hehe/heheHomeType/updateSortIndex",{'smallTypeIdSortIndexs':typeId_sort},function(result){
+				$.jBox.tip(result.data, 'info');
+				setTimeout(function () {
+					$("#searchForm").submit();
+				}, 500);
+			})
+		}
+
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active" style="width: 120px; text-align: center"><a href="${ctx}/hehe/heheHomeType/list">首页分类导航</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="heheHomeType" action="${ctx}/hehe/heheHomeType/list?bigTypeID=${bigTypeID}&mallType=2" 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">
+			<input class="btn btn-primary" type="button" value="一键排序" onclick="updateSortIndex()" style="margin-left: 15px"/>
+			<a class="btn btn-primary" href="${ctx}/hehe/heheHomeType/form?bigTypeID=${bigTypeID}&mallType=2" style="margin-left: 15px">添加菜单</a>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<label style="display: block;margin-bottom: 5px">注:排序值越小越靠前</label>
+	<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="heheHomeType"  varStatus="state">
+			<tr>
+				<td>
+					<label id="smallTypeId${state.index}">${heheHomeType.id}</label>
+				</td>
+				<td>
+						${heheHomeType.name}
+				</td>
+				<td>
+					<img alt="" src="${heheHomeType.icon}" width="100" height="100">
+				</td>
+				<td>
+					<c:if test="${heheHomeType.status eq 1 }">
+						<font color="green" style="margin-right: 10px">已上架</font>
+					</c:if>
+					<c:if test="${heheHomeType.status ne 1 }">
+						<font color="red" style="margin-right: 10px">已下架</font>
+					</c:if>
+				</td>
+				<td>
+					<input type="text" name="sort" id="sort${state.index}"
+						   onchange="confirmSortIndex(${state.index})"
+						   value="${heheHomeType.sort}"
+						   style="width: 50px">
+				</td>
+				<td>
+						${heheHomeType.addTime}
+				</td>
+				<td>
+					<a href="${ctx}/hehe/heheHomeType/form?id=${heheHomeType.id}">编辑</a>
+					<c:if test="${heheHomeType.status eq 1 }">
+						<a href="javascript:;" onclick="updateStatus('0','${heheHomeType.id}','status')">下架</a>
+					</c:if>
+					<c:if test="${heheHomeType.status ne 1 }">
+						<a href="javascript:;" onclick="updateStatus('1','${heheHomeType.id}','status')">上架</a>
+					</c:if>
+					<a href="${ctx}/hehe/heheHomeType/delete?id=${heheHomeType.id}">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>