Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
T
tongmeng-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
林海冰
tongmeng-app
Commits
16094efc
提交
16094efc
authored
1月 17, 2019
作者:
Mangostiffy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增后台抽奖管理
上级
bb8d7ed0
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
935 行增加
和
0 行删除
+935
-0
LotteryController.java
...m/mall/controller/tongmeng/lottery/LotteryController.java
+207
-0
LotteryManager.java
...ava/com/mall/service/mengbeng/lottery/LotteryManager.java
+57
-0
LotteryService.java
...om/mall/service/mengbeng/lottery/impl/LotteryService.java
+82
-0
LotteryMapper.xml
src/main/resources/mybatis1/tongmeng/LotteryMapper.xml
+106
-0
lottery_edit.jsp
...main/webapp/WEB-INF/jsp/tongmeng/lottery/lottery_edit.jsp
+117
-0
lottery_list.jsp
...main/webapp/WEB-INF/jsp/tongmeng/lottery/lottery_list.jsp
+366
-0
没有找到文件。
src/main/java/com/mall/controller/tongmeng/lottery/LotteryController.java
0 → 100644
浏览文件 @
16094efc
package
com
.
mall
.
controller
.
tongmeng
.
lottery
;
import
java.io.PrintWriter
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.annotation.Resource
;
import
com.mall.service.mengbeng.lottery.LotteryManager
;
import
org.springframework.beans.propertyeditors.CustomDateEditor
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.InitBinder
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.mall.controller.base.BaseController
;
import
com.mall.entity.Page
;
import
com.mall.util.AppUtil
;
import
com.mall.util.ObjectExcelView
;
import
com.mall.util.PageData
;
import
com.mall.util.Jurisdiction
;
import
com.mall.util.Tools
;
/**
* 说明:抽奖
* 创建时间:2019-01-17
*/
@Controller
@RequestMapping
(
value
=
"/lottery"
)
public
class
LotteryController
extends
BaseController
{
String
menuUrl
=
"lottery/list.do"
;
//菜单地址(权限用)
@Resource
(
name
=
"lotteryService"
)
private
LotteryManager
lotteryService
;
/**保存
* @param
* @throws Exception
*/
@RequestMapping
(
value
=
"/save"
)
public
ModelAndView
save
()
throws
Exception
{
logBefore
(
logger
,
Jurisdiction
.
getUsername
()+
"新增Lottery"
);
if
(!
Jurisdiction
.
buttonJurisdiction
(
menuUrl
,
"add"
)){
return
null
;}
//校验权限
ModelAndView
mv
=
this
.
getModelAndView
();
PageData
pd
=
new
PageData
();
pd
=
this
.
getPageData
();
lotteryService
.
save
(
pd
);
mv
.
addObject
(
"msg"
,
"success"
);
mv
.
setViewName
(
"save_result"
);
return
mv
;
}
/**删除
* @param out
* @throws Exception
*/
@RequestMapping
(
value
=
"/delete"
)
public
void
delete
(
PrintWriter
out
)
throws
Exception
{
logBefore
(
logger
,
Jurisdiction
.
getUsername
()+
"删除Lottery"
);
if
(!
Jurisdiction
.
buttonJurisdiction
(
menuUrl
,
"del"
)){
return
;}
//校验权限
PageData
pd
=
new
PageData
();
pd
=
this
.
getPageData
();
lotteryService
.
delete
(
pd
);
out
.
write
(
"success"
);
out
.
close
();
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping
(
value
=
"/edit"
)
public
ModelAndView
edit
()
throws
Exception
{
logBefore
(
logger
,
Jurisdiction
.
getUsername
()+
"修改Lottery"
);
if
(!
Jurisdiction
.
buttonJurisdiction
(
menuUrl
,
"edit"
)){
return
null
;}
//校验权限
ModelAndView
mv
=
this
.
getModelAndView
();
PageData
pd
=
new
PageData
();
pd
=
this
.
getPageData
();
lotteryService
.
edit
(
pd
);
mv
.
addObject
(
"msg"
,
"success"
);
mv
.
setViewName
(
"save_result"
);
return
mv
;
}
/**列表
* @param page
* @throws Exception
*/
@RequestMapping
(
value
=
"/list"
)
public
ModelAndView
list
(
Page
page
)
throws
Exception
{
logBefore
(
logger
,
Jurisdiction
.
getUsername
()+
"列表Lottery"
);
//if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
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
=
lotteryService
.
list
(
page
);
//列出Lottery列表
mv
.
setViewName
(
"tongmeng/lottery/lottery_list"
);
mv
.
addObject
(
"varList"
,
varList
);
mv
.
addObject
(
"pd"
,
pd
);
mv
.
addObject
(
"QX"
,
Jurisdiction
.
getHC
());
//按钮权限
return
mv
;
}
/**去新增页面
* @param
* @throws Exception
*/
@RequestMapping
(
value
=
"/goAdd"
)
public
ModelAndView
goAdd
()
throws
Exception
{
ModelAndView
mv
=
this
.
getModelAndView
();
PageData
pd
=
new
PageData
();
pd
=
this
.
getPageData
();
mv
.
setViewName
(
"tongmeng/lottery/lottery_edit"
);
mv
.
addObject
(
"msg"
,
"save"
);
mv
.
addObject
(
"pd"
,
pd
);
return
mv
;
}
/**去修改页面
* @param
* @throws Exception
*/
@RequestMapping
(
value
=
"/goEdit"
)
public
ModelAndView
goEdit
()
throws
Exception
{
ModelAndView
mv
=
this
.
getModelAndView
();
PageData
pd
=
new
PageData
();
pd
=
this
.
getPageData
();
pd
=
lotteryService
.
findById
(
pd
);
//根据ID读取
mv
.
setViewName
(
"tongmeng/lottery/lottery_edit"
);
mv
.
addObject
(
"msg"
,
"edit"
);
mv
.
addObject
(
"pd"
,
pd
);
return
mv
;
}
/**批量删除
* @param
* @throws Exception
*/
@RequestMapping
(
value
=
"/deleteAll"
)
@ResponseBody
public
Object
deleteAll
()
throws
Exception
{
logBefore
(
logger
,
Jurisdiction
.
getUsername
()+
"批量删除Lottery"
);
if
(!
Jurisdiction
.
buttonJurisdiction
(
menuUrl
,
"del"
)){
return
null
;}
//校验权限
PageData
pd
=
new
PageData
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
pd
=
this
.
getPageData
();
List
<
PageData
>
pdList
=
new
ArrayList
<
PageData
>();
String
DATA_IDS
=
pd
.
getString
(
"DATA_IDS"
);
if
(
null
!=
DATA_IDS
&&
!
""
.
equals
(
DATA_IDS
)){
String
ArrayDATA_IDS
[]
=
DATA_IDS
.
split
(
","
);
lotteryService
.
deleteAll
(
ArrayDATA_IDS
);
pd
.
put
(
"msg"
,
"ok"
);
}
else
{
pd
.
put
(
"msg"
,
"no"
);
}
pdList
.
add
(
pd
);
map
.
put
(
"list"
,
pdList
);
return
AppUtil
.
returnObject
(
pd
,
map
);
}
/**导出到excel
* @param
* @throws Exception
*/
@RequestMapping
(
value
=
"/excel"
)
public
ModelAndView
exportExcel
()
throws
Exception
{
logBefore
(
logger
,
Jurisdiction
.
getUsername
()+
"导出Lottery到excel"
);
if
(!
Jurisdiction
.
buttonJurisdiction
(
menuUrl
,
"cha"
)){
return
null
;}
ModelAndView
mv
=
new
ModelAndView
();
PageData
pd
=
new
PageData
();
pd
=
this
.
getPageData
();
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<
String
,
Object
>();
List
<
String
>
titles
=
new
ArrayList
<
String
>();
titles
.
add
(
"抽奖数字"
);
//1
titles
.
add
(
"中奖奖品"
);
//2
dataMap
.
put
(
"titles"
,
titles
);
List
<
PageData
>
varOList
=
lotteryService
.
listAll
(
pd
);
List
<
PageData
>
varList
=
new
ArrayList
<
PageData
>();
for
(
int
i
=
0
;
i
<
varOList
.
size
();
i
++){
PageData
vpd
=
new
PageData
();
vpd
.
put
(
"var1"
,
varOList
.
get
(
i
).
get
(
"c_lottery_number"
).
toString
());
//1
vpd
.
put
(
"var2"
,
varOList
.
get
(
i
).
get
(
"c_lottery_reward"
).
toString
());
//2
varList
.
add
(
vpd
);
}
dataMap
.
put
(
"varList"
,
varList
);
ObjectExcelView
erv
=
new
ObjectExcelView
();
mv
=
new
ModelAndView
(
erv
,
dataMap
);
return
mv
;
}
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
){
DateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
binder
.
registerCustomEditor
(
Date
.
class
,
new
CustomDateEditor
(
format
,
true
));
}
}
src/main/java/com/mall/service/mengbeng/lottery/LotteryManager.java
0 → 100644
浏览文件 @
16094efc
package
com
.
mall
.
service
.
mengbeng
.
lottery
;
import
java.util.List
;
import
com.mall.entity.Page
;
import
com.mall.util.PageData
;
/**
* 说明: 抽奖接口
* 创建时间:2019-01-17
* @version
*/
public
interface
LotteryManager
{
/**新增
* @param pd
* @throws Exception
*/
public
void
save
(
PageData
pd
)
throws
Exception
;
/**删除
* @param pd
* @throws Exception
*/
public
void
delete
(
PageData
pd
)
throws
Exception
;
/**修改
* @param pd
* @throws Exception
*/
public
void
edit
(
PageData
pd
)
throws
Exception
;
/**列表
* @param page
* @throws Exception
*/
public
List
<
PageData
>
list
(
Page
page
)
throws
Exception
;
/**列表(全部)
* @param pd
* @throws Exception
*/
public
List
<
PageData
>
listAll
(
PageData
pd
)
throws
Exception
;
/**通过id获取数据
* @param pd
* @throws Exception
*/
public
PageData
findById
(
PageData
pd
)
throws
Exception
;
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public
void
deleteAll
(
String
[]
ArrayDATA_IDS
)
throws
Exception
;
}
src/main/java/com/mall/service/mengbeng/lottery/impl/LotteryService.java
0 → 100644
浏览文件 @
16094efc
package
com
.
mall
.
service
.
mengbeng
.
lottery
.
impl
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
com.mall.service.mengbeng.lottery.LotteryManager
;
import
org.springframework.stereotype.Service
;
import
com.mall.dao.DaoSupport
;
import
com.mall.entity.Page
;
import
com.mall.util.PageData
;
/**
* 说明: 抽奖
* 创建时间:2019-01-17
* @version
*/
@Service
(
"lotteryService"
)
public
class
LotteryService
implements
LotteryManager
{
@Resource
(
name
=
"daoSupport"
)
private
DaoSupport
dao
;
/**新增
* @param pd
* @throws Exception
*/
public
void
save
(
PageData
pd
)
throws
Exception
{
dao
.
save
(
"LotteryMapper.save"
,
pd
);
}
/**删除
* @param pd
* @throws Exception
*/
public
void
delete
(
PageData
pd
)
throws
Exception
{
dao
.
delete
(
"LotteryMapper.delete"
,
pd
);
}
/**修改
* @param pd
* @throws Exception
*/
public
void
edit
(
PageData
pd
)
throws
Exception
{
dao
.
update
(
"LotteryMapper.edit"
,
pd
);
}
/**列表
* @param page
* @throws Exception
*/
@SuppressWarnings
(
"unchecked"
)
public
List
<
PageData
>
list
(
Page
page
)
throws
Exception
{
return
(
List
<
PageData
>)
dao
.
findForList
(
"LotteryMapper.datalistPage"
,
page
);
}
/**列表(全部)
* @param pd
* @throws Exception
*/
@SuppressWarnings
(
"unchecked"
)
public
List
<
PageData
>
listAll
(
PageData
pd
)
throws
Exception
{
return
(
List
<
PageData
>)
dao
.
findForList
(
"LotteryMapper.listAll"
,
pd
);
}
/**通过id获取数据
* @param pd
* @throws Exception
*/
public
PageData
findById
(
PageData
pd
)
throws
Exception
{
return
(
PageData
)
dao
.
findForObject
(
"LotteryMapper.findById"
,
pd
);
}
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public
void
deleteAll
(
String
[]
ArrayDATA_IDS
)
throws
Exception
{
dao
.
delete
(
"LotteryMapper.deleteAll"
,
ArrayDATA_IDS
);
}
}
src/main/resources/mybatis1/tongmeng/LotteryMapper.xml
0 → 100644
浏览文件 @
16094efc
<?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=
"LotteryMapper"
>
<!--表名 -->
<sql
id=
"tableName"
>
c_lottery
</sql>
<!-- 字段 -->
<sql
id=
"Field"
>
c_lottery_number,
c_lottery_reward,
c_lottery_id
</sql>
<!-- 字段值 -->
<sql
id=
"FieldValue"
>
#{c_lottery_number},
#{c_lottery_reward},
#{c_lottery_id}
</sql>
<!-- 新增-->
<insert
id=
"save"
parameterType=
"pd"
>
insert into
<include
refid=
"tableName"
></include>
(
c_lottery_number,
c_lottery_reward
) values (
#{c_lottery_number},
#{c_lottery_reward}
)
on DUPLICATE key update c_lottery_reward=#{c_lottery_reward}
</insert>
<!-- 删除-->
<delete
id=
"delete"
parameterType=
"pd"
>
delete from
<include
refid=
"tableName"
></include>
where
c_lottery_id = #{c_lottery_id}
</delete>
<!-- 修改 -->
<update
id=
"edit"
parameterType=
"pd"
>
update
<include
refid=
"tableName"
></include>
set
c_lottery_number = #{c_lottery_number},
c_lottery_reward = #{c_lottery_reward},
c_lottery_id = c_lottery_id
where
c_lottery_id = #{c_lottery_id}
</update>
<!-- 通过ID获取数据 -->
<select
id=
"findById"
parameterType=
"pd"
resultType=
"pd"
>
select
<include
refid=
"Field"
></include>
from
<include
refid=
"tableName"
></include>
where
c_lottery_id = #{c_lottery_id}
</select>
<!-- 列表 -->
<select
id=
"datalistPage"
parameterType=
"page"
resultType=
"pd"
>
select
<include
refid=
"Field"
></include>
from
<include
refid=
"tableName"
></include>
where 1=1
<if
test=
"pd.keywords!= null and pd.keywords != ''"
>
<!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select
id=
"listAll"
parameterType=
"pd"
resultType=
"pd"
>
select
<include
refid=
"Field"
></include>
from
<include
refid=
"tableName"
></include>
</select>
<!-- 批量删除 -->
<delete
id=
"deleteAll"
parameterType=
"String"
>
delete from
<include
refid=
"tableName"
></include>
where
c_lottery_id in
<foreach
item=
"item"
index=
"index"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</delete>
</mapper>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/tongmeng/lottery/lottery_edit.jsp
0 → 100644
浏览文件 @
16094efc
<%@ 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"
%>
<%@ taglib
prefix=
"fn"
uri=
"http://java.sun.com/jsp/jstl/functions"
%>
<%
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=
"${pageContext.request.contextPath}/lottery/${msg }.do"
name=
"Form"
id=
"Form"
method=
"post"
>
<input
type=
"hidden"
name=
"c_lottery_id"
id=
"c_lottery_id"
value=
"${pd.c_lottery_id}"
/>
<div
id=
"zhongxin"
style=
"padding-top: 13px;"
>
<table
id=
"table_report"
class=
"table table-striped table-bordered table-hover"
>
<tr>
<td
style=
"width:75px;text-align: right;padding-top: 13px;"
>
抽奖数字:
</td>
<td><input
type=
"number"
name=
"c_lottery_number"
id=
"c_lottery_number"
value=
"${pd.c_lottery_number}"
oninput=
"if(value.length>2)value=value.slice(0,2)"
placeholder=
"这里输入抽奖数字"
title=
"抽奖数字"
style=
"width:98%;"
/></td>
</tr>
<tr>
<td
style=
"width:75px;text-align: right;padding-top: 13px;"
>
中奖奖品:
</td>
<td><input
type=
"number"
name=
"c_lottery_reward"
id=
"c_lottery_reward"
value=
"${pd.c_lottery_reward}"
oninput=
"if(value.length>2)value=value.slice(0,2)"
placeholder=
"这里输入中奖奖品"
title=
"中奖奖品"
style=
"width:80%;"
min=
"1"
/>
个月
</td>
</tr>
<tr>
<td
style=
"text-align: center;"
colspan=
"10"
>
<a
class=
"btn btn-mini btn-primary"
onclick=
"save();"
>
保存
</a>
<a
class=
"btn btn-mini btn-danger"
onclick=
"top.Dialog.close();"
>
取消
</a>
</td>
</tr>
</table>
</div>
<div
id=
"zhongxin2"
class=
"center"
style=
"display:none"
><br/><br/><br/><br/><br/><img
src=
"static/images/jiazai.gif"
/><br/><h4
class=
"lighter block green"
>
提交中...
</h4></div>
</form>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.page-content -->
</div>
</div>
<!-- /.main-content -->
</div>
<!-- /.main-container -->
<!-- 页面底部js¨ -->
<%@ include
file=
"../../system/index/foot.jsp"
%>
<!-- 下拉框 -->
<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
save
(){
if
(
$
(
"#c_lottery_number"
).
val
()
==
""
){
$
(
"#c_lottery_number"
).
tips
({
side
:
3
,
msg
:
'请输入抽奖数字'
,
bg
:
'#AE81FF'
,
time
:
2
});
$
(
"#c_lottery_number"
).
focus
();
return
false
;
}
if
(
$
(
"#c_lottery_reward"
).
val
()
==
""
){
$
(
"#c_lottery_reward"
).
tips
({
side
:
3
,
msg
:
'请输入中奖奖品'
,
bg
:
'#AE81FF'
,
time
:
2
});
$
(
"#C_LOTTERY_REWARD"
).
focus
();
return
false
;
}
if
(
$
(
"#c_lottery_reward"
).
val
()
<=
0
){
$
(
"#c_lottery_reward"
).
tips
({
side
:
3
,
msg
:
'请输入大于0的数字'
,
bg
:
'#AE81FF'
,
time
:
2
});
$
(
"#c_lottery_reward"
).
focus
();
return
false
;
}
$
(
"#Form"
).
submit
();
$
(
"#zhongxin"
).
hide
();
$
(
"#zhongxin2"
).
show
();
}
$
(
function
()
{
//日期框
$
(
'.date-picker'
).
datepicker
({
autoclose
:
true
,
todayHighlight
:
true
});
});
</script>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/tongmeng/lottery/lottery_list.jsp
0 → 100644
浏览文件 @
16094efc
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论