Browse Source

采美百科热搜词/banner

Aslee 3 years ago
parent
commit
9aaf57dacd

+ 24 - 0
src/main/java/com/caimei/modules/baike/dao/CmBaikeHotSearchDao.java

@@ -0,0 +1,24 @@
+package com.caimei.modules.baike.dao;
+
+import com.caimei.modules.baike.entity.CmBaikeBanner;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.baike.entity.CmBaikeHotSearch;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 采美百科热搜词DAO接口
+ * @author Aslee
+ * @version 2021-11-18
+ */
+@MyBatisDao
+public interface CmBaikeHotSearchDao extends CrudDao<CmBaikeHotSearch> {
+
+    void updateStatus(@Param("status") Integer status, @Param("hotSearchId") Integer hotSearchId);
+
+    void saveSort(@Param("sort") String sort, @Param("hotSearchId") String hotSearchId);
+
+    void saveBanner(CmBaikeBanner cmBaikeBanner);
+
+    CmBaikeBanner getBanner();
+}

+ 107 - 0
src/main/java/com/caimei/modules/baike/entity/CmBaikeBanner.java

@@ -0,0 +1,107 @@
+package com.caimei.modules.baike.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.hibernate.validator.constraints.Length;
+
+import java.util.Date;
+
+/**
+ * 采美百科bannerEntity
+ * @author Aslee
+ * @version 2021-11-18
+ */
+public class CmBaikeBanner extends DataEntity<CmBaikeBanner> {
+
+	private static final long serialVersionUID = 1L;
+	private String productPcBanner;		// 产品pc端banner
+	private String productAppBanner;		// 产品移动端banner
+	private String instrumentPcBanner;		// 仪器pc端banner
+	private String instrumentAppBanner;		// 仪器移动端banner
+	private String productLink;		// 产品banner跳转链接
+	private String instrumentLink;		// 仪器banner跳转链接
+	private Integer productStatus;		// 产品banner状态:0停用,1启用
+	private Integer instrumentStatus;		// 仪器banner状态:0停用,1启用
+
+	private Integer bannerType;		// banner类型:1产品,2仪器
+
+	public CmBaikeBanner() {
+		super();
+	}
+
+	public CmBaikeBanner(String id){
+		super(id);
+	}
+
+	public String getProductPcBanner() {
+		return productPcBanner;
+	}
+
+	public void setProductPcBanner(String productPcBanner) {
+		this.productPcBanner = productPcBanner;
+	}
+
+	public String getProductAppBanner() {
+		return productAppBanner;
+	}
+
+	public void setProductAppBanner(String productAppBanner) {
+		this.productAppBanner = productAppBanner;
+	}
+
+	public String getInstrumentPcBanner() {
+		return instrumentPcBanner;
+	}
+
+	public void setInstrumentPcBanner(String instrumentPcBanner) {
+		this.instrumentPcBanner = instrumentPcBanner;
+	}
+
+	public String getInstrumentAppBanner() {
+		return instrumentAppBanner;
+	}
+
+	public void setInstrumentAppBanner(String instrumentAppBanner) {
+		this.instrumentAppBanner = instrumentAppBanner;
+	}
+
+	public String getProductLink() {
+		return productLink;
+	}
+
+	public void setProductLink(String productLink) {
+		this.productLink = productLink;
+	}
+
+	public String getInstrumentLink() {
+		return instrumentLink;
+	}
+
+	public void setInstrumentLink(String instrumentLink) {
+		this.instrumentLink = instrumentLink;
+	}
+
+	public Integer getProductStatus() {
+		return productStatus;
+	}
+
+	public void setProductStatus(Integer productStatus) {
+		this.productStatus = productStatus;
+	}
+
+	public Integer getInstrumentStatus() {
+		return instrumentStatus;
+	}
+
+	public void setInstrumentStatus(Integer instrumentStatus) {
+		this.instrumentStatus = instrumentStatus;
+	}
+
+	public Integer getBannerType() {
+		return bannerType;
+	}
+
+	public void setBannerType(Integer bannerType) {
+		this.bannerType = bannerType;
+	}
+}

