Skip to content

Commit

Permalink
feature:增加小程序订阅消息表和枚举
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberber committed Nov 29, 2019
1 parent cb076de commit b690264
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.fangxuele.tool.push.dao;

import com.fangxuele.tool.push.domain.TMsgMaSubscribe;

public interface TMsgMaSubscribeMapper {
int deleteByPrimaryKey(Integer id);

int insert(TMsgMaSubscribe record);

int insertSelective(TMsgMaSubscribe record);

TMsgMaSubscribe selectByPrimaryKey(Integer id);

int updateByPrimaryKeySelective(TMsgMaSubscribe record);

int updateByPrimaryKey(TMsgMaSubscribe record);
}
77 changes: 77 additions & 0 deletions src/main/java/com/fangxuele/tool/push/domain/TMsgMaSubscribe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.fangxuele.tool.push.domain;

import java.io.Serializable;

public class TMsgMaSubscribe implements Serializable {
private Integer id;

private Integer msgType;

private String msgName;

private String templateId;

private String page;

private String createTime;

private String modifiedTime;

private static final long serialVersionUID = 1L;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getMsgType() {
return msgType;
}

public void setMsgType(Integer msgType) {
this.msgType = msgType;
}

public String getMsgName() {
return msgName;
}

public void setMsgName(String msgName) {
this.msgName = msgName == null ? null : msgName.trim();
}

public String getTemplateId() {
return templateId;
}

public void setTemplateId(String templateId) {
this.templateId = templateId == null ? null : templateId.trim();
}

public String getPage() {
return page;
}

public void setPage(String page) {
this.page = page == null ? null : page.trim();
}

public String getCreateTime() {
return createTime;
}

public void setCreateTime(String createTime) {
this.createTime = createTime == null ? null : createTime.trim();
}

public String getModifiedTime() {
return modifiedTime;
}

public void setModifiedTime(String modifiedTime) {
this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum MessageTypeEnum {
DING(14, "钉钉"),
BD_YUN(15, "百度云短信"),
QI_NIU_YUN(16, "七牛云短信"),
WX_UNIFORM_MESSAGE(17, "小程序-统一服务消息");
WX_UNIFORM_MESSAGE(17, "小程序-统一服务消息"),
MA_SUBSCRIBE(18, "小程序-订阅消息");

private int code;

Expand All @@ -49,6 +50,7 @@ public enum MessageTypeEnum {
public static final int BD_YUN_CODE = 15;
public static final int QI_NIU_YUN_CODE = 16;
public static final int WX_UNIFORM_MESSAGE_CODE = 17;
public static final int MA_SUBSCRIBE_CODE = 18;

MessageTypeEnum(int code, String name) {
this.code = code;
Expand Down Expand Up @@ -106,6 +108,9 @@ public static String getName(int code) {
case 17:
name = WX_UNIFORM_MESSAGE.name;
break;
case 18:
name = MA_SUBSCRIBE.name;
break;
default:
name = "";
}
Expand Down
19 changes: 18 additions & 1 deletion src/main/resources/db_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,21 @@ create table if not exists t_msg_wx_uniform
);

create unique index if not exists t_msg_wx_uniform_msg_type_msg_name_uindex
on t_msg_wx_uniform (msg_type, msg_name);
on t_msg_wx_uniform (msg_type, msg_name);

create table t_msg_ma_subscribe
(
id integer
constraint t_msg_ma_subscribe_pk
primary key autoincrement,
msg_type integer,
msg_name text,
template_id text,
page text,
create_time datetime,
modified_time datetime
);

create unique index t_msg_ma_subscribe_msg_type_msg_name_uindex
on t_msg_ma_subscribe (msg_type, msg_name);

2 changes: 1 addition & 1 deletion src/main/resources/generatorConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<table schema="main" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false"
tableName="t_msg_wx_uniform" domainObjectName="TMsgWxUniform">
tableName="t_msg_ma_subscribe" domainObjectName="TMsgMaSubscribe">
<property name="useActualColumnNames" value="false"/>
<!--<generatedKey column="ID" sqlStatement="DB2" identity="true"/>-->
</table>
Expand Down
117 changes: 117 additions & 0 deletions src/main/resources/mapper/TMsgMaSubscribeMapper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?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="com.fangxuele.tool.push.dao.TMsgMaSubscribeMapper">
<resultMap id="BaseResultMap" type="com.fangxuele.tool.push.domain.TMsgMaSubscribe">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="msg_type" jdbcType="INTEGER" property="msgType" />
<result column="msg_name" jdbcType="VARCHAR" property="msgName" />
<result column="template_id" jdbcType="VARCHAR" property="templateId" />
<result column="page" jdbcType="VARCHAR" property="page" />
<result column="create_time" jdbcType="VARCHAR" property="createTime" />
<result column="modified_time" jdbcType="VARCHAR" property="modifiedTime" />
</resultMap>
<sql id="Base_Column_List">
id, msg_type, msg_name, template_id, page, create_time, modified_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_msg_ma_subscribe
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from t_msg_ma_subscribe
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.fangxuele.tool.push.domain.TMsgMaSubscribe">
insert into t_msg_ma_subscribe (id, msg_type, msg_name,
template_id, page, create_time,
modified_time)
values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR},
#{templateId,jdbcType=VARCHAR}, #{page,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR},
#{modifiedTime,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.fangxuele.tool.push.domain.TMsgMaSubscribe">
insert into t_msg_ma_subscribe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="msgType != null">
msg_type,
</if>
<if test="msgName != null">
msg_name,
</if>
<if test="templateId != null">
template_id,
</if>
<if test="page != null">
page,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="modifiedTime != null">
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="msgType != null">
#{msgType,jdbcType=INTEGER},
</if>
<if test="msgName != null">
#{msgName,jdbcType=VARCHAR},
</if>
<if test="templateId != null">
#{templateId,jdbcType=VARCHAR},
</if>
<if test="page != null">
#{page,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null">
#{modifiedTime,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.fangxuele.tool.push.domain.TMsgMaSubscribe">
update t_msg_ma_subscribe
<set>
<if test="msgType != null">
msg_type = #{msgType,jdbcType=INTEGER},
</if>
<if test="msgName != null">
msg_name = #{msgName,jdbcType=VARCHAR},
</if>
<if test="templateId != null">
template_id = #{templateId,jdbcType=VARCHAR},
</if>
<if test="page != null">
page = #{page,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.fangxuele.tool.push.domain.TMsgMaSubscribe">
update t_msg_ma_subscribe
set msg_type = #{msgType,jdbcType=INTEGER},
msg_name = #{msgName,jdbcType=VARCHAR},
template_id = #{templateId,jdbcType=VARCHAR},
page = #{page,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=VARCHAR},
modified_time = #{modifiedTime,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
1 change: 1 addition & 0 deletions src/main/resources/mybatis-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
<mapper resource="mapper/TMsgDingMapper.xml"/>
<mapper resource="mapper/TDingAppMapper.xml"/>
<mapper resource="mapper/TMsgWxUniformMapper.xml"/>
<mapper resource="mapper/TMsgMaSubscribeMapper.xml"/>
</mappers>
</configuration>

0 comments on commit b690264

Please sign in to comment.