Aslee преди 3 години
родител
ревизия
99e2b15e8d

+ 15 - 0
src/main/java/com/caimei/modules/archive/dao/CmProductArchiveContentDao.java

@@ -0,0 +1,15 @@
+package com.caimei.modules.archive.dao;
+
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.archive.entity.CmProductArchiveContent;
+
+/**
+ * 商品资料内容DAO接口
+ * @author Aslee
+ * @version 2021-09-06
+ */
+@MyBatisDao
+public interface CmProductArchiveContentDao extends CrudDao<CmProductArchiveContent> {
+	
+}

+ 21 - 0
src/main/java/com/caimei/modules/archive/dao/CmProductArchiveDao.java

@@ -0,0 +1,21 @@
+package com.caimei.modules.archive.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.archive.entity.CmProductArchive;
+
+import java.util.List;
+
+/**
+ * 商品资料DAO接口
+ * @author Aslee
+ * @version 2021-09-03
+ */
+@MyBatisDao
+public interface CmProductArchiveDao extends CrudDao<CmProductArchive> {
+
+    List<Integer> findArchiveProductId();
+
+    List<Product> findAllProduct(Product product);
+}

+ 112 - 0
src/main/java/com/caimei/modules/archive/entity/CmProductArchive.java

@@ -0,0 +1,112 @@
+package com.caimei.modules.archive.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 2021-09-03
+ */
+public class CmProductArchive extends DataEntity<CmProductArchive> {
+	
+	private static final long serialVersionUID = 1L;
+	private Integer productId;		// 商品id
+	private String productName;		// 商品名称
+	private String shopName;		// 供应商名称
+	private String productImage;		// 商品图片
+	private Integer archiveLevel;		// 资料等级:1一类资料,2二类资料,3三类资料
+	private Integer productType;		// 商品属性:1产品,2仪器
+	private Integer productClassify;		// 商品分类:1生美,2医美
+	private Date addTime;		// 添加时间
+
+
+	private Integer existProductType;	//商品库商品是否有设置商品属性:0没有,1有
+	
+	public CmProductArchive() {
+		super();
+	}
+
+	public CmProductArchive(String id){
+		super(id);
+	}
+
+	@Length(min=0, max=50, message="商品名称长度必须介于 0 和 50 之间")
+	public String getProductName() {
+		return productName;
+	}
+
+	public void setProductName(String productName) {
+		this.productName = productName;
+	}
+	
+	@Length(min=0, max=50, message="供应商名称长度必须介于 0 和 50 之间")
+	public String getShopName() {
+		return shopName;
+	}
+
+	public void setShopName(String shopName) {
+		this.shopName = shopName;
+	}
+	
+	@Length(min=0, max=300, message="商品图片长度必须介于 0 和 300 之间")
+	public String getProductImage() {
+		return productImage;
+	}
+
+	public void setProductImage(String productImage) {
+		this.productImage = productImage;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+
+	public Integer getProductId() {
+		return productId;
+	}
+
+	public void setProductId(Integer productId) {
+		this.productId = productId;
+	}
+
+	public Integer getArchiveLevel() {
+		return archiveLevel;
+	}
+
+	public void setArchiveLevel(Integer archiveLevel) {
+		this.archiveLevel = archiveLevel;
+	}
+
+	public Integer getProductType() {
+		return productType;
+	}
+
+	public void setProductType(Integer productType) {
+		this.productType = productType;
+	}
+
+	public Integer getProductClassify() {
+		return productClassify;
+	}
+
+	public void setProductClassify(Integer productClassify) {
+		this.productClassify = productClassify;
+	}
+
+	public Integer getExistProductType() {
+		return existProductType;
+	}
+
+	public void setExistProductType(Integer existProductType) {
+		this.existProductType = existProductType;
+	}
+}

+ 64 - 0
src/main/java/com/caimei/modules/archive/entity/CmProductArchiveContent.java

@@ -0,0 +1,64 @@
+package com.caimei.modules.archive.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 2021-09-06
+ */
+public class CmProductArchiveContent extends DataEntity<CmProductArchiveContent> {
+	
+	private static final long serialVersionUID = 1L;
+	private Integer productArchiveId;		// 商品资料库id
+	private String title;		// 资料标题
+	private Integer type;		// 资料类型:1图片资料,2视频资料,3文件资料
+	private Date addTime;		// 添加时间
+	
+	public CmProductArchiveContent() {
+		super();
+	}
+
+	public CmProductArchiveContent(String id){
+		super(id);
+	}
+
+	public Integer getProductArchiveId() {
+		return productArchiveId;
+	}
+
+	public void setProductArchiveId(Integer productArchiveId) {
+		this.productArchiveId = productArchiveId;
+	}
+	
+	@Length(min=0, max=50, message="资料标题长度必须介于 0 和 50 之间")
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+	
+}

+ 44 - 0
src/main/java/com/caimei/modules/archive/service/CmProductArchiveContentService.java

@@ -0,0 +1,44 @@
+package com.caimei.modules.archive.service;
+
+import java.util.List;
+
+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.archive.entity.CmProductArchiveContent;
+import com.caimei.modules.archive.dao.CmProductArchiveContentDao;
+
+/**
+ * 商品资料内容Service
+ * @author Aslee
+ * @version 2021-09-06
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmProductArchiveContentService extends CrudService<CmProductArchiveContentDao, CmProductArchiveContent> {
+
+	public CmProductArchiveContent get(String id) {
+		return super.get(id);
+	}
+	
+	public List<CmProductArchiveContent> findList(CmProductArchiveContent cmProductArchiveContent) {
+		return super.findList(cmProductArchiveContent);
+	}
+	
+	public Page<CmProductArchiveContent> findPage(Page<CmProductArchiveContent> page, CmProductArchiveContent cmProductArchiveContent) {
+		return super.findPage(page, cmProductArchiveContent);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmProductArchiveContent cmProductArchiveContent) {
+		super.save(cmProductArchiveContent);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmProductArchiveContent cmProductArchiveContent) {
+		super.delete(cmProductArchiveContent);
+	}
+	
+}

+ 109 - 0
src/main/java/com/caimei/modules/archive/service/CmProductArchiveService.java

@@ -0,0 +1,109 @@
+package com.caimei.modules.archive.service;
+
+import java.util.Date;
+import java.util.List;
+
+import com.caimei.dfs.image.beens.ImageUploadInfo;
+import com.caimei.modules.brand.utils.ImagePathUtils;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.caimei.utils.StringUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.utils.Encodes;
+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.archive.entity.CmProductArchive;
+import com.caimei.modules.archive.dao.CmProductArchiveDao;
+
+import javax.annotation.Resource;
+
+/**
+ * 商品资料Service
+ * @author Aslee
+ * @version 2021-09-03
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmProductArchiveService extends CrudService<CmProductArchiveDao, CmProductArchive> {
+	@Resource
+	private CmProductArchiveDao cmProductArchiveDao;
+
+	public CmProductArchive get(String id) {
+		CmProductArchive cmProductArchive = super.get(id);
+		String wwwServer = Global.getConfig("wwwServer");
+		if (null != cmProductArchive.getProductId() && StringUtil.isNotBlank(cmProductArchive.getProductImage())) {
+			cmProductArchive.setProductImage(AppUtils.getImageURL("product", cmProductArchive.getProductImage(), 0, wwwServer));
+		}
+		return cmProductArchive;
+	}
+	
+	public List<CmProductArchive> findList(CmProductArchive cmProductArchive) {
+		return super.findList(cmProductArchive);
+	}
+	
+	public Page<CmProductArchive> findPage(Page<CmProductArchive> page, CmProductArchive cmProductArchive) {
+		Page<CmProductArchive> archivePage = super.findPage(page, cmProductArchive);
+		String wwwServer = Global.getConfig("wwwServer");
+		archivePage.getList().forEach(item -> {
+			if (null != item.getProductId() && StringUtils.isNotEmpty(item.getProductImage())) {
+				item.setProductImage(AppUtils.getImageURL("product", item.getProductImage(), 0, wwwServer));
+			}
+		});
+		return archivePage;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmProductArchive cmProductArchive) {
+		if (cmProductArchive.getIsNewRecord()) {
+			cmProductArchive.setAddTime(new Date());
+		}
+		if (null != cmProductArchive.getProductId()) {
+			cmProductArchive.setProductName(null);
+			cmProductArchive.setProductImage(null);
+			cmProductArchive.setShopName(null);
+		}
+		if (null == cmProductArchive.getProductId()) {
+			String productImage = cmProductArchive.getProductImage();
+			if(com.thinkgem.jeesite.common.utils.StringUtils.isNotBlank(productImage) && !productImage.startsWith("http")){
+				String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+				productImage= Encodes.urlDecode(productImage);
+				String realPath = UploadImageUtils.getAbsolutePath(productImage);
+				int pointerIndex = realPath.lastIndexOf(".");
+				ImageUploadInfo saveImageSerivce=new ImageUploadInfo();
+				try {
+					saveImageSerivce = ImagePathUtils.saveImageSerivce(realPath, pointerIndex,realPath);
+					cmProductArchive.setProductImage(photoServer+saveImageSerivce.getSource());
+				} catch (Exception e) {
+					logger.error("图片上传错误:"+e.toString(),e);
+				}
+			}
+		}
+		super.save(cmProductArchive);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmProductArchive cmProductArchive) {
+		super.delete(cmProductArchive);
+	}
+
+	@Transactional(readOnly = false)
+	public Page<Product> findProductPage(Page<Product> productPage, Product product) {
+		List<Integer> ids = cmProductArchiveDao.findArchiveProductId();
+		product.setIds(ids);
+		product.setPage(productPage);
+		List<Product> productList = cmProductArchiveDao.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;
+	}
+}

+ 76 - 0
src/main/java/com/caimei/modules/archive/web/CmProductArchiveContentController.java

@@ -0,0 +1,76 @@
+package com.caimei.modules.archive.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+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.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.archive.entity.CmProductArchiveContent;
+import com.caimei.modules.archive.service.CmProductArchiveContentService;
+
+/**
+ * 商品资料内容Controller
+ * @author Aslee
+ * @version 2021-09-06
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/archive/cmProductArchiveContent")
+public class CmProductArchiveContentController extends BaseController {
+
+	@Autowired
+	private CmProductArchiveContentService cmProductArchiveContentService;
+	
+	@ModelAttribute
+	public CmProductArchiveContent get(@RequestParam(required=false) String id) {
+		CmProductArchiveContent entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmProductArchiveContentService.get(id);
+		}
+		if (entity == null){
+			entity = new CmProductArchiveContent();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(CmProductArchiveContent cmProductArchiveContent, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmProductArchiveContent> page = cmProductArchiveContentService.findPage(new Page<CmProductArchiveContent>(request, response), cmProductArchiveContent); 
+		model.addAttribute("page", page);
+		return "modules/archive/cmProductArchiveContentList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(CmProductArchiveContent cmProductArchiveContent, Model model) {
+		model.addAttribute("cmProductArchiveContent", cmProductArchiveContent);
+		return "modules/archive/cmProductArchiveContentForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(CmProductArchiveContent cmProductArchiveContent, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmProductArchiveContent)){
+			return form(cmProductArchiveContent, model);
+		}
+		cmProductArchiveContentService.save(cmProductArchiveContent);
+		addMessage(redirectAttributes, "保存资料成功");
+		return "redirect:"+Global.getAdminPath()+"/archive/cmProductArchiveContent/?repage";
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(CmProductArchiveContent cmProductArchiveContent, RedirectAttributes redirectAttributes) {
+		cmProductArchiveContentService.delete(cmProductArchiveContent);
+		addMessage(redirectAttributes, "删除资料成功");
+		return "redirect:"+Global.getAdminPath()+"/archive/cmProductArchiveContent/?repage";
+	}
+
+}

+ 86 - 0
src/main/java/com/caimei/modules/archive/web/CmProductArchiveController.java

@@ -0,0 +1,86 @@
+package com.caimei.modules.archive.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.product.entity.Product;
+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.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.archive.entity.CmProductArchive;
+import com.caimei.modules.archive.service.CmProductArchiveService;
+
+/**
+ * 商品资料Controller
+ * @author Aslee
+ * @version 2021-09-03
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/archive/cmProductArchive")
+public class CmProductArchiveController extends BaseController {
+
+	@Autowired
+	private CmProductArchiveService cmProductArchiveService;
+	
+	@ModelAttribute
+	public CmProductArchive get(@RequestParam(required=false) String id) {
+		CmProductArchive entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmProductArchiveService.get(id);
+		}
+		if (entity == null){
+			entity = new CmProductArchive();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(CmProductArchive cmProductArchive, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmProductArchive> page = cmProductArchiveService.findPage(new Page<CmProductArchive>(request, response), cmProductArchive); 
+		model.addAttribute("page", page);
+		return "modules/archive/cmProductArchiveList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(CmProductArchive cmProductArchive, Model model) {
+		model.addAttribute("cmProductArchive", cmProductArchive);
+		return "modules/archive/cmProductArchiveForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(CmProductArchive cmProductArchive, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmProductArchive)){
+			return form(cmProductArchive, model);
+		}
+		cmProductArchiveService.save(cmProductArchive);
+		addMessage(redirectAttributes, "保存商品资料成功");
+		return "redirect:"+Global.getAdminPath()+"/archive/cmProductArchive/?repage";
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(CmProductArchive cmProductArchive, RedirectAttributes redirectAttributes) {
+		cmProductArchiveService.delete(cmProductArchive);
+		addMessage(redirectAttributes, "删除商品资料成功");
+		return "redirect:"+Global.getAdminPath()+"/archive/cmProductArchive/?repage";
+	}
+
+    @RequestMapping(value = "findProductPage")
+    public String findProductPage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<Product> page = cmProductArchiveService.findProductPage(new Page<Product>(request, response), product);
+        model.addAttribute("page", page);
+        model.addAttribute("promotionType", product.getPromotionType());
+        model.addAttribute("ids", product.getIds());
+        model.addAttribute("delProductIds", product.getDelProductIds());
+        return "modules/archive/archiveAddProduct";
+    }
+}

+ 92 - 0
src/main/resources/mappings/modules/archive/CmProductArchiveContentMapper.xml

@@ -0,0 +1,92 @@
+<?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.archive.dao.CmProductArchiveContentDao">
+    
+	<sql id="cmProductArchiveContentColumns">
+		a.id AS "id",
+		a.productArchiveId AS "productArchiveId",
+		a.title AS "title",
+		a.type AS "type",
+		a.addTime AS "addTime"
+	</sql>
+	
+	<sql id="cmProductArchiveContentJoins">
+	</sql>
+    
+	<select id="get" resultType="CmProductArchiveContent">
+		SELECT 
+			<include refid="cmProductArchiveContentColumns"/>
+		FROM cm_product_archive_content a
+		<include refid="cmProductArchiveContentJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmProductArchiveContent">
+		SELECT 
+			<include refid="cmProductArchiveContentColumns"/>
+		FROM cm_product_archive_content a
+		<include refid="cmProductArchiveContentJoins"/>
+		<where>
+			
+			<if test="title != null and title != ''">
+				AND a.title LIKE 
+					<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
+			</if>
+			<if test="type != null">
+				and a.type = #{type}
+			</if>
+		</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="CmProductArchiveContent">
+		SELECT 
+			<include refid="cmProductArchiveContentColumns"/>
+		FROM cm_product_archive_content a
+		<include refid="cmProductArchiveContentJoins"/>
+		<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="CmProductArchiveContent"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_product_archive_content(
+			productArchiveId,
+			title,
+			type,
+			addTime
+		) VALUES (
+			#{productArchiveId},
+			#{title},
+			#{type},
+			#{addTime}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_product_archive_content SET 	
+			title = #{title}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_product_archive_content
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 169 - 0
src/main/resources/mappings/modules/archive/CmProductArchiveMapper.xml

@@ -0,0 +1,169 @@
+<?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.archive.dao.CmProductArchiveDao">
+    
+	<sql id="cmProductArchiveColumns">
+		a.id AS "id",
+		a.productId AS "productId",
+		if(a.productId is not null,p.name,a.productName)  AS "productName",
+		if(a.productId is not null,s.name,a.shopName) AS "shopName",
+		if(a.productId is not null,p.mainImage,a.productImage) AS "productImage",
+		a.archiveLevel AS "archiveLevel",
+		a.productType AS "productType",
+		if(a.productId is not null,ifnull(p.commodityType,a.productClassify),a.productClassify) AS "productClassify",
+		if(a.productId is not null and p.commodityType is null,0,1) AS "existProductType",
+		a.addTime AS "addTime"
+	</sql>
+	
+	<sql id="cmProductArchiveJoins">
+	</sql>
+    
+	<select id="get" resultType="CmProductArchive">
+		SELECT 
+			<include refid="cmProductArchiveColumns"/>
+		FROM cm_product_archive a
+		left join product p on a.productId = p.productID
+		left join shop s on p.shopID = s.shopID
+		<include refid="cmProductArchiveJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmProductArchive">
+		SELECT 
+			<include refid="cmProductArchiveColumns"/>
+		FROM cm_product_archive a
+		<include refid="cmProductArchiveJoins"/>
+		left join product p on a.productId = p.productID
+	    left join shop s on p.shopID = s.shopID
+		<where>
+			
+			<if test="productName != null and productName != ''">
+				AND (a.productName LIKE
+					<if test="dbName == 'oracle'">'%'||#{productName}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{productName}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{productName},'%')</if>
+					or p.name like concat('%',#{productName},'%'))
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND (a.shopName LIKE
+					<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+					or s.name like concat('%',#{shopName},'%'))
+			</if>
+			<if test="archiveLevel != null and archiveLevel != ''">
+				AND a.archiveLevel = #{archiveLevel}
+			</if>
+			<if test="productType != null and productType != ''">
+				AND if(a.productId is not null and p.commodityType is not null,p.commodityType = #{productType}, a.productType = #{productType})
+			</if>
+			<if test="productClassify != null and productClassify != ''">
+				AND a.productClassify = #{productClassify}
+			</if>
+		</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="CmProductArchive">
+		SELECT 
+			<include refid="cmProductArchiveColumns"/>
+		FROM cm_product_archive a
+		<include refid="cmProductArchiveJoins"/>
+		<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="findArchiveProductId" resultType="java.lang.Integer">
+		SELECT IFNULL(productId,0) FROM cm_product_archive GROUP BY productId
+	</select>
+	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+		SELECT
+		a.*,s.name AS "shopName"
+		FROM product a
+		LEFT JOIN shop s on s.shopID = a.shopID
+		<where>
+			<if test="productID != null" >
+				AND a.productID = #{productID}
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+			</if>
+			<if test="ids != null and ids.size() > 0 ">
+				AND a.productID 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 a.productID
+			</otherwise>
+		</choose>
+	</select>
+
+	<insert id="insert" parameterType="CmProductArchive"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_product_archive(
+			productId,
+			productName,
+			shopName,
+			productImage,
+			archiveLevel,
+			productType,
+			productClassify,
+			addTime
+		) VALUES (
+			#{productId},
+			#{productName},
+			#{shopName},
+			#{productImage},
+			#{archiveLevel},
+			#{productType},
+			#{productClassify},
+			#{addTime}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_product_archive SET 	
+			productId = #{productId},
+			productName = #{productName},
+			shopName = #{shopName},
+			productImage = #{productImage},
+			archiveLevel = #{archiveLevel},
+			productType = #{productType},
+			productClassify = #{productClassify}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_product_archive
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 125 - 0
src/main/webapp/WEB-INF/views/modules/archive/archiveAddProduct.jsp

@@ -0,0 +1,125 @@
+<%@ 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}/archive/cmProductArchive/findProductPage" 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}"/>
+    <form:hidden path="productIds"/>
+    <form:hidden path="promotionType"/>
+    <form:hidden path="ids"/>
+    <form:hidden path="delProductIds"/>
+    <div class="ul-form">
+        <label>商品编号:</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:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"></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="radio" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img class="mainImage" src="${item.mainImage}" width="50px" height="50px"></td>
+                <td class="productName">${item.name}</td>
+                <td>${item.shopName}</td>
+                <td hidden class="commodityType">${item.commodityType}</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() {
+        var items = new Array();
+        var $items = $('.check-item:checked');
+        $items.each(function () {
+            items.push({
+                productId: $(this).val(),
+                mainImage: $(this).parents(".itemtr").find(".mainImage").attr("src"),
+                productName: $(this).parents(".itemtr").find(".productName").text(),
+                commodityType: $(this).parents(".itemtr").find(".commodityType").text()
+            })
+        });
+        return items;
+    }
+
+    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>
+

+ 54 - 0
src/main/webapp/WEB-INF/views/modules/archive/cmProductArchiveContentForm.jsp

@@ -0,0 +1,54 @@
+<%@ 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}/archive/cmProductArchiveContent/">资料列表</a></li>
+		<li class="active"><a href="${ctx}/archive/cmProductArchiveContent/form?id=${cmProductArchiveContent.id}">资料${not empty cmProductArchiveContent.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmProductArchiveContent" action="${ctx}/archive/cmProductArchiveContent/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>		
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>标题:</label>
+			<div class="controls">
+				<form:input path="title" htmlEscape="false" maxlength="50" class="input-xlarge "/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>图片:</label>
+			<div class="controls">
+				<form:input path="title" htmlEscape="false" maxlength="50" class="input-xlarge "/>
+			</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>
+</body>
+</html>

+ 82 - 0
src/main/webapp/WEB-INF/views/modules/archive/cmProductArchiveContentList.jsp

@@ -0,0 +1,82 @@
+<%@ 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}/archive/cmProductArchive/">商品资料列表</a></li>
+		<li class="active"><a href="${ctx}/archive/cmProductArchiveContent/?type=${cmProductArchiveContent.type}">${cmProductArchiveContent.type eq 1?'图片资料':cmProductArchiveContent.type eq 2?'视频资料':'文件资料'}</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmProductArchiveContent" action="${ctx}/archive/cmProductArchiveContent/" 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="type"/>
+			 <label>标题:</label>
+				<form:input path="title" htmlEscape="false" maxlength="50" class="input-medium"/>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 50px"
+							   onclick="showAddForm(${cmProductArchiveContent.type})" value="添加"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>序号</th>
+				<th>标题</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmProductArchiveContent" varStatus="index">
+			<tr>
+				<td>${index.index+1}</td>
+				<td>
+					${cmProductArchiveContent.title}
+				</td>
+				<td>
+					<fmt:formatDate value="${cmProductArchiveContent.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/archive/cmProductArchiveContent/form?id=${cmProductArchiveContent.id}">编辑</a>
+					<a href="${ctx}/archive/cmProductArchiveContent/delete?id=${cmProductArchiveContent.id}" onclick="return confirmx('确认要删除该资料吗?', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+<script>
+	function showAddForm(type) {
+		if (type == 1) {
+			window.location='${ctx}/archive/cmProductArchiveContent/form';
+		}else if (type == 2) {
+
+		}else if (type == 3) {
+
+		}
+	}
+</script>
+</body>
+</html>

+ 304 - 0
src/main/webapp/WEB-INF/views/modules/archive/cmProductArchiveForm.jsp

@@ -0,0 +1,304 @@
+<%@ 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 infoType = $("input[name='infoType']:checked").val();
+					if (infoType == 2) {
+						$("#productId").val('');
+					}else if ($("#productId").val() == '') {
+						alertx("请先选择商品");
+						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);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/archive/cmProductArchive/">商品资料列表</a></li>
+		<li class="active"><a href="${ctx}/archive/cmProductArchive/form?id=${cmProductArchive.id}">商品资料${not empty cmProductArchive.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmProductArchive" action="${ctx}/archive/cmProductArchive/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<form:hidden path="existProductType" />
+		<sys:message content="${message}"/>
+		<div class="control-group">
+			<label class="control-label">商品信息:</label>
+			<div class="controls">
+				<input type="radio" name="infoType" value="1" ${empty cmProductArchive.id ? "checked" :(not empty cmProductArchive.productId ? "checked" : "")} />商品库获取
+				<input type="radio" name="infoType" value="2" ${(not empty cmProductArchive.id && empty cmProductArchive.productId) ? "checked" : ""} />自定义
+			</div>
+		</div>
+		<div class="control-group auto">
+			<div class="controls">
+				<img id="mainImage" src="${cmProductArchive.productImage}" border="none" width="60" height="60"
+					 style="${empty cmProductArchive.productImage ? 'display:none':''}" class="productInfo">
+				<font id="productName" class="productInfo">${cmProductArchive.productName}</font>
+				<a href="JavaScript:;" onclick="showSelect()">选择商品</a>
+				<input type="hidden" name="productId" id="productId" value="${cmProductArchive.productId}">
+			</div>
+		</div>
+		<div class="control-group custom">
+			<label class="control-label">商品名称:</label>
+			<div class="controls">
+				<form:input path="productName" htmlEscape="false" maxlength="50" class="input-xlarge " placeholder="输入或选择商品" style="position:relative"/>
+			</div>
+		</div>
+		<div class="control-group custom">
+			<label class="control-label">商品图片:</label>
+			<div class="controls upload-content iconBox" id="productImageBox">
+				<div class="conList">
+					<form:hidden id="pImage" path="productImage" htmlEscape="false"
+								 maxlength="255"
+								 class="input-xlarge required"/>
+					<sys:ckfinder input="pImage" type="images" uploadPath="/photo"
+								  selectMultiple="false"
+								  maxWidth="100" maxHeight="100"/><br>
+				</div>
+			</div>
+		</div>
+		<div class="control-group custom">
+			<label class="control-label">供应商名称:</label>
+			<div class="controls">
+				<form:input path="shopName" htmlEscape="false" maxlength="50" class="input-xlarge "/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">资料等级:</label>
+			<div class="controls">
+				<form:select path="archiveLevel" class="input-medium ">
+					<form:option value="1" label="一类资料"/>
+					<form:option value="2" label="二类资料"/>
+					<form:option value="3" label="三类资料"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="control-group custom productType">
+			<label class="control-label">商品属性:</label>
+			<div class="controls">
+				<form:select path="productType" class="input-medium ">
+					<form:option value="1" label="产品"/>
+					<form:option value="2" label="仪器"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">商品分类:</label>
+			<div class="controls">
+				<form:select path="productClassify" class="input-medium ">
+					<form:option value="1" label="生美"/>
+					<form:option value="2" label="医美"/>
+				</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>
+	$(function () {
+		showInfo();
+		$('.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', '.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 () {
+				$("#productImageBox").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")
+					}
+				})
+			}, 200);
+		});
+	});
+
+	$("input[name='infoType']").change(function () {
+		showInfo();
+	})
+
+	// 展示表单信息
+	function showInfo() {
+		var infoType = $("input[name='infoType']:checked").val();
+		if (infoType == 2) {
+			$(".auto").hide();
+			$(".custom").show();
+			$(".productInfo").show();
+		} else {
+			$(".auto").show();
+			$(".custom").hide();
+			if ($("#productId").val() == '') {
+				$(".productInfo").hide();
+			}
+			if ($("#existProductType").val() == 0) {
+				$(".productType").show();
+			} else {
+				$(".productType").hide();
+			}
+		}
+	}
+
+	//选择添加商品
+	function showSelect() {
+		var url = '';
+		var title = '';
+		url = "${ctx}/archive/cmProductArchive/findProductPage";
+		title = "选择商品";
+		top.$.jBox("iframe:" + url, {
+			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 items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+					if (items.length > 0) {
+						console.log(items)
+						var productId = items[0].productId;
+						var mainImage = items[0].mainImage;
+						var productName = items[0].productName;
+						var productType = items[0].commodityType;
+						$("#mainImage").attr("src", mainImage).show();
+						$("#productName").text(productName);
+						$("#productId").val(productId);
+						$("#name").val(productName);
+						$(".productInfo").show();
+						if ('' == productType ) {
+							$(".productType").show();
+						}
+					} else {
+						top.$.jBox.tip("请先勾选商品...");
+						return false;
+					}
+				}
+				return true;
+			}
+		});
+	}
+</script>
+</body>
+</html>

+ 116 - 0
src/main/webapp/WEB-INF/views/modules/archive/cmProductArchiveList.jsp

@@ -0,0 +1,116 @@
+<%@ 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}/archive/cmProductArchive/">商品资料列表</a></li>
+		<shiro:hasPermission name="archive:cmProductArchive:edit"><li><a href="${ctx}/archive/cmProductArchive/form">商品资料添加</a></li></shiro:hasPermission>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmProductArchive" action="${ctx}/archive/cmProductArchive/" 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="productName" htmlEscape="false" maxlength="50" class="input-medium"/>
+			 <label>供应商名称:</label>
+				<form:input path="shopName" htmlEscape="false" maxlength="50" class="input-medium"/>
+			 <label>资料等级:</label>
+				<form:select path="archiveLevel" class="input-medium">
+					<form:option value="" label="全部"/>
+					<form:option value="1" label="一类资料"/>
+					<form:option value="2" label="二类资料"/>
+					<form:option value="3" label="三类资料"/>
+				</form:select>
+			 <label>商品属性:</label>
+				<form:select path="productType" class="input-medium">
+					<form:option value="" label="全部"/>
+					<form:option value="1" label="产品"/>
+					<form:option value="2" label="仪器"/>
+				</form:select>
+			 <label>商品分类:</label>
+				<form:select path="productClassify" class="input-medium">
+					<form:option value="" label="全部"/>
+					<form:option value="1" label="生美"/>
+					<form:option value="2" label="医美"/>
+				</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 50px"
+				   onclick="window.location='${ctx}/archive/cmProductArchive/form'" value="添加"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>序号</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="cmProductArchive" varStatus="index">
+			<tr>
+				<td>
+					${index.index +1}
+				</td>
+				<td>
+					${cmProductArchive.productName}
+				</td>
+				<td>
+					${cmProductArchive.shopName}
+				</td>
+				<td>
+					<img src="${cmProductArchive.productImage}" style="width: 80px">
+				</td>
+				<td>
+					${cmProductArchive.archiveLevel eq 1?'一类资料':(cmProductArchive.archiveLevel eq 2?'二类资料':'三类资料')}
+				</td>
+				<td>
+					${cmProductArchive.productType eq 1?'产品':'仪器'}
+				</td>
+				<td>
+					${cmProductArchive.productClassify eq 1?'生美':'医美'}
+				</td>
+				<td>
+					<fmt:formatDate value="${cmProductArchive.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/archive/cmProductArchive/form?id=${cmProductArchive.id}">编辑</a>
+					<a href="${ctx}/archive/cmProductArchive/delete?id=${cmProductArchive.id}" onclick="return confirmx('确认要删除该商品资料吗?', this.href)">删除</a>
+					<a href="${ctx}/archive/cmProductArchiveContent/?type=1">图片资料</a>
+					<a href="${ctx}/archive/cmProductArchiveContent/?type=2">视频资料</a>
+					<a href="${ctx}/archive/cmProductArchiveContent/?type=3">文件资料</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>