+ 109 - 0
src/main/java/com/caimei/modules/baike/entity/CmBaikeHotSearch.java

@@ -0,0 +1,109 @@
+package com.caimei.modules.baike.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-11-18
+ */
+public class CmBaikeHotSearch extends DataEntity<CmBaikeHotSearch> {
+	
+	private static final long serialVersionUID = 1L;
+	private String keyWord;		// 热搜词
+	private Integer jumpType;		// 跳转方式:1仅搜索,2产品,3仪器,4链接
+	private Integer productId;		// 产品/仪器id
+	private String jumpLink;		// 跳转链接
+	private Integer sort;		// 排序值
+	private Integer status;		// 状态:0停用,1启用
+	private Date addTime;		// 添加时间
+	private Integer addBy;		// 添加人
+
+	private String addUserName;		//添加人名称
+	
+	public CmBaikeHotSearch() {
+		super();
+	}
+
+	public CmBaikeHotSearch(String id){
+		super(id);
+	}
+
+	@Length(min=0, max=15, message="热搜词长度必须介于 0 和 15 之间")
+	public String getKeyWord() {
+		return keyWord;
+	}
+
+	public void setKeyWord(String keyWord) {
+		this.keyWord = keyWord;
+	}
+	
+	public Integer getJumpType() {
+		return jumpType;
+	}
+
+	public void setJumpType(Integer jumpType) {
+		this.jumpType = jumpType;
+	}
+	
+	public Integer getProductId() {
+		return productId;
+	}
+
+	public void setProductId(Integer productId) {
+		this.productId = productId;
+	}
+	
+	public String getJumpLink() {
+		return jumpLink;
+	}
+
+	public void setJumpLink(String jumpLink) {
+		this.jumpLink = jumpLink;
+	}
+	
+	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;
+	}
+	
+	public Integer getAddBy() {
+		return addBy;
+	}
+
+	public void setAddBy(Integer addBy) {
+		this.addBy = addBy;
+	}
+
+	public String getAddUserName() {
+		return addUserName;
+	}
+
+	public void setAddUserName(String addUserName) {
+		this.addUserName = addUserName;
+	}
+}

+ 63 - 0
src/main/java/com/caimei/modules/baike/service/CmBaikeHotSearchService.java

