From 9cb1226fdc3f124af6d69f61ad3135adff178ae4 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Sat, 12 Jan 2019 17:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=9A=84=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lq/cms/dao/AdminBaseDao.java | 6 ++-- .../com/lq/cms/service/AdminBaseService.java | 10 +++--- .../lq/cms/service/WechatMessageService.java | 3 +- .../service/impl/AdminBaseServiceImpl.java | 10 +++--- .../impl/WechatMessageServiceImpl.java | 3 +- src/main/java/com/lq/cms/vo/AdminBaseVo.java | 10 ++++++ .../java/com/lq/cms/vo/WechatMessageVo.java | 26 ++++++++------ .../com/lq/cms/web/AdminBaseController.java | 19 +++++----- .../web/wechat/WechatMessageController.java | 2 +- .../java/com/lq/dao/WechatMessageDao.java | 2 +- .../WEB-INF/views/jsp/cms/sys/role/index.jsp | 1 - .../WEB-INF/views/jsp/cms/sys/user/index.jsp | 1 - .../views/jsp/cms/wechat/message/edit.jsp | 10 ++++-- .../views/jsp/cms/wechat/message/index.jsp | 36 +++++++++++++++++-- 14 files changed, 95 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/lq/cms/dao/AdminBaseDao.java b/src/main/java/com/lq/cms/dao/AdminBaseDao.java index a370e55..4cf7b18 100644 --- a/src/main/java/com/lq/cms/dao/AdminBaseDao.java +++ b/src/main/java/com/lq/cms/dao/AdminBaseDao.java @@ -5,10 +5,10 @@ import com.lq.code.dao.BaseDao; import java.util.List; -public interface AdminBaseDao extends BaseDao { +public interface AdminBaseDao extends BaseDao { - List findLisatPage(AdminBaseVo vo); + List findListPage(V vo); - int count(AdminBaseVo vo); + int count(V vo); } diff --git a/src/main/java/com/lq/cms/service/AdminBaseService.java b/src/main/java/com/lq/cms/service/AdminBaseService.java index 94a1d9d..4686cff 100644 --- a/src/main/java/com/lq/cms/service/AdminBaseService.java +++ b/src/main/java/com/lq/cms/service/AdminBaseService.java @@ -5,13 +5,13 @@ import com.lq.code.service.BaseService; import java.util.List; -public interface AdminBaseService extends BaseService{ +public interface AdminBaseService extends BaseService{ - List findListPage(AdminBaseVo vo); + List findListPage(V vo); - int count(AdminBaseVo vo); + int count(V vo); - T save(AdminBaseVo vo)throws IllegalAccessException, InstantiationException; + T save(V vo)throws IllegalAccessException, InstantiationException; - T update(AdminBaseVo vo); + T update(V vo); } diff --git a/src/main/java/com/lq/cms/service/WechatMessageService.java b/src/main/java/com/lq/cms/service/WechatMessageService.java index 652592f..bf000fe 100644 --- a/src/main/java/com/lq/cms/service/WechatMessageService.java +++ b/src/main/java/com/lq/cms/service/WechatMessageService.java @@ -1,9 +1,10 @@ package com.lq.cms.service; +import com.lq.cms.vo.WechatMessageVo; import com.lq.entity.WechatMessage; -public interface WechatMessageService extends AdminBaseService { +public interface WechatMessageService extends AdminBaseService { } diff --git a/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java b/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java index 1dd116f..ffcf73c 100644 --- a/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java @@ -13,17 +13,17 @@ import java.lang.reflect.ParameterizedType; import java.util.Date; import java.util.List; -public abstract class AdminBaseServiceImpl extends BaseServiceImpl implements AdminBaseService{ +public abstract class AdminBaseServiceImpl extends BaseServiceImpl implements AdminBaseService{ - abstract AdminBaseDao getAdminBaseDao(); + abstract AdminBaseDao getAdminBaseDao(); @Override - public List findListPage(AdminBaseVo vo) { - return this.getAdminBaseDao().findLisatPage(vo); + public List findListPage(V vo) { + return this.getAdminBaseDao().findListPage(vo); } @Override - public int count(AdminBaseVo vo) { + public int count(V vo) { return this.getAdminBaseDao().count(vo); } diff --git a/src/main/java/com/lq/cms/service/impl/WechatMessageServiceImpl.java b/src/main/java/com/lq/cms/service/impl/WechatMessageServiceImpl.java index c9c594c..2f77616 100644 --- a/src/main/java/com/lq/cms/service/impl/WechatMessageServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/WechatMessageServiceImpl.java @@ -2,13 +2,14 @@ package com.lq.cms.service.impl; import com.lq.cms.dao.AdminBaseDao; import com.lq.cms.service.WechatMessageService; +import com.lq.cms.vo.WechatMessageVo; import com.lq.dao.WechatMessageDao; import com.lq.entity.WechatMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class WechatMessageServiceImpl extends AdminBaseServiceImpl implements WechatMessageService { +public class WechatMessageServiceImpl extends AdminBaseServiceImpl implements WechatMessageService { @Autowired private WechatMessageDao wechatMessageDao; diff --git a/src/main/java/com/lq/cms/vo/AdminBaseVo.java b/src/main/java/com/lq/cms/vo/AdminBaseVo.java index 5b2c7b5..4784b93 100644 --- a/src/main/java/com/lq/cms/vo/AdminBaseVo.java +++ b/src/main/java/com/lq/cms/vo/AdminBaseVo.java @@ -8,6 +8,8 @@ public class AdminBaseVo extends BasePageVo { private Date createTime; + private Date updateTime; + private Integer status; public Long getId() { @@ -26,6 +28,14 @@ public class AdminBaseVo extends BasePageVo { this.createTime = createTime; } + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + public Integer getStatus() { return status; } diff --git a/src/main/java/com/lq/cms/vo/WechatMessageVo.java b/src/main/java/com/lq/cms/vo/WechatMessageVo.java index fe7d8a1..0c3864c 100644 --- a/src/main/java/com/lq/cms/vo/WechatMessageVo.java +++ b/src/main/java/com/lq/cms/vo/WechatMessageVo.java @@ -1,11 +1,15 @@ package com.lq.cms.vo; +import com.lq.cms.emun.WechatMessageTypeEnum; + import java.util.Date; public class WechatMessageVo extends AdminBaseVo{ //消息类型 private String messageType; + + private String messageTypeStr; //消息标题 private String title; //消息内容 @@ -16,8 +20,6 @@ public class WechatMessageVo extends AdminBaseVo{ private String mediaId; //跳转路径 private String toUrl; - //更新时间 - private Date updateTime; //创建用户 private Long userId; @@ -27,6 +29,17 @@ public class WechatMessageVo extends AdminBaseVo{ public void setMessageType(String messageType) { this.messageType = messageType; + if (WechatMessageTypeEnum.hasValue(messageType)){ + this.messageTypeStr = WechatMessageTypeEnum.getDesc(messageType); + } + } + + public String getMessageTypeStr() { + return messageTypeStr; + } + + public void setMessageTypeStr(String messageTypeStr) { + this.messageTypeStr = messageTypeStr; } public String getTitle() { @@ -69,15 +82,6 @@ public class WechatMessageVo extends AdminBaseVo{ this.toUrl = toUrl; } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - public Long getUserId() { return userId; } diff --git a/src/main/java/com/lq/cms/web/AdminBaseController.java b/src/main/java/com/lq/cms/web/AdminBaseController.java index a67bcaf..b88e875 100644 --- a/src/main/java/com/lq/cms/web/AdminBaseController.java +++ b/src/main/java/com/lq/cms/web/AdminBaseController.java @@ -18,7 +18,7 @@ import java.util.Map; /** * 管理后台 父类 */ -public abstract class AdminBaseController { +public abstract class AdminBaseController { public static final Logger LOGGER = LoggerFactory.getLogger(AdminBaseController.class); @@ -26,7 +26,7 @@ public abstract class AdminBaseController { * 获取service * @return */ - public abstract AdminBaseService getBaseService(); + public abstract AdminBaseService getBaseService(); /** * 管理后台url(用于权限控制) @@ -34,16 +34,16 @@ public abstract class AdminBaseController { */ public abstract String getIndexUrl(); - public Map setPageDate(AdminBaseVo vo){ + public Map setPageDate(V vo){ Map map=new HashMap(); - map.put(DatagridParamEnum.TOTAL.getValue(),getBaseService().findListPage(vo)); - map.put(DatagridParamEnum.ROWS.getValue(),getBaseService().count(vo)); + map.put(DatagridParamEnum.ROWS.getValue(),getBaseService().findListPage(vo)); + map.put(DatagridParamEnum.TOTAL.getValue(),getBaseService().count(vo)); return map; } - @GetMapping("/list") + @RequestMapping("/list") @ResponseBody - public Map list(AdminBaseVo vo){ + public Map list(V vo){ Subject subject = SecurityUtils.getSubject(); subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.SELECT.getConstant()); Map resultMap = setPageDate(vo); @@ -52,7 +52,7 @@ public abstract class AdminBaseController { @PostMapping("/save") @ResponseBody - public AjaxResult save(AdminBaseVo vo) throws InstantiationException, IllegalAccessException { + public AjaxResult save(V vo) throws InstantiationException, IllegalAccessException { Subject subject = SecurityUtils.getSubject(); subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.INSERT.getConstant()); AjaxResult ajaxResult = new AjaxResult(); @@ -63,7 +63,7 @@ public abstract class AdminBaseController { @PostMapping("/update") @ResponseBody - public AjaxResult update(AdminBaseVo vo){ + public AjaxResult update(V vo){ Subject subject = SecurityUtils.getSubject(); subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.UPDATE.getConstant()); AjaxResult ajaxResult= new AjaxResult(); @@ -76,7 +76,6 @@ public abstract class AdminBaseController { public AjaxResult delete(@PathVariable("id")Long id){ Subject subject = SecurityUtils.getSubject(); subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.DELETE.getConstant()); - AjaxResult ajaxResult = new AjaxResult(); getBaseService().delete(id); return ajaxResult; diff --git a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java index 99384ad..c1c7974 100644 --- a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java @@ -21,7 +21,7 @@ import java.util.Map; */ @Controller @RequestMapping("/cms/wechat/message") -public class WechatMessageController extends AdminBaseController { +public class WechatMessageController extends AdminBaseController { @Autowired private WechatMessageService wechatMessageService; diff --git a/src/main/java/com/lq/dao/WechatMessageDao.java b/src/main/java/com/lq/dao/WechatMessageDao.java index 2cfca32..dd3a9c0 100644 --- a/src/main/java/com/lq/dao/WechatMessageDao.java +++ b/src/main/java/com/lq/dao/WechatMessageDao.java @@ -7,7 +7,7 @@ import com.lq.entity.WechatMessage; import java.util.List; -public interface WechatMessageDao extends AdminBaseDao { +public interface WechatMessageDao extends AdminBaseDao { List findListPage(WechatMessageVo vo); diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/sys/role/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/sys/role/index.jsp index c32dcbb..4dd67d4 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/sys/role/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/sys/role/index.jsp @@ -22,7 +22,6 @@ {field:'updateTimeStr',title:'更新时间',width:100}, /* formatter 不能重复field,否则会失效**/ {field:'editId',title:'编辑',width:100,formatter:function (value,row,index) { - // console.log(row); var html="编辑  "; html+="删除  "; html+="权限"; diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp index 446e3f3..9d5eb87 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp @@ -35,7 +35,6 @@ {field:'imgUrl',title:'头像',width:100}, /* formatter 不能重复field,否则会失效**/ {field:'editId',title:'编辑',width:100,formatter:function (value,row,index) { - console.log(row); var html="编辑  "; html+="删除"; return html; diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp index e0df78c..2eb2153 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp @@ -39,14 +39,20 @@ + + 图片路径: + + + + 素材ID: - + 消息跳转链接: - + diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/index.jsp index b664ed5..6c482ae 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/index.jsp @@ -81,11 +81,43 @@ $("#editDate").dialog('open').dialog('refresh',url); } function save() { - alert("提交保存"); + var url = 'save'; + var obj = new Object(); + obj = attrObj(obj); + post(url,obj); } function update() { - alert("提交更新"); + var url = 'update'; + var obj = new Object(); + obj.id = $("#id").val(); + obj = attrObj(obj); + post(url,obj); + } + + function attrObj(obj) { + obj.messageType = $("#messageType").val(); + obj.title = $("#title").val(); + obj.content = $("#content").val(); + obj.imageUrl = $("#imageUrl").val(); + obj.mediaId = $("#mediaId").val(); + obj.toUrl = $("#toUrl").val(); + return obj; + } + + function post(url,obj) { + $.ajax({ + url: url, + dataType:"json", + type:"post", + data:obj, + success: function(result){ + if(result.success==true){ + $.messager.alert('提醒','提交成功','warning'); + $("#editDate").dialog('close'); + $('#dataList').datagrid('reload',{}); + } + }}); }