新增对管理后台的封装

master
星期八 6 years ago
parent 9cb1226fdc
commit af3560fb7a
  1. 19
      src/main/java/com/lq/cms/vo/WechatMessageVo.java
  2. 5
      src/main/java/com/lq/cms/web/AdminBaseController.java
  3. 2
      src/main/java/com/lq/code/interceptor/PageInteceptor.java
  4. 2
      src/main/resources/mybatis/mapping/SysUserDao.xml
  5. 2
      src/main/resources/mybatis/mapping/WechatInfoDao.xml
  6. 6
      src/main/resources/spring/spring-shiro.xml
  7. 38
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp
  8. 27
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/index.jsp
  9. 5
      ssm.iml

@ -1,6 +1,7 @@
package com.lq.cms.vo;
import com.lq.cms.emun.WechatMessageTypeEnum;
import com.lq.code.util.DateUtil;
import java.util.Date;
@ -8,7 +9,7 @@ public class WechatMessageVo extends AdminBaseVo{
//消息类型
private String messageType;
//消息类型(中文描述)
private String messageTypeStr;
//消息标题
private String title;
@ -22,6 +23,8 @@ public class WechatMessageVo extends AdminBaseVo{
private String toUrl;
//创建用户
private Long userId;
//创建时间
private String createTimeStr;
public String getMessageType() {
return messageType;
@ -89,4 +92,18 @@ public class WechatMessageVo extends AdminBaseVo{
public void setUserId(Long userId) {
this.userId = userId;
}
public String getCreateTimeStr() {
Date createTime = this.getCreateTime();
if (createTime!=null){
return DateUtil.getDateToStr(createTime);
}
return null;
}
// public void setCreateTimeStr(String createTimeStr) {
// this.createTimeStr = createTimeStr;
// }
}

@ -22,6 +22,7 @@ public abstract class AdminBaseController<T,V extends AdminBaseVo> {
public static final Logger LOGGER = LoggerFactory.getLogger(AdminBaseController.class);
/**
* 获取service
* @return
@ -71,9 +72,9 @@ public abstract class AdminBaseController<T,V extends AdminBaseVo> {
return ajaxResult;
}
@GetMapping("/delete/{id}")
@GetMapping("/delete")
@ResponseBody
public AjaxResult delete(@PathVariable("id")Long id){
public AjaxResult delete(Long id){
Subject subject = SecurityUtils.getSubject();
subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.DELETE.getConstant());
AjaxResult ajaxResult = new AjaxResult();

@ -59,7 +59,7 @@ public class PageInteceptor implements Interceptor {
if (dialect.equals("oracle")){
db = new OracleBuiler();
}
String countSql= db.countSql(sql);
// String countSql= db.countSql(sql);
String pageSql=db.concatPageSql(sql,pageInterface);
metaStatementHandler.setValue("delegate.boundSql.sql",pageSql);

@ -78,7 +78,7 @@
</update>
<update id="delete" parameterType="Long">
DELETE
UPDATE
sys_user
SET status = 0
WHERE

@ -54,7 +54,7 @@
<delete id="delete" parameterType="Long">
DELETE
FROM wechat_info
wechat_info
WHERE
id=#{id}
AND

@ -29,7 +29,7 @@
<bean id="sessionDAO" class="com.lq.code.cache.RedisSessionDao">
<constructor-arg ref="redisTempale"/>
<constructor-arg value="300000"/>
<constructor-arg value="30000000"/>
</bean>
<!-- 配置需要向Cookie中保存数据的配置模版 -->
@ -40,6 +40,8 @@
<property name="httpOnly" value="true"/>
<!-- 定义Cookie的过期时间,单位为秒,如果设置为-1表示浏览器关闭,则Cookie消失 -->
<property name="maxAge" value="-1"/>
</bean>
<!-- 定义会话管理器的操作 -->
@ -66,7 +68,7 @@
<bean id="sessionValidationScheduler"
class="org.apache.shiro.session.mgt.quartz.QuartzSessionValidationScheduler">
<!-- 设置session的失效扫描间隔,单位为毫秒 -->
<property name="sessionValidationInterval" value="3600000"/>
<property name="sessionValidationInterval" value="36000000"/>
<!-- 随后还需要定义有一个会话管理器的程序类的引用 -->
<property name="sessionManager" ref="sessionManager"/>
</bean>

@ -35,13 +35,24 @@
</tr>
<tr>
<td>消息内容:</td>
<td><input class="easyui-textbox" type="text" id="content" data-options="required:true" value="${wechatMessage.content}"/></td>
<td>文本内容:</td>
<td>
<textarea id="content">${wechatMessage.content}</textarea>
<!-- <input class="easyui-textbox" data-options="multiline:true" value="${wechatMessage.content}" style="width:300px;height:100px">-->
<!--<input class="easyui-textbox" type="text" id="content" data-options="required:true" value="${wechatMessage.content}"/>-->
</td>
</tr>
<tr>
<td>图片文件:</td>
<td><input class="easyui-textbox" type="file" id="imageUrl" data-options="required:true"/></td>
</tr>
<tr>
<td>图片路径:</td>
<td><input class="easyui-textbox" type="text" id="imageUrl" data-options="required:true" value="${wechatMessage.content}"/></td>
<td colspan="2" align="center">
<img src="" id="cropedBigImg" style="display:none;width: 200px;height: 200px;">
</td>
</tr>
@ -58,4 +69,23 @@
</table>
</div>
</body>
<script type="text/javascript">
$(function () {
console.log("==========测试内容==========");
$('#imageUrl').on('change', function() {//当chooseImage的值改变时,执行此函数
var filePath = $(this).val(), //获取到input的value,里面是文件的路径
fileFormat = filePath.substring(filePath.lastIndexOf(".")).toLowerCase(),
src = window.URL.createObjectURL(this.files[0]); //转成可以在本地预览的格式
// 检查是否是图片
if(!fileFormat.match(/.png|.jpg|.jpeg/)) {
layer.msg('上传错误,文件格式必须为:png/jpg/jpeg');
return;
}else{
$('#cropedBigImg').css('display','block');
$('#cropedBigImg').attr('src', src);
}
});
});
</script>
</html>

@ -23,7 +23,7 @@
pagination :"true",
columns:[[
{field:'id',title:'编号',width:35},
{field:'messageType',title:'消息类型',width:100},
{field:'messageTypeStr',title:'消息类型',width:100},
{field:'title',title:'消息标题',width:100},
{field:'content',title:'消息内容',width:100},
{field:'imageUrl',title:'图片路径',width:100},
@ -56,7 +56,7 @@
}
$("#editDate").dialog({
title:title,
width:400,
width:500,
height:400,
closed:false,
cache:false,
@ -105,6 +105,29 @@
return obj;
}
function del(id) {
var url = 'delete';
var obj = new Object();
obj.id = id;
get(url,obj);
}
function get(url,obj) {
$.ajax({
url: url,
dataType:"json",
type:"get",
data:obj,
success: function(result){
if(result.success==true){
$.messager.alert('提醒','提交成功','warning');
$("#editDate").dialog('close');
$('#dataList').datagrid('reload',{});
}
}});
}
function post(url,obj) {
$.ajax({
url: url,

@ -10,6 +10,10 @@
<root url="file://$MODULE_DIR$/lib" relative="WEB-INF/lib" />
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
</webroots>
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources/dev" />
</sourceRoots>
</configuration>
</facet>
<facet type="Spring" name="Spring">
@ -22,6 +26,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources/dev" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />

Loading…
Cancel
Save