@@ -0,0 +1,63 @@
+package com.caimei.modules.baike.service;
+
+import java.util.List;
+
+import com.caimei.modules.baike.entity.CmBaikeBanner;
+import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.miniprogram.utils.UploadPicUtils;
+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.baike.entity.CmBaikeHotSearch;
+import com.caimei.modules.baike.dao.CmBaikeHotSearchDao;
+
+import javax.annotation.Resource;
+
+/**
+ * 采美百科热搜词Service
+ * @author Aslee
+ * @version 2021-11-18
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmBaikeHotSearchService extends CrudService<CmBaikeHotSearchDao, CmBaikeHotSearch> {
+
+	@Resource
+	private CmBaikeHotSearchDao cmBaikeHotSearchDao;
+
+	public CmBaikeHotSearch get(String id) {
+		return super.get(id);
+	}
+	
+	public List<CmBaikeHotSearch> findList(CmBaikeHotSearch cmBaikeHotSearch) {
+		return super.findList(cmBaikeHotSearch);
+	}
+	
+	public Page<CmBaikeHotSearch> findPage(Page<CmBaikeHotSearch> page, CmBaikeHotSearch cmBaikeHotSearch) {
+		return super.findPage(page, cmBaikeHotSearch);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmBaikeHotSearch cmBaikeHotSearch) {
+		super.save(cmBaikeHotSearch);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmBaikeHotSearch cmBaikeHotSearch) {
+		super.delete(cmBaikeHotSearch);
+	}
+
+	@Transactional(readOnly = false)
+	public void saveBanner(CmBaikeBanner cmBaikeBanner) {
+        if (1 == cmBaikeBanner.getBannerType()) {
+            cmBaikeBanner.setProductPcBanner(UploadPicUtils.saveImageToServer(cmBaikeBanner.getProductPcBanner()));
+            cmBaikeBanner.setProductAppBanner(UploadPicUtils.saveImageToServer(cmBaikeBanner.getProductAppBanner()));
+        } else {
+            cmBaikeBanner.setInstrumentPcBanner(UploadPicUtils.saveImageToServer(cmBaikeBanner.getInstrumentPcBanner()));
+            cmBaikeBanner.setInstrumentAppBanner(UploadPicUtils.saveImageToServer(cmBaikeBanner.getInstrumentAppBanner()));
+        }
+		cmBaikeHotSearchDao.saveBanner(cmBaikeBanner);
+	}
+}

+ 162 - 0
src/main/java/com/caimei/modules/baike/web/CmBaikeHotSearchController.java

@@ -0,0 +1,162 @@
+package com.caimei.modules.baike.web;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.baike.dao.CmBaikeHotSearchDao;
+import com.caimei.modules.baike.entity.CmBaikeBanner;
+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.baike.entity.CmBaikeHotSearch;
+import com.caimei.modules.baike.service.CmBaikeHotSearchService;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 采美百科热搜词Controller
+ * @author Aslee
+ * @version 2021-11-18
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/baike/cmBaikeHotSearch")
+public class CmBaikeHotSearchController extends BaseController {
+
+	@Autowired
+	private CmBaikeHotSearchService cmBaikeHotSearchService;
+	
+	@Resource
+	private CmBaikeHotSearchDao cmBaikeHotSearchDao;
+	
+	@ModelAttribute
+	public CmBaikeHotSearch get(@RequestParam(required=false) String id) {
+		CmBaikeHotSearch entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmBaikeHotSearchService.get(id);
+		}
+		if (entity == null){
+			entity = new CmBaikeHotSearch();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(CmBaikeHotSearch cmBaikeHotSearch, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmBaikeHotSearch> page = cmBaikeHotSearchService.findPage(new Page<CmBaikeHotSearch>(request, response), cmBaikeHotSearch); 
+		model.addAttribute("page", page);
+		return "modules/baike/cmBaikeHotSearchList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(CmBaikeHotSearch cmBaikeHotSearch, Model model) {
+		model.addAttribute("cmBaikeHotSearch", cmBaikeHotSearch);
+		return "modules/baike/cmBaikeHotSearchForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(CmBaikeHotSearch cmBaikeHotSearch, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmBaikeHotSearch)){
+			return form(cmBaikeHotSearch, model);
+		}
+		cmBaikeHotSearchService.save(cmBaikeHotSearch);
+		addMessage(redirectAttributes, "保存热搜词成功");
+		return "redirect:"+Global.getAdminPath()+"/baike/cmBaikeHotSearch/?repage";
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(CmBaikeHotSearch cmBaikeHotSearch, RedirectAttributes redirectAttributes) {
+		cmBaikeHotSearchService.delete(cmBaikeHotSearch);
+		addMessage(redirectAttributes, "删除热搜词成功");
+		return "redirect:"+Global.getAdminPath()+"/baike/cmBaikeHotSearch/?repage";
+	}
+
+	@RequestMapping(value = "updateStatus")
+	@ResponseBody
+	public Map<String,Object> updateStatus(Integer status, Integer hotSearchId) {
+		HashMap<String, Object> result = new HashMap<>(2);
+		cmBaikeHotSearchDao.updateStatus(status, hotSearchId);
+		result.put("success", true);
+		result.put("msg", (status == 1 ? "启用" : "停用") + "热搜词成功");
+		return result;
+	}
+
+	/**
+	 * 批量更新排序值
+	 */
+	@RequestMapping(value = "batchSaveSort")
+	@ResponseBody
+	public Map<String, Object> batchSaveSort(String sortList) {
+		Map<String, Object> map = Maps.newLinkedHashMap();
+		try {
+			String[] newPageLists = sortList.split(",");
+			for (String list : newPageLists) {
+				String[] split = list.split("-");
+				if (split.length == 1 || split.length < 1) {
+					String id = split[0];
+					String sort = null;
+					cmBaikeHotSearchDao.saveSort(sort, id);
+				} else {
+					String id = split[0];
+					String sort = split[1];
+					if (isInteger(sort)) {
+						if (StringUtils.equals("0", sort)) {
+							map.put("success", false);
+							map.put("msg", "排序值只能填写大于等于1的整数");
+							return map;
+						}
+						cmBaikeHotSearchDao.saveSort(sort, id);
+					} else {
+						map.put("success", false);
+						map.put("msg", "排序值只能为数字");
+						return map;
+					}
+				}
+			}
+			map.put("success", true);
+			map.put("msg", "更新排序成功");
+			return map;
+		} catch (Exception e) {
+			map.put("success", false);
+			map.put("msg", "更新排序失败");
+			return map;
+		}
+	}
+
+
+	@RequestMapping(value = "bannerForm")
+	public String bannerForm(CmBaikeBanner cmBaikeBanner, Model model) {
+        CmBaikeBanner banner = cmBaikeHotSearchDao.getBanner();
+        banner.setBannerType(cmBaikeBanner.getBannerType());
+		model.addAttribute("cmBaikeBanner", banner);
+		return "modules/baike/cmBaikeBannerForm";
+	}
+
+
+	@RequestMapping(value = "saveBanner")
+	public String saveBanner(CmBaikeBanner cmBaikeBanner, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmBaikeBanner)){
+			return bannerForm(cmBaikeBanner, model);
+		}
+		cmBaikeHotSearchService.saveBanner(cmBaikeBanner);
+		addMessage(redirectAttributes, "保存banner成功");
+		return "redirect:" + Global.getAdminPath() + "/baike/cmBaikeHotSearch/bannerForm?repage&bannerType="
+				+ cmBaikeBanner.getBannerType();
+	}
+
+}

+ 140 - 0
src/main/resources/mappings/modules/baike/CmBaikeHotSearchMapper.xml

@@ -0,0 +1,140 @@
+<?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.baike.dao.CmBaikeHotSearchDao">
+    
+	<sql id="cmBaikeHotSearchColumns">
+		a.id AS "id",
+		a.keyWord AS "keyWord",
+		a.jumpType AS "jumpType",
+		a.productId AS "productId",
+		a.jumpLink AS "jumpLink",
+		a.sort AS "sort",
+		a.status AS "status",
+		a.addTime AS "addTime",
+		a.addBy AS "addBy",
+		su.name as "addUserName"
+	</sql>
+	
+	<sql id="cmBaikeHotSearchJoins">
+		left join sys_user su on a.addBy = su.id
+	</sql>
+    
+	<select id="get" resultType="CmBaikeHotSearch">
+		SELECT 
+			<include refid="cmBaikeHotSearchColumns"/>
+		FROM cm_baike_hot_search a
+		<include refid="cmBaikeHotSearchJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmBaikeHotSearch">
+		SELECT 
+			<include refid="cmBaikeHotSearchColumns"/>
+		FROM cm_baike_hot_search a
+		<include refid="cmBaikeHotSearchJoins"/>
+		<where>
+			
+			<if test="id != null and id != ''">
+				AND a.id = #{id}
+			</if>
+			<if test="keyWord != null and keyWord != ''">
+				AND a.keyWord LIKE 
+					<if test="dbName == 'oracle'">'%'||#{keyWord}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{keyWord}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{keyWord},'%')</if>
+			</if>
+			<if test="status != null and status != ''">
+				AND a.status = #{status}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				order by a.addTime desc
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmBaikeHotSearch">
+		SELECT 
+			<include refid="cmBaikeHotSearchColumns"/>
+		FROM cm_baike_hot_search a
+		<include refid="cmBaikeHotSearchJoins"/>
+		<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="getBanner" resultType="com.caimei.modules.baike.entity.CmBaikeBanner">
+        select * from cm_baike_banner where id = 1
+    </select>
+
+    <insert id="insert" parameterType="CmBaikeHotSearch"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_baike_hot_search(
+			keyWord,
+			jumpType,
+			productId,
+			jumpLink,
+			sort,
+			status,
+			addTime,
+			addBy
+		) VALUES (
+			#{keyWord},
+			#{jumpType},
+			#{productId},
+			#{jumpLink},
+			#{sort},
+			#{status},
+			NOW(),
+			#{createBy.id}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_baike_hot_search SET 	
+			keyWord = #{keyWord},
+			jumpType = #{jumpType},
+			productId = #{productId},
+			jumpLink = #{jumpLink},
+			sort = #{sort},
+			status = #{status}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_baike_hot_search
+		WHERE id = #{id}
+	</delete>
+
+
+	<update id="updateStatus">
+		update cm_baike_hot_search set status = #{status} where id = #{hotSearchId}
+	</update>
+
+	<update id="saveSort">
+		update cm_baike_hot_search set sort = #{sort} where id = #{hotSearchId}
+	</update>
+	<update id="saveBanner">
+		update cm_baike_banner
+		<set>
+			<if test="bannerType != null and bannerType == 1">
+				productPcBanner = #{productPcBanner},productAppBanner =
+				#{productAppBanner},productLink=#{productLink},productStatus = #{productStatus}
+			</if>
+			<if test="bannerType != null and bannerType == 2">
+				instrumentPcBanner = #{instrumentPcBanner},instrumentAppBanner =
+				#{instrumentAppBanner},instrumentLink=#{instrumentLink},instrumentStatus = #{instrumentStatus}
+			</if>
+		</set>
+		where id = 1
+	</update>
+</mapper>

+ 274 - 0
src/main/webapp/WEB-INF/views/modules/baike/cmBaikeBannerForm.jsp

@@ -0,0 +1,274 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>banner管理</title>
+	<meta name="decorator" content="default"/>
+	<style>
+		.jumpType{
+			margin-left: 20px;
+			width: 400px;
+		}
+	</style>
+	<style>
+		.iconBox {
+			font-size: 0;
+		}
+
+		.controls .conList {
+			display: inline-block;
+			margin-right: 15px;
+		}
+
+		.conList .btn:nth-of-type(1) {
+			margin-left: 25px;
+		}
+
+		.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;
+		}
+
+		.paramRow {
+			margin-top: 10px;
+		}
+	</style>
+	<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  class="${cmBaikeBanner.bannerType eq 1?'active':''}">
+			<a href="${ctx}/baike/cmBaikeHotSearch/bannerForm?bannerType=1">产品banner</a>
+		</li>
+		<li  class="${cmBaikeBanner.bannerType eq 2?'active':''}">
+			<a href="${ctx}/baike/cmBaikeHotSearch/bannerForm?bannerType=2">仪器banner</a>
+		</li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmBaikeBanner" action="${ctx}/baike/cmBaikeHotSearch/saveBanner" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<form:hidden path="bannerType" />
+		<sys:message content="${message}"/>
+		<div id="pcBanner" style="${cmBaikeBanner.bannerType eq 1?'':'display:none'}">
+			<div class="control-group iconBox">
+				<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>PC端banner:</label>
+				<div class="controls upload-content" id="bannerBox1">
+					<div class="conList">
+						<form:hidden id="productPcBanner" path="productPcBanner" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+						<sys:ckfinder input="productPcBanner" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
+									  maxHeight="100"/>
+						<br>
+						<label style="margin-left: 150px">建议图片分辨率1920px*510px</label>
+					</div>
+				</div>
+			</div>
+			<div class="control-group iconBox">
+				<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>移动端banner:</label>
+				<div class="controls upload-content" id="bannerBox2">
+					<div class="conList">
+						<form:hidden id="productAppBanner" path="productAppBanner" htmlEscape="false" maxlength="255"
+									 class="input-xlarge required"/>
+						<sys:ckfinder input="productAppBanner" type="images" uploadPath="/photo" selectMultiple="false"
+									  maxWidth="100" maxHeight="100"/>
+						<br>
+						<label style="margin-left: 150px">建议图片分辨率750px*366px</label>
+					</div>
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label">banner跳转链接:</label>
+				<div class="controls">
+					<form:input path="productLink" htmlEscape="false" placeholder="输入URL地址"
+								class="input-xlarge"/>
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label">状态:</label>
+				<div class="controls">
+					<form:select path="productStatus" class="input-xlarge required">
+						<form:option value="1" label="启用"/>
+						<form:option value="0" label="停用"/>
+					</form:select>
+				</div>
+			</div>
+
+		</div>
+
+
+		<div id="appBanner" style="${cmBaikeBanner.bannerType eq 2?'':'display:none'}">
+			<div class="control-group iconBox">
+				<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>PC端banner:</label>
+				<div class="controls upload-content" id="bannerBox3">
+					<div class="conList">
+						<form:hidden id="instrumentPcBanner" path="instrumentPcBanner" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+						<sys:ckfinder input="instrumentPcBanner" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
+									  maxHeight="100"/>
+						<br>
+						<label style="margin-left: 150px">建议图片分辨率1920px*510px</label>
+					</div>
+				</div>
+			</div>
+			<div class="control-group iconBox">
+				<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>移动端banner:</label>
+				<div class="controls upload-content" id="bannerBox4">
+					<div class="conList">
+						<form:hidden id="instrumentAppBanner" path="instrumentAppBanner" htmlEscape="false" maxlength="255"
+									 class="input-xlarge required"/>
+						<sys:ckfinder input="instrumentAppBanner" type="images" uploadPath="/photo" selectMultiple="false"
+									  maxWidth="100" maxHeight="100"/>
+						<br>
+						<label style="margin-left: 150px">建议图片分辨率750px*366px</label>
+					</div>
+				</div>
+			</div>
+
+			<div class="control-group">
+				<label class="control-label">banner跳转链接:</label>
+				<div class="controls">
+					<form:input path="instrumentLink" htmlEscape="false" placeholder="输入URL地址"
+								class="input-xlarge"/>
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label">状态:</label>
+				<div class="controls">
+					<form:select path="instrumentStatus" class="input-xlarge required">
+						<form:option value="1" label="启用"/>
+						<form:option value="0" label="停用"/>
+					</form:select>
+				</div>
+			</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 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');
+					}
+				}
+			})
+		});
+		for (var i = 0; i < 4; i++) {
+			var observeEle = document.getElementsByClassName('upload-content')[i];
+			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 () {
+				for (var i = 1;i<=4;i++) {
+					$("#bannerBox" + i).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);
+		});
+	});
+</script>
+</body>
+</html>

+ 91 - 0
src/main/webapp/WEB-INF/views/modules/baike/cmBaikeHotSearchForm.jsp

@@ -0,0 +1,91 @@
+<%@ 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>
+		.jumpType{
+			margin-left: 20px;
+			width: 400px;
+		}
+	</style>
+	<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}/baike/cmBaikeHotSearch/">热搜词列表</a></li>
+		<li class="active"><a href="${ctx}/baike/cmBaikeHotSearch/form?id=${cmBaikeHotSearch.id}">热搜词${not empty cmBaikeHotSearch.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmBaikeHotSearch" action="${ctx}/baike/cmBaikeHotSearch/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="keyWord" htmlEscape="false" maxlength="15" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>跳转方式:</label>
+			<div class="controls">
+				<form:radiobutton path="jumpType"  name="jumpType" value="1" label="仅搜索" checked="true"/>
+				<br> <br>
+				<form:radiobutton path="jumpType" name="jumpType" value="2" label="产品" />
+				<br> <br>
+				<form:radiobutton path="jumpType" name="jumpType" value="3" label="仪器" />
+				<br> <br>
+				<form:radiobutton path="jumpType" name="jumpType" value="4" label="链接" />
+				<form:input path="jumpLink" htmlEscape="false" class="input-xlarge jumpType"/>
+			</div>
+		</div>
+		<%--<div class="control-group">
+			<label class="control-label">产品/仪器id:</label>
+			<div class="controls">
+				<form:select path="productId" class="input-xlarge ">
+					<form:option value="" label=""/>
+					<form:options items="${fns:getDictList('')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+				</form:select>
+			</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"  class="input-xlarge  digits required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">状态:</label>
+			<div class="controls">
+				<form:select path="status" class="input-xlarge required">
+					<form:option value="1" label="启用"/>
+					<form:option value="0" 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>
+</body>
+</html>

+ 154 - 0
src/main/webapp/WEB-INF/views/modules/baike/cmBaikeHotSearchList.jsp

@@ -0,0 +1,154 @@
+<%@ 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}/baike/cmBaikeHotSearch/">热搜词列表</a></li>
+		<li><a href="${ctx}/baike/cmBaikeHotSearch/form">热搜词添加</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmBaikeHotSearch" action="${ctx}/baike/cmBaikeHotSearch/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>ID:</label>
+				<form:input path="id" htmlEscape="false" class="input-medium"/>
+			 <label>热搜词:</label>
+				<form:input path="keyWord" htmlEscape="false" maxlength="15" class="input-medium"/>
+			 <label>状态:</label>
+				<form:select path="status" 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="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" 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>ID</th>
+				<th>热搜词</th>
+				<th>排序</th>
+				<th>状态</th>
+				<th>添加时间</th>
+				<th>添加人</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmBaikeHotSearch">
+			<tr>
+				<input class="check-item" type="hidden" id="saveSort${cmBaikeHotSearch.id}" value='${cmBaikeHotSearch.id}-${cmBaikeHotSearch.sort}'/>
+				<td>
+					${cmBaikeHotSearch.id}
+				</td>
+				<td>
+					${cmBaikeHotSearch.keyWord}
+				</td>
+				<td>
+					<input id="sort" name="sort" style="width:50px;" value="${cmBaikeHotSearch.sort}"  onkeyup="onlynum(this)"  onchange="changeSort(${cmHeheFloor.id},this)">
+				</td>
+				<td>
+					<c:if test="${cmBaikeHotSearch.status eq 1 }">
+						<font color="green">已启用</font>
+						<a href="javascript:void(0);" onclick="updateStatus(0,${cmBaikeHotSearch.id});" >
+							停用
+						</a>
+					</c:if>
+					<c:if test="${cmBaikeHotSearch.status ne 1 }">
+						<font color="red">已停用</font>
+						<a href="javascript:void(0)" onclick="updateStatus(1,${cmBaikeHotSearch.id});">
+							启用
+						</a>
+					</c:if>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmBaikeHotSearch.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					${cmBaikeHotSearch.addUserName}
+				</td>
+				<td>
+    				<a href="${ctx}/baike/cmBaikeHotSearch/form?id=${cmBaikeHotSearch.id}">编辑</a>
+					<a href="${ctx}/baike/cmBaikeHotSearch/delete?id=${cmBaikeHotSearch.id}" onclick="return confirmx('确认要删除该热搜词吗?', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+
+
+<script>
+	function updateStatus(status, hotSearchId) {
+		var msg='确定启用该热搜词吗?';
+		if(0==status) {
+			msg = '确定停用该热搜词吗?';
+		}
+		top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+			if(v=='ok'){
+				$.post("${ctx}/baike/cmBaikeHotSearch/updateStatus",{'status':status,'hotSearchId':hotSearchId}, function(data) {
+					if(true==data.success){
+						$.jBox.tip(data.msg, 'info');
+					} else {
+						$.jBox.tip(data.msg,'error');
+					}
+					setTimeout(function () {
+						$("#searchForm").submit();
+					},1000)
+				},"JSON");//这里返回的类型有:json,html,xml,text
+			}
+			return;
+		},{buttonsFocus:1,persistent: true});
+	}
+
+	//批量保存排序
+	function batchSaveSort() {
+		var items = new Array();
+		var $items = $('.check-item');
+		$items.each(function(){
+			items.push($(this).val());
+		});
+		//保存批量排序
+		$.post("${ctx}/baike/cmBaikeHotSearch/batchSaveSort?sortList="+items, function(data) {
+			if(true==data.success){
+				$.jBox.tip(data.msg, 'info');
+				setTimeout(function () {
+					$("#searchForm").submit();
+				},200)
+			} else {
+				$.jBox.tip(data.msg,'error');
+			}
+		},"JSON");//这里返回的类型有:json,html,xml,text
+	}
+
+	//修改排序值
+	function changeSort(id,sortThis) {
+		var value = sortThis.value;
+		$("#saveSort"+id).val(id+"-"+value);
+	}
+</script>
+</body>
+</html>