提交 8cc3fd66 authored 作者: Mangostiffy's avatar Mangostiffy

新增分享日志

上级 4054514d
package com.mall.controller.tongmeng.share;
import com.mall.controller.base.BaseController;
import com.mall.entity.Page;
import com.mall.service.mengbeng.share.ShareManager;
import com.mall.util.Jurisdiction;
import com.mall.util.PageData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping(value="/share")
public class Sharecontroller extends BaseController {
String menuUrl = "share/list.do"; //菜单地址(权限用)
@Resource(name="shareService")
private ShareManager shareService;
/**列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
public ModelAndView list(Page page) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"列表Foruminfo");
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
String keywords = pd.getString("keywords"); //关键词检索条件
if(null != keywords && !"".equals(keywords)){
pd.put("keywords", keywords.trim());
}
page.setPd(pd);
List<PageData> varList = shareService.list(page);
mv.setViewName("tongmeng/share/share_list");
mv.addObject("varList", varList);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
return mv;
}
}
package com.mall.service.mengbeng.share;
import com.mall.entity.Page;
import com.mall.util.PageData;
import java.util.List;
public interface ShareManager {
/**
* 分享
......@@ -9,4 +12,12 @@ public interface ShareManager {
* @throws Exception
*/
public void saveShare(PageData pd) throws Exception;
/**
* 列表
* @param page
* @return
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception;
}
package com.mall.service.mengbeng.share.impl;
import com.mall.dao.DaoSupport;
import java.util.List;
import javax.annotation.Resource;
import com.mall.service.mengbeng.share.ShareManager;
import com.mall.util.PageData;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.mall.dao.DaoSupport;
import com.mall.entity.Page;
import com.mall.util.PageData;
@Service("shareService")
public class ShareService implements ShareManager {
......@@ -21,4 +25,9 @@ public class ShareService implements ShareManager {
public void saveShare(PageData pd) throws Exception {
dao.save("ShareMapper.saveShare",pd);
}
@Override
public List<PageData> list(Page page) throws Exception {
return (List<PageData>)dao.findForList("ShareMapper.DatalistPage", page);
}
}
......@@ -2,10 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="ShareMapper">
<sql id="tableName">
c_share_store
</sql>
<!--分享-->
<insert id="saveShare" parameterType="pd">
insert into
c_share_store
<include refid="tableName"></include>
(
share_store,
shareed_store,
......@@ -19,4 +23,19 @@
)
</insert>
<!--列表-->
<select id="DatalistPage" parameterType="page" resultType="pd">
select
share_store,
share.store_name as share_store_name,
shareed_store,
shared.store_name as shared_store_name,
share_time
from
<include refid="tableName"></include>
inner join c_store as share on share.store_id=<include refid="tableName"></include>.share_store
inner join c_store as shared on shared.store_id=<include refid="tableName"></include>.shareed_store
order by share_time desc
</select>
</mapper>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 下拉框 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/ace/css/chosen.css" />
<!-- jsp文件头和头部 -->
<%@ include file="../../system/index/top.jsp"%>
<!-- 日期框 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/ace/css/datepicker.css" />
</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
<!-- /section:basics/sidebar -->
<div class="main-content">
<div class="main-content-inner">
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<!-- 检索 -->
<form action="list.do" method="post" name="Form" id="Form">
<table style="margin-top:5px;">
<tr>
<td>
<div class="nav-search">
<span class="input-icon">
<input type="text" placeholder="这里输入店铺名" class="nav-search-input" id="nav-search-input" autocomplete="off" name="keywords" value="${pd.keywords }" placeholder="这里输入关键词"/>
<i class="ace-icon fa fa-search nav-search-icon"></i>
</span>
</div>
</td>
<%--<td style="padding-left:2px;"><input class="span10 date-picker" name="lastStart" id="lastStart" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="开始日期" title="开始日期"/></td>
<td style="padding-left:2px;"><input class="span10 date-picker" name="lastEnd" name="lastEnd" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="结束日期" title="结束日期"/></td>
<td style="vertical-align:top;padding-left:2px;">
<select class="chosen-select form-control" name="name" id="id" data-placeholder="请选择" style="vertical-align:top;width: 120px;">
<option value=""></option>
<option value="">全部</option>
<option value="">1</option>
<option value="">2</option>
</select>
</td>
<c:if test="${QX.cha == 1 }">
<td style="vertical-align:top;padding-left:2px"><a class="btn btn-light btn-xs" onclick="tosearch();" title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td>
</c:if>
<c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if>
--%>
</tr>
</table>
<!-- 检索 -->
<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;">
<thead>
<tr>
<th class="center" style="width:50px;">序号</th>
<th class="center">分享店铺名</th>
<th class="center">被分享店铺名</th>
<th class="center">分享时间</th>
</tr>
</thead>
<tbody>
<!-- 开始循环 -->
<c:choose>
<c:when test="${not empty varList}">
<c:if test="${QX.cha == 1 }">
<c:forEach items="${varList}" var="var" varStatus="vs">
<tr>
<td class='center' style="width: 30px;">${vs.index+1}</td>
<td class='center'>${var.share_store_name}</td>
<td class='center'>${var.shared_store_name}</td>
<td class='center'>${var.share_time}</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${QX.cha == 0 }">
<tr>
<td colspan="100" class="center">您无权查看</td>
</tr>
</c:if>
</c:when>
<c:otherwise>
<tr class="main_info">
<td colspan="100" class="center" >没有相关数据</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
<div class="page-header position-relative">
<table style="width:100%;">
<tr>
<%--<td style="vertical-align:top;">
<c:if test="${QX.add == 1 }">
<a class="btn btn-mini btn-success" onclick="add();">新增</a>
</c:if>
&lt;%&ndash; <c:if test="${QX.del == 1 }">
<a class="btn btn-mini btn-danger" onclick="makeAll('确定要删除选中的数据吗?');" title="批量删除" ><i class='ace-icon fa fa-trash-o bigger-120'></i></a>
</c:if> &ndash;%&gt;
</td> --%>
<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
</tr>
</table>
</div>
</form>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.page-content -->
</div>
</div>
<!-- /.main-content -->
<!-- 返回顶部 -->
<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>
</div>
<!-- /.main-container -->
<!-- basic scripts -->
<!-- 页面底部js¨ -->
<%@ include file="../../system/index/foot.jsp"%>
<!-- 删除时确认窗口 -->
<script src="${pageContext.request.contextPath}/static/ace/js/bootbox.js"></script>
<!-- ace scripts -->
<script src="${pageContext.request.contextPath}/static/ace/js/ace/ace.js"></script>
<!-- 下拉框 -->
<script src="${pageContext.request.contextPath}/static/ace/js/chosen.jquery.js"></script>
<!-- 日期框 -->
<script src="${pageContext.request.contextPath}/static/ace/js/date-time/bootstrap-datepicker.js"></script>
<!--提示框-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.tips.js"></script>
<script type="text/javascript">
$(top.hangge());//关闭加载状态
//检索
function tosearch(){
top.jzts();
$("#Form").submit();
}
$(function() {
//日期框
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
});
//下拉框
if(!ace.vars['touch']) {
$('.chosen-select').chosen({allow_single_deselect:true});
$(window)
.off('resize.chosen')
.on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({'width': $this.parent().width()});
});
}).trigger('resize.chosen');
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if(event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({'width': $this.parent().width()});
});
});
$('#chosen-multiple-style .btn').on('click', function(e){
var target = $(this).find('input[type=radio]');
var which = parseInt(target.val());
if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
else $('#form-field-select-4').removeClass('tag-input-style');
});
}
//复选框全选控制
var active_class = 'active';
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;//checkbox inside "TH" table header
$(this).closest('table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
});
});
});
//新增
function add(){
top.jzts();
var diag = new top.Dialog();
diag.Drag=true;
diag.Title ="新增";
diag.URL = '${pageContext.request.contextPath}/oneclassfy/goAdd.do';
diag.Width = 900;
diag.Height = 710;
diag.Modal = true; //有无遮罩窗口
diag. ShowMaxButton = true; //最大化按钮
diag.ShowMinButton = true; //最小化按钮
diag.CancelEvent = function(){ //关闭事件
if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
nextPage(${page.totalPage});
}
diag.close();
};
diag.show();
}
//删除
function del(Id){
bootbox.confirm("确定要删除吗?", function(result) {
if(result) {
top.jzts();
var url = "${pageContext.request.contextPath}/oneclassfy/delete.do?CLASSIFY_ID="+Id+"&tm="+new Date().getTime();
$.get(url,function(data){
if(data.flag==1){
nextPage(${page.currentPage});
}else{
alert(data.errmsg);
nextPage(${page.currentPage});
}
});
}
});
}
//修改
function edit(Id){
top.jzts();
var diag = new top.Dialog();
diag.Drag=true;
diag.Title ="编辑";
diag.URL = '${pageContext.request.contextPath}/oneclassfy/goEdit.do?CLASSIFY_ID='+Id;
diag.Width = 900;
diag.Height = 710;
diag.Modal = true; //有无遮罩窗口
diag. ShowMaxButton = true; //最大化按钮
diag.ShowMinButton = true; //最小化按钮
diag.CancelEvent = function(){ //关闭事件
if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
nextPage(${page.currentPage});
}
diag.close();
};
diag.show();
}
//批量操作
function makeAll(msg){
bootbox.confirm(msg, function(result) {
if(result) {
var str = '';
for(var i=0;i < document.getElementsByName('ids').length;i++){
if(document.getElementsByName('ids')[i].checked){
if(str=='') str += document.getElementsByName('ids')[i].value;
else str += ',' + document.getElementsByName('ids')[i].value;
}
}
if(str==''){
bootbox.dialog({
message: "<span class='bigger-110'>您没有选择任何内容!</span>",
buttons:
{ "button":{ "label":"确定", "className":"btn-sm btn-success"}}
});
$("#zcheckbox").tips({
side:1,
msg:'点这里全选',
bg:'#AE81FF',
time:8
});
return;
}else{
if(msg == '确定要删除选中的数据吗?'){
top.jzts();
$.ajax({
type: "POST",
url: '${pageContext.request.contextPath}/oneclassfy/deleteAll.do?tm='+new Date().getTime(),
data: {DATA_IDS:str},
dataType:'json',
//beforeSend: validateData,
cache: false,
success: function(data){
$.each(data.list, function(i, list){
tosearch();
});
}
});
}
}
}
});
};
//导出excel
function toExcel(){
window.location.href='${pageContext.request.contextPath}/oneclassfy/excel.do';
}
</script>
</body>
</html>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论