Commit baee6e33 authored by shiyu's avatar shiyu

公众号订阅

parent bf0c628f
package com.wwdz.ch.core.consts;
/**
* 公众号枚举
*/
public class OfficalAccountEnum {
/**
* 平台类型
*/
public enum PlatformTypeEnum {
WECHAT(1, "微信"),
ALIPAY(2, "支付宝"),
TIKTOK(3, "抖音"),
;
private int code;
private String des;
PlatformTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (OfficalAccountEnum.PlatformTypeEnum platformTypeEnum : OfficalAccountEnum.PlatformTypeEnum.values()) {
if (code == platformTypeEnum.getCode()) {
return platformTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
}
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
public interface OfficialAccountSubscribeRecordDao {
boolean insert(OfficialAccountSubscribeRecord officialAccountSubscribeRecord);
boolean update(OfficialAccountSubscribeRecord officialAccountSubscribeRecord);
boolean isExisted(String openid);
boolean isSubscribed(String openid);
}
package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2023/10/13
*/
@Data
public class OfficialAccountSubscribeRecord implements Entity {
private Integer id;
/**
* openid
*/
private String openid;
/**
* 平台类型(1微信,2支付宝,3其他)
*/
private Integer platformType;
/**
* 手机号
*/
private String phone;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否有效0无效,1有效
*/
private Integer enabled;
private static final long serialVersionUID = 1L;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", openid=").append(openid);
sb.append(", platformType=").append(platformType);
sb.append(", phone=").append(phone);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", enabled=").append(enabled);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
OfficialAccountSubscribeRecord other = (OfficialAccountSubscribeRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOpenid() == null ? other.getOpenid() == null : this.getOpenid().equals(other.getOpenid()))
&& (this.getPlatformType() == null ? other.getPlatformType() == null : this.getPlatformType().equals(other.getPlatformType()))
&& (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOpenid() == null) ? 0 : getOpenid().hashCode());
result = prime * result + ((getPlatformType() == null) ? 0 : getPlatformType().hashCode());
result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
openid("openid", "openid", "VARCHAR", false),
platformType("platform_type", "platformType", "INTEGER", false),
phone("phone", "phone", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
enabled("enabled", "enabled", "INTEGER", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class OfficialAccountSubscribeRecordExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OfficialAccountSubscribeRecordExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public OfficialAccountSubscribeRecordExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public OfficialAccountSubscribeRecordExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
OfficialAccountSubscribeRecordExample example = new OfficialAccountSubscribeRecordExample();
return example.createCriteria();
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andOpenidIsNull() {
addCriterion("openid is null");
return (Criteria) this;
}
public Criteria andOpenidIsNotNull() {
addCriterion("openid is not null");
return (Criteria) this;
}
public Criteria andOpenidEqualTo(String value) {
addCriterion("openid =", value, "openid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andOpenidEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("openid = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andOpenidNotEqualTo(String value) {
addCriterion("openid <>", value, "openid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andOpenidNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("openid <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andOpenidGreaterThan(String value) {
addCriterion("openid >", value, "openid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andOpenidGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("openid > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andOpenidGreaterThanOrEqualTo(String value) {
addCriterion("openid >=", value, "openid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andOpenidGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("openid >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andOpenidLessThan(String value) {
addCriterion("openid <", value, "openid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andOpenidLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("openid < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andOpenidLessThanOrEqualTo(String value) {
addCriterion("openid <=", value, "openid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andOpenidLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("openid <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andOpenidLike(String value) {
addCriterion("openid like", value, "openid");
return (Criteria) this;
}
public Criteria andOpenidNotLike(String value) {
addCriterion("openid not like", value, "openid");
return (Criteria) this;
}
public Criteria andOpenidIn(List<String> values) {
addCriterion("openid in", values, "openid");
return (Criteria) this;
}
public Criteria andOpenidNotIn(List<String> values) {
addCriterion("openid not in", values, "openid");
return (Criteria) this;
}
public Criteria andOpenidBetween(String value1, String value2) {
addCriterion("openid between", value1, value2, "openid");
return (Criteria) this;
}
public Criteria andOpenidNotBetween(String value1, String value2) {
addCriterion("openid not between", value1, value2, "openid");
return (Criteria) this;
}
public Criteria andPlatformTypeIsNull() {
addCriterion("platform_type is null");
return (Criteria) this;
}
public Criteria andPlatformTypeIsNotNull() {
addCriterion("platform_type is not null");
return (Criteria) this;
}
public Criteria andPlatformTypeEqualTo(Integer value) {
addCriterion("platform_type =", value, "platformType");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPlatformTypeEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("platform_type = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPlatformTypeNotEqualTo(Integer value) {
addCriterion("platform_type <>", value, "platformType");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPlatformTypeNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("platform_type <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPlatformTypeGreaterThan(Integer value) {
addCriterion("platform_type >", value, "platformType");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPlatformTypeGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("platform_type > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPlatformTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("platform_type >=", value, "platformType");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPlatformTypeGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("platform_type >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPlatformTypeLessThan(Integer value) {
addCriterion("platform_type <", value, "platformType");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPlatformTypeLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("platform_type < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPlatformTypeLessThanOrEqualTo(Integer value) {
addCriterion("platform_type <=", value, "platformType");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPlatformTypeLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("platform_type <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPlatformTypeIn(List<Integer> values) {
addCriterion("platform_type in", values, "platformType");
return (Criteria) this;
}
public Criteria andPlatformTypeNotIn(List<Integer> values) {
addCriterion("platform_type not in", values, "platformType");
return (Criteria) this;
}
public Criteria andPlatformTypeBetween(Integer value1, Integer value2) {
addCriterion("platform_type between", value1, value2, "platformType");
return (Criteria) this;
}
public Criteria andPlatformTypeNotBetween(Integer value1, Integer value2) {
addCriterion("platform_type not between", value1, value2, "platformType");
return (Criteria) this;
}
public Criteria andPhoneIsNull() {
addCriterion("phone is null");
return (Criteria) this;
}
public Criteria andPhoneIsNotNull() {
addCriterion("phone is not null");
return (Criteria) this;
}
public Criteria andPhoneEqualTo(String value) {
addCriterion("phone =", value, "phone");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPhoneEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("phone = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPhoneNotEqualTo(String value) {
addCriterion("phone <>", value, "phone");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPhoneNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("phone <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPhoneGreaterThan(String value) {
addCriterion("phone >", value, "phone");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPhoneGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("phone > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPhoneGreaterThanOrEqualTo(String value) {
addCriterion("phone >=", value, "phone");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPhoneGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("phone >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPhoneLessThan(String value) {
addCriterion("phone <", value, "phone");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPhoneLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("phone < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPhoneLessThanOrEqualTo(String value) {
addCriterion("phone <=", value, "phone");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPhoneLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("phone <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPhoneLike(String value) {
addCriterion("phone like", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotLike(String value) {
addCriterion("phone not like", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneIn(List<String> values) {
addCriterion("phone in", values, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotIn(List<String> values) {
addCriterion("phone not in", values, "phone");
return (Criteria) this;
}
public Criteria andPhoneBetween(String value1, String value2) {
addCriterion("phone between", value1, value2, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotBetween(String value1, String value2) {
addCriterion("phone not between", value1, value2, "phone");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("create_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("create_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("create_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("create_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("create_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("create_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("update_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("update_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("update_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("update_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("update_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("update_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andEnabledIsNull() {
addCriterion("enabled is null");
return (Criteria) this;
}
public Criteria andEnabledIsNotNull() {
addCriterion("enabled is not null");
return (Criteria) this;
}
public Criteria andEnabledEqualTo(Integer value) {
addCriterion("enabled =", value, "enabled");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEnabledEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("enabled = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEnabledNotEqualTo(Integer value) {
addCriterion("enabled <>", value, "enabled");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEnabledNotEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("enabled <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEnabledGreaterThan(Integer value) {
addCriterion("enabled >", value, "enabled");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEnabledGreaterThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("enabled > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEnabledGreaterThanOrEqualTo(Integer value) {
addCriterion("enabled >=", value, "enabled");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEnabledGreaterThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("enabled >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEnabledLessThan(Integer value) {
addCriterion("enabled <", value, "enabled");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEnabledLessThanColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("enabled < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEnabledLessThanOrEqualTo(Integer value) {
addCriterion("enabled <=", value, "enabled");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEnabledLessThanOrEqualToColumn(OfficialAccountSubscribeRecord.Column column) {
addCriterion(new StringBuilder("enabled <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEnabledIn(List<Integer> values) {
addCriterion("enabled in", values, "enabled");
return (Criteria) this;
}
public Criteria andEnabledNotIn(List<Integer> values) {
addCriterion("enabled not in", values, "enabled");
return (Criteria) this;
}
public Criteria andEnabledBetween(Integer value1, Integer value2) {
addCriterion("enabled between", value1, value2, "enabled");
return (Criteria) this;
}
public Criteria andEnabledNotBetween(Integer value1, Integer value2) {
addCriterion("enabled not between", value1, value2, "enabled");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private OfficialAccountSubscribeRecordExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(OfficialAccountSubscribeRecordExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public OfficialAccountSubscribeRecordExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.impl;
import com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecordExample;
import com.wwdz.ch.db.domain.OperateLog;
import com.wwdz.ch.db.mapper.OfficialAccountSubscribeRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
@Repository
public class OfficialAccountSubscribeRecordDaoImpl implements OfficialAccountSubscribeRecordDao {
@Autowired
OfficialAccountSubscribeRecordMapper officialAccountSubscribeRecordMapper;
@Override
public boolean insert(OfficialAccountSubscribeRecord officialAccountSubscribeRecord) {
return officialAccountSubscribeRecordMapper.insert(officialAccountSubscribeRecord) > 0;
}
@Override
public boolean update(OfficialAccountSubscribeRecord officialAccountSubscribeRecord) {
OfficialAccountSubscribeRecordExample example = new OfficialAccountSubscribeRecordExample();
OfficialAccountSubscribeRecordExample.Criteria criteria = example.createCriteria();
criteria.andOpenidEqualTo(officialAccountSubscribeRecord.getOpenid());
return officialAccountSubscribeRecordMapper.updateByExampleSelective(officialAccountSubscribeRecord, example) > 0;
}
@Override
public boolean isExisted(String openid) {
OfficialAccountSubscribeRecordExample example = new OfficialAccountSubscribeRecordExample();
OfficialAccountSubscribeRecordExample.Criteria criteria = example.createCriteria();
criteria.andOpenidEqualTo(openid);
return officialAccountSubscribeRecordMapper.countByExample(example) > 0;
}
@Override
public boolean isSubscribed(String openid) {
OfficialAccountSubscribeRecordExample example = new OfficialAccountSubscribeRecordExample();
OfficialAccountSubscribeRecordExample.Criteria criteria = example.createCriteria();
criteria.andOpenidEqualTo(openid);
criteria.andEnabledEqualTo(1);
return officialAccountSubscribeRecordMapper.countByExample(example) > 0;
}
}
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface OfficialAccountSubscribeRecordMapper {
long countByExample(OfficialAccountSubscribeRecordExample example);
int deleteByExample(OfficialAccountSubscribeRecordExample example);
int deleteByPrimaryKey(Integer id);
int insert(OfficialAccountSubscribeRecord record);
int insertSelective(OfficialAccountSubscribeRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
OfficialAccountSubscribeRecord selectOneByExample(OfficialAccountSubscribeRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
OfficialAccountSubscribeRecord selectOneByExampleSelective(@Param("example") OfficialAccountSubscribeRecordExample example, @Param("selective") OfficialAccountSubscribeRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<OfficialAccountSubscribeRecord> selectByExampleSelective(@Param("example") OfficialAccountSubscribeRecordExample example, @Param("selective") OfficialAccountSubscribeRecord.Column ... selective);
List<OfficialAccountSubscribeRecord> selectByExample(OfficialAccountSubscribeRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table official_account_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
OfficialAccountSubscribeRecord selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") OfficialAccountSubscribeRecord.Column ... selective);
OfficialAccountSubscribeRecord selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") OfficialAccountSubscribeRecord record, @Param("example") OfficialAccountSubscribeRecordExample example);
int updateByExample(@Param("record") OfficialAccountSubscribeRecord record, @Param("example") OfficialAccountSubscribeRecordExample example);
int updateByPrimaryKeySelective(OfficialAccountSubscribeRecord record);
int updateByPrimaryKey(OfficialAccountSubscribeRecord record);
}
\ No newline at end of file
package com.wwdz.ch.wx.api;
import com.alibaba.fastjson.JSONObject;
import com.wwdz.ch.core.consts.OfficalAccountEnum;
import com.wwdz.ch.db.dao.UserDao;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.wx.api.aes.AesException;
import com.wwdz.ch.wx.api.aes.WXBizMsgCrypt;
import com.wwdz.ch.wx.util.StringUtil;
import com.xxdxxs.utils.JsonUtils;
import com.wwdz.ch.wx.service.OfficialAccountSubscribeRecordService;
import com.xxdxxs.utils.StringUtils;
import com.xxdxxs.utils.XmlUtils;
import org.dom4j.DocumentException;
......@@ -13,7 +15,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
......@@ -25,15 +26,14 @@ import java.util.*;
@RestController
@RequestMapping("/officialAccountCallback")
public class OfficialAccountController {
public class OfficialAccountCallbackController {
private static final Logger logger = LoggerFactory.getLogger(OfficialAccountController.class);
private static final Logger logger = LoggerFactory.getLogger(OfficialAccountCallbackController.class);
private final static String SUBSCRIBE_EVENT = "subscribe";
private final static String UNSUBSCRIBE_EVENT = "unsubscribe";
@Value("${dts.wx.officialaccount-token}")
private String OFFICIALACCOUNTTOKEN;
......@@ -46,10 +46,15 @@ public class OfficialAccountController {
@Value("${dts.wx.officialaccount-secret}")
private String APPSECRET;
@Autowired
OfficialAccountApi officialAccountApi;
@Autowired
OfficialAccountSubscribeRecordService officialAccountSubscribeRecordService;
@Autowired
UserDao userDao;
@RequestMapping(value ="/getNotice")
public Object getNotice(@RequestParam(required = false, name = "signature") String signature,
......@@ -72,17 +77,43 @@ public class OfficialAccountController {
output.write(by, 0, length);
}
String xmlInfo = new String(output.toByteArray(), "UTF-8");
logger.info("微信通知回调接口原文:{}", xmlInfo);
logger.info("微信公众号通知回调接口原文:{}", xmlInfo);
WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt(OFFICIALACCOUNTTOKEN, OFFICIALACCOUNTKEY, APPID);
String xmlStr = wxBizMsgCrypt.decryptXmlMsg(signature, timestamp, nonce, xmlInfo);
logger.info("微信公众号通知回调接口解密后内容:{}", xmlInfo);
List<Map<String, String>> list = XmlUtils.fromXml(xmlStr, "xml");
Map<String, String> contentMap = list.get(0);
String event = contentMap.get("Event");
if (SUBSCRIBE_EVENT.equals(event) || UNSUBSCRIBE_EVENT.equals(event)) {
String userOpenId = contentMap.get("FromUserName");
String createTime = contentMap.get("CreateTime");
Date date = new Date(createTime);
logger.info("openId:{}, event :{}, time:{}", userOpenId, event, date);
Date date = new Date(Long.valueOf(createTime));
logger.info("解析xml得到 openId:{}, event :{}, time:{}", userOpenId, event, date);
//新增或更新订阅记录
OfficialAccountSubscribeRecord officialAccountSubscribeRecord = new OfficialAccountSubscribeRecord();
officialAccountSubscribeRecord.setOpenid(userOpenId);
//查询有无历史订阅记录
boolean isExisted = officialAccountSubscribeRecordService.isExisted(userOpenId);
if (isExisted) {
if (SUBSCRIBE_EVENT.equals(event)) {
officialAccountSubscribeRecord.setEnabled(1);
} else {
officialAccountSubscribeRecord.setEnabled(0);
}
officialAccountSubscribeRecord.setUpdateTime(date);
officialAccountSubscribeRecordService.update(officialAccountSubscribeRecord);
} else {
//没有历史订阅记录,先根据openid查询手机号
User user = userDao.queryByOid(userOpenId);
if (user != null) {
officialAccountSubscribeRecord.setPhone(user.getMobile());
}
officialAccountSubscribeRecord.setCreateTime(date);
officialAccountSubscribeRecord.setUpdateTime(date);
officialAccountSubscribeRecord.setEnabled(1);
officialAccountSubscribeRecord.setPlatformType(OfficalAccountEnum.PlatformTypeEnum.WECHAT.getCode());
officialAccountSubscribeRecordService.insert(officialAccountSubscribeRecord);
}
}
} catch (Exception e) {
logger.error("微信公众号通知回调接口 error : {}", e);
......@@ -107,63 +138,27 @@ public class OfficialAccountController {
public static void main(String[] args) throws AesException, DocumentException {
String xml = "<xml><ToUserName><![CDATA[gh_075dfbc935ef]]></ToUserName>\n" +
"<FromUserName><![CDATA[oNPTN6QaVliZfKB53OzZRPBZr_r8]]></FromUserName>\n" +
"<CreateTime>1697165124</CreateTime>\n" +
"<MsgType><![CDATA[event]]></MsgType>\n" +
"<Event><![CDATA[subscribe]]></Event>\n" +
"<EventKey><![CDATA[]]></EventKey>\n" +
String xml = "<xml>\n" +
"<ToUserName><![CDATA[gh_075dfbc935ef]]></ToUserName>\n" +
"<Encrypt><![CDATA[tTfKN0RMPKKG1mvpwYS6aEt7FkHk+wgknt/y8ePwEwkKKuRxe9RV0ClGVtxDrJ35Ws12VGzAoQV3UB6oCQX+4NfjZBp2x/SRimCZrb9UVjL14PfMLEahELFFXgX7xvZP3RWJFSZHVXM1cizIhOGsffz0L9G0ohxmGx8NjZZZyJodocsThzdspiWHeQzsOOKB5g6czU4RdYWkrzVMGo/haPLHnxPps+ozBYaPp2Atqm8iFWRjs377FIWFjLbwnVUwdFE7PLkNi9JBsQzBakfRMui6IcjjStM3zyZQXRIpnGory5aaEbPts2iDaYCI+Pf7WPS+bo4Jp04KyDmxMOEf6iWP43VJ5tsrtGKpP2pFmnwZ9agTSNn6EPZocnLBIX6PUWBJSMi3j2PxJ93I+8rA2F+d63CmhNIEi9CXLFMZSSg=]]></Encrypt>\n" +
"</xml>";
WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt("Uu6GHYOiP1xJ6GaBMyXfnITufAGJTe3Q", "noeN1amYRvzrVmE2GnC5VnsIfgPEmv6bhX54wJOARlM", "wx7db8eb146a194083");
List<Map<String, String>> list = XmlUtils.fromXml(xml, "xml");
String xmlStr = wxBizMsgCrypt.decryptXmlMsg("150532dfbcfdaace820c0e98e34e919193fcca87", "1697175880", "2012082450", xml);
System.out.println(">>>>" +xmlStr);
List<Map<String, String>> list = XmlUtils.fromXml(xmlStr, "xml");
Map<String, String> contentMap = list.get(0);
System.out.println(contentMap.get("Event") + ">>" + contentMap.get("FromUserName") + ">>" + contentMap.get("CreateTime"));
String event = wxBizMsgCrypt.decrypt(contentMap.get("Event"));
String event = contentMap.get("Event");
if (SUBSCRIBE_EVENT.equals(event) || UNSUBSCRIBE_EVENT.equals(event)) {
String userOpenId = wxBizMsgCrypt.decrypt(contentMap.get("FromUserName"));
String createTime = wxBizMsgCrypt.decrypt(contentMap.get("CreateTime"));
Date date = new Date(createTime);
String userOpenId = contentMap.get("FromUserName");
String createTime = contentMap.get("CreateTime");
Date date = new Date(Long.valueOf(createTime));
System.out.println(userOpenId + ">>" + event + ">>" + date);
}
}
@RequestMapping(value ="/getSubscribeNotice", consumes = "text/xml")
public Object getSubscribeNotice(@RequestParam(required = false, name = "signature") String signature,
@RequestParam(required = false, name = "timestamp") String timestamp,
@RequestParam(required = false, name = "nonce") String nonce,
@RequestParam(required = false, name = "echostr") String echostr,
@RequestBody(required = false) String xmlInfo,
HttpServletResponse response) throws IOException {
try {
logger.info("接收公众号推送信息校验 -> appid: {}, signature:{}, timestamp:{}, nonce:{}, echostr : {}", APPID, signature, timestamp, nonce, echostr);
WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt(OFFICIALACCOUNTTOKEN, OFFICIALACCOUNTKEY, APPID);
if (StringUtils.hasLength(echostr)) {
return Long.valueOf(echostr.trim());
}
logger.info("公众号推送的消息原文 -> {}", xmlInfo);
String xmlStr = wxBizMsgCrypt.decryptMsg(signature, timestamp, nonce, xmlInfo);
logger.info("解密后获取公众号推送的信息内容 : {}", xmlStr);
List<Map<String, String>> list = XmlUtils.fromXml(xmlStr, "xml");
if (!CollectionUtils.isEmpty(list)) {
Map<String, String> contentMap = list.get(0);
String event = contentMap.get("Event");
if (SUBSCRIBE_EVENT.equals(event) || UNSUBSCRIBE_EVENT.equals(event)) {
String userOpenId = contentMap.get("FromUserName");
String createTime = contentMap.get("CreateTime");
Date date = new Date(createTime);
logger.info("openId:{}, event :{}, time:{}", userOpenId, event, date);
}
}
} catch (Exception e) {
logger.error("公众号推送信息error : {}", e);
}
return "success";
}
@RequestMapping(value ="/getToken")
public String getToken(){
......
......@@ -40,6 +40,7 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
.excludePathPatterns("/*.html", "/**/*.html", "/**/*.css", "/**/*.js"
, "/wx/user/loginByWx", "/wx/user/loginByMobile", "/wx/user/loginRegCaptcha", "/wx/user/updateRegCaptcha", "/wx/user/login", "/wx/user/fillCode",
"/officialAccountCallback/**",
"/wx/officialAccount/**",
"/wx/item/**"
);
}
......
package com.wwdz.ch.wx.impl;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
import com.wwdz.ch.wx.service.OfficialAccountSubscribeRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
public class OfficialAccountSubscribeRecordServiceImpl implements OfficialAccountSubscribeRecordService {
private static final Logger logger = LoggerFactory.getLogger(OfficialAccountSubscribeRecordServiceImpl.class);
private static final String OFFICAL_ACCOUNT_URL = "https://mp.weixin.qq.com/s/DEYZJMRnDKYkKxir6Gsx8w";
@Autowired
OfficialAccountSubscribeRecordDao officialAccountSubscribeRecordDao;
@Override
public Result insert(OfficialAccountSubscribeRecord officialAccountSubscribeRecord) {
try {
officialAccountSubscribeRecordDao.insert(officialAccountSubscribeRecord);
return Result.success();
} catch (Exception e) {
logger.error("新增公众号订阅记录出错:{}", e);
}
return Result.failed();
}
@Override
public Result update(OfficialAccountSubscribeRecord officialAccountSubscribeRecord) {
try {
officialAccountSubscribeRecordDao.update(officialAccountSubscribeRecord);
return Result.success();
} catch (Exception e) {
logger.error("新增公众号订阅记录出错:{}", e);
}
return Result.failed();
}
@Override
public boolean isExisted(String openid) {
return officialAccountSubscribeRecordDao.isExisted(openid);
}
@Override
public Result isSubscribed(String openid) {
try {
boolean flag = officialAccountSubscribeRecordDao.isSubscribed(openid);
Map<String, Object> map = new HashMap<>();
map.put("isSubscribed", flag);
map.put("url", OFFICAL_ACCOUNT_URL);
return Result.success(map);
} catch (Exception e) {
logger.error("isSubscribed error :{}", e);
}
return Result.failed();
}
}
......@@ -387,6 +387,18 @@ public class UserServiceImpl implements UserService {
}
}
@Override
public Result queryUserInfo(UserRequestDto dto) {
try {
User user = userDao.queryById(dto.getUserId());
return Result.success(user);
} catch (Exception e) {
logger.error("查询用户信息失败", e);
}
return Result.failed("查询用户信息失败");
}
@Override
public Result guestUserInfo(UserRequestDto dto, HttpServletRequest request) {
try {
......
package com.wwdz.ch.wx.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
public interface OfficialAccountSubscribeRecordService {
Result insert(OfficialAccountSubscribeRecord officialAccountSubscribeRecord);
Result update(OfficialAccountSubscribeRecord officialAccountSubscribeRecord);
/**
* 是否有历史订阅记录
* @param openid
* @return
*/
boolean isExisted(String openid);
/**
* 是否关注过公众号
* @param openid
* @return
*/
Result isSubscribed(String openid);
}
......@@ -80,6 +80,15 @@ public interface UserService {
*/
Result userInfo(HttpServletRequest request);
/**
* 查询用户信息
*
* @param dto
* @return
*/
Result queryUserInfo(UserRequestDto dto);
/**
* 查询用户信息
*
......
package com.wwdz.ch.wx.web;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.wx.entity.request.UserRequestDto;
import com.wwdz.ch.wx.service.OfficialAccountSubscribeRecordService;
import com.wwdz.ch.wx.service.UserService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/officialAccount")
public class OfficialAccountController {
private static final Logger logger = LoggerFactory.getLogger(OfficialAccountController.class);
@Autowired
OfficialAccountSubscribeRecordService officialAccountSubscribeRecordService;
@Autowired
UserService userService;
@ApiOperation(value = "判断用户是否关注过公众号")
@PostMapping("/isSubscribed")
public Result isSubscribed(@RequestBody UserRequestDto dto) {
logger.info("【请求开始】判断用户是否关注过公众号,请求参数:{}", JSON.toJSONString(dto));
if (StringUtils.isEmpty(dto.getUserId())) {
return Result.failed(ResultCode.PARAM_ERROR);
}
Result<User> result = userService.queryUserInfo(dto);
String openid = null;
if (result.getSuccess() && result.getData() != null) {
openid = result.getData().getWeixinOpenid();
}
if (openid == null) {
return Result.failed("该用户没有记录下openid");
}
return officialAccountSubscribeRecordService.isSubscribed(openid);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment