From 72461c18f16743ad9e97bdd14712102b696b5eb8 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Thu, 23 May 2019 22:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1=E5=85=AC?= =?UTF-8?q?=E4=BC=97=E5=8F=B7=E6=B6=88=E6=81=AF=E4=B8=BAInt=201.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=95=B0=E6=8D=AE=E7=9A=84=E5=AD=97=E6=AE=B5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../lq/cms/emun/WechatMessageTypeEnum.java | 22 +++++++++---------- .../java/com/lq/cms/vo/WechatMessageVo.java | 6 ++--- .../web/wechat/WechatMessageController.java | 2 +- src/main/java/com/lq/code/util/XmlUtil.java | 8 +++++++ .../util/mybatisPlus/xml/MapperXmlDtl.java | 2 -- .../java/com/lq/entity/WechatMessage.java | 6 ++--- .../mybatis/mapping/WechatKeywordDao.xml | 15 ++++++------- .../views/jsp/cms/wechat/message/edit.jsp | 12 +++++----- 9 files changed, 41 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index cf4ce91..b3d0cc7 100644 --- a/pom.xml +++ b/pom.xml @@ -202,7 +202,7 @@ com.baomidou mybatis-plus - 3.0.6 + 3.1.1 diff --git a/src/main/java/com/lq/cms/emun/WechatMessageTypeEnum.java b/src/main/java/com/lq/cms/emun/WechatMessageTypeEnum.java index c832dbe..a493db5 100755 --- a/src/main/java/com/lq/cms/emun/WechatMessageTypeEnum.java +++ b/src/main/java/com/lq/cms/emun/WechatMessageTypeEnum.java @@ -4,25 +4,25 @@ import java.util.HashMap; import java.util.Map; public enum WechatMessageTypeEnum { - TEXT("TEXT","文本"), - IMAGE("IMAGE","图片"), - IMAGE_TEXT("IMAGE_TEXT","图文混合") + TEXT(1,"文本"), + IMAGE(2,"图片"), + IMAGE_TEXT(3,"图文混合") ; - WechatMessageTypeEnum(String value, String desc) { + WechatMessageTypeEnum(Integer value, String desc) { this.value = value; this.desc = desc; } - private String value; + private Integer value; private String desc; - public String getValue() { + public Integer getValue() { return value; } - public void setValue(String value) { + public void setValue(Integer value) { this.value = value; } @@ -34,7 +34,7 @@ public enum WechatMessageTypeEnum { this.desc = desc; } - private static Map enumMap = new HashMap(); + private static Map enumMap = new HashMap(); static { WechatMessageTypeEnum[] wechantMessageTypeEnums = WechatMessageTypeEnum.values(); @@ -44,17 +44,17 @@ public enum WechatMessageTypeEnum { } //判断是否存在值 - public static boolean hasValue(String value){ + public static boolean hasValue(Integer value){ return enumMap.containsKey(value); } - public static String getDesc(String value){ + public static String getDesc(Integer value){ return enumMap.get(value); } - public static Map getEnumMap(){ + public static Map getEnumMap(){ return enumMap; } diff --git a/src/main/java/com/lq/cms/vo/WechatMessageVo.java b/src/main/java/com/lq/cms/vo/WechatMessageVo.java index b3702e4..4d53dfb 100755 --- a/src/main/java/com/lq/cms/vo/WechatMessageVo.java +++ b/src/main/java/com/lq/cms/vo/WechatMessageVo.java @@ -8,7 +8,7 @@ import java.util.Date; public class WechatMessageVo extends AdminBaseVo{ //消息类型 - private String messageType; + private Integer messageType; //消息类型(中文描述) private String messageTypeStr; //消息标题 @@ -26,11 +26,11 @@ public class WechatMessageVo extends AdminBaseVo{ //创建时间 private String createTimeStr; - public String getMessageType() { + public Integer getMessageType() { return messageType; } - public void setMessageType(String messageType) { + public void setMessageType(Integer messageType) { this.messageType = messageType; if (WechatMessageTypeEnum.hasValue(messageType)){ this.messageTypeStr = WechatMessageTypeEnum.getDesc(messageType); 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 9c4ae9b..f1769c1 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java @@ -39,7 +39,7 @@ public class WechatMessageController extends AdminBaseController emunMap = WechatMessageTypeEnum.getEnumMap(); + Map emunMap = WechatMessageTypeEnum.getEnumMap(); model.addAttribute("wechatMessageTypeMap",emunMap); return "cms/wechat/message/edit"; } diff --git a/src/main/java/com/lq/code/util/XmlUtil.java b/src/main/java/com/lq/code/util/XmlUtil.java index 1cbbe5d..af47ce2 100755 --- a/src/main/java/com/lq/code/util/XmlUtil.java +++ b/src/main/java/com/lq/code/util/XmlUtil.java @@ -1,5 +1,6 @@ package com.lq.code.util; +import com.lq.code.util.mybatisPlus.xml.SqlMapperXmlDtl; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; @@ -59,6 +60,13 @@ public class XmlUtil { public static void main(String[] args) { + SqlMapperXmlDtl sqlMapperXmlDtl = new SqlMapperXmlDtl(); + sqlMapperXmlDtl.setId("findOne"); + sqlMapperXmlDtl.setVale("select * from sys_id "); + + String xmlStr= objToXml(sqlMapperXmlDtl); + System.out.println(xmlStr); + } } diff --git a/src/main/java/com/lq/code/util/mybatisPlus/xml/MapperXmlDtl.java b/src/main/java/com/lq/code/util/mybatisPlus/xml/MapperXmlDtl.java index fde003a..349bd88 100755 --- a/src/main/java/com/lq/code/util/mybatisPlus/xml/MapperXmlDtl.java +++ b/src/main/java/com/lq/code/util/mybatisPlus/xml/MapperXmlDtl.java @@ -18,8 +18,6 @@ public class MapperXmlDtl { @XStreamImplicit private List selectMappserXmlDtlList; - - public String getNamespace() { return namespace; } diff --git a/src/main/java/com/lq/entity/WechatMessage.java b/src/main/java/com/lq/entity/WechatMessage.java index a4d14bd..a514d8e 100755 --- a/src/main/java/com/lq/entity/WechatMessage.java +++ b/src/main/java/com/lq/entity/WechatMessage.java @@ -17,7 +17,7 @@ public class WechatMessage extends IdEntity{ /** * 消息类型 */ - private String messageType; + private Integer messageType; /** * 消息标题 */ @@ -51,11 +51,11 @@ public class WechatMessage extends IdEntity{ */ private Long userId; - public String getMessageType() { + public Integer getMessageType() { return messageType; } - public void setMessageType(String messageType) { + public void setMessageType(Integer messageType) { this.messageType = messageType; } diff --git a/src/main/resources/mybatis/mapping/WechatKeywordDao.xml b/src/main/resources/mybatis/mapping/WechatKeywordDao.xml index 0753fc5..936f76f 100644 --- a/src/main/resources/mybatis/mapping/WechatKeywordDao.xml +++ b/src/main/resources/mybatis/mapping/WechatKeywordDao.xml @@ -45,14 +45,13 @@ UPDATE wechat_keyword - - matchin_type=#{matchinType}, - create_time=#{createTime}, - update_time=#{updateTime}, - wechat_rule_id=#{wechatRuleId}, - id=#{id}, - keyword=#{keyword}, - status=#{status}, + matchin_type=#{matchinType}, + create_time=#{createTime}, + update_time=#{updateTime}, + wechat_rule_id=#{wechatRuleId}, + id=#{id}, + keyword=#{keyword}, + status=#{status}, WHERE id=#{id} 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 3f693cb..d50a692 100755 --- 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 @@ -87,13 +87,15 @@ }); var messageType = '${wechatMessage.messageType}'; if (messageType==null||messageType==''){ - messageType = 'TEXT'; + messageType = '1'; $("#messageType").val(messageType); } showMessageTypeInput(messageType); $("#messageType").on("change",function () { + console.log("================"); var messageType = $(this).val(); + console.log(messageType); showMessageTypeInput(messageType); }) @@ -101,19 +103,19 @@ }); function showMessageTypeInput(messageType) { - + console.log(messageType); switch (messageType){ - case 'IMAGE': + case '2': $("#tr_imageUrl").show(); $("#tr_cropedBigImg").show(); $("#tr_content").hide(); ;break; - case 'TEXT': + case '1': $("#tr_imageUrl").hide(); $("#tr_content").show(); $("#tr_cropedBigImg").show(); ;break; - case 'IMAGE_TEXT': + case '3': $("#tr_imageUrl").show(); $("#tr_cropedBigImg").show(); $("#tr_content").show();