修改微信公众号消息为Int

1.优化数据的字段查询
master
星期八 6 years ago
parent e4f15c9b12
commit 72461c18f1
  1. 2
      pom.xml
  2. 22
      src/main/java/com/lq/cms/emun/WechatMessageTypeEnum.java
  3. 6
      src/main/java/com/lq/cms/vo/WechatMessageVo.java
  4. 2
      src/main/java/com/lq/cms/web/wechat/WechatMessageController.java
  5. 8
      src/main/java/com/lq/code/util/XmlUtil.java
  6. 2
      src/main/java/com/lq/code/util/mybatisPlus/xml/MapperXmlDtl.java
  7. 6
      src/main/java/com/lq/entity/WechatMessage.java
  8. 15
      src/main/resources/mybatis/mapping/WechatKeywordDao.xml
  9. 12
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp

@ -202,7 +202,7 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.0.6</version>
<version>3.1.1</version>
</dependency>
<!-- 导入java ee jar 包 -->

@ -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<String,String> enumMap = new HashMap();
private static Map<Integer,String> 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<String,String> getEnumMap(){
public static Map<Integer,String> getEnumMap(){
return enumMap;
}

@ -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);

@ -39,7 +39,7 @@ public class WechatMessageController extends AdminBaseController<WechatMessage,W
WechatMessage wechatMessage = wechatMessageService.findOne(id);
model.addAttribute("wechatMessage",wechatMessage);
}
Map<String,String> emunMap = WechatMessageTypeEnum.getEnumMap();
Map<Integer,String> emunMap = WechatMessageTypeEnum.getEnumMap();
model.addAttribute("wechatMessageTypeMap",emunMap);
return "cms/wechat/message/edit";
}

@ -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);
}
}

@ -18,8 +18,6 @@ public class MapperXmlDtl {
@XStreamImplicit
private List<SelectMappserXmlDtl> selectMappserXmlDtlList;
public String getNamespace() {
return namespace;
}

@ -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;
}

@ -45,14 +45,13 @@
UPDATE
wechat_keyword
<trim prefix="set" suffixOverrides=",">
<if test="matchinType!=null">matchin_type=#{matchinType},</if>
<if test="createTime!=null">create_time=#{createTime},</if>
<if test="updateTime!=null">update_time=#{updateTime},</if>
<if test="wechatRuleId!=null">wechat_rule_id=#{wechatRuleId},</if>
<if test="id!=null">id=#{id},</if>
<if test="keyword!=null">keyword=#{keyword},</if>
<if test="status!=null">status=#{status},</if>
<if test="matchinType!=null">matchin_type=#{matchinType},</if>
<if test="createTime!=null">create_time=#{createTime},</if>
<if test="updateTime!=null">update_time=#{updateTime},</if>
<if test="wechatRuleId!=null">wechat_rule_id=#{wechatRuleId},</if>
<if test="id!=null">id=#{id},</if>
<if test="keyword!=null">keyword=#{keyword},</if>
<if test="status!=null">status=#{status},</if>
</trim>
WHERE
id=#{id}

@ -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();

Loading…
Cancel
Save