Commit 0ceb0afa authored by shiyu's avatar shiyu

关注和粉丝

parent fb807b73
......@@ -31,4 +31,7 @@ public interface CommConsts {
* 上传微信小程序码目录
*/
public static final String UPLOAD_PRE_WXACODE_DIRECTORY = "quanku/wxacode/";
}
package com.wwdz.ch.core.consts;
public class MessageEnum {
public enum StateEnum {
UNREAD(0, "未读"),
READED(1, "已读"),
DELETED(2, "删除"),
;
private int code;
private String des;
StateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (StateEnum stateEnum : StateEnum.values()) {
if (code == stateEnum.getCode()) {
return stateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
public enum TypeEnum {
SYSTEM(0, "系统信息"),
SHARE(1, "分享信息"),
COLLECT(2, "收藏信息"),
FOLLOW(3, "关注信息"),
;
private int code;
private String des;
TypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (TypeEnum typeEnum : TypeEnum.values()) {
if (code == typeEnum.getCode()) {
return typeEnum.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.FollowFansRecord;
import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto;
import java.util.List;
public interface FollowFansRecordDao {
int add(FollowFansRecord record);
/**
* 取消关注
* @param record
* @return
*/
boolean delete(FollowFansRecord record);
List<FollowFansRecord> findList(FollowFansRecordRequestDto dto);
FollowFansRecord findOne(FollowFansRecordRequestDto dto);
/**
* 统计关注的人数
* @param id
* @return
*/
long countFollowers(long id);
/**
* 统计粉丝的人数
* @param id
* @return
*/
long countFans(long id);
}
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.MessageContent;
import com.wwdz.ch.db.dto.MessageContentRequestDto;
import java.util.List;
public interface MessageContentDao {
int add(MessageContent messageContent);
/**
* 查询消息列表
* @param dto
* @return
*/
List<MessageContent> findList(MessageContentRequestDto dto);
List<MessageContent> findListByIds(List<Integer> idList);
}
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.MessageRecord;
import com.wwdz.ch.db.dto.MessageRecordRequestDto;
import java.util.List;
public interface MessageRecordDao {
int add(MessageRecord messageRecord);
/**
* 统计消息数量
* @param dto
* @return
*/
long count(MessageRecordRequestDto dto);
/**
* 查询消息列表
* @param dto
* @return
*/
List<MessageRecord> findList(MessageRecordRequestDto dto);
boolean update(MessageRecord record);
}
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/09/15
*/
@Data
public class FollowFansRecord implements Entity {
private Integer id;
/**
* 粉丝id
*/
private Long fansId;
/**
* 被关注者id
*/
private Long followerId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态
*/
private Integer state;
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(", fansId=").append(fansId);
sb.append(", followerId=").append(followerId);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", state=").append(state);
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;
}
FollowFansRecord other = (FollowFansRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getFansId() == null ? other.getFansId() == null : this.getFansId().equals(other.getFansId()))
&& (this.getFollowerId() == null ? other.getFollowerId() == null : this.getFollowerId().equals(other.getFollowerId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getFansId() == null) ? 0 : getFansId().hashCode());
result = prime * result + ((getFollowerId() == null) ? 0 : getFollowerId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
fansId("fans_id", "fansId", "BIGINT", false),
followerId("follower_id", "followerId", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
state("state", "state", "INTEGER", true);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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 follow_fans_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.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/09/15
*/
@Data
public class MessageContent implements Entity {
private Integer id;
/**
* 发送者id
*/
private Long senderId;
/**
* 消息类型
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
/**
* 消息内容
*/
private String content;
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(", senderId=").append(senderId);
sb.append(", type=").append(type);
sb.append(", createTime=").append(createTime);
sb.append(", content=").append(content);
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;
}
MessageContent other = (MessageContent) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getSenderId() == null ? other.getSenderId() == null : this.getSenderId().equals(other.getSenderId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getSenderId() == null) ? 0 : getSenderId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table message_content
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
senderId("sender_id", "senderId", "BIGINT", false),
type("type", "type", "INTEGER", true),
createTime("create_time", "createTime", "TIMESTAMP", false),
content("content", "content", "LONGVARCHAR", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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 message_content
*
* @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
This diff is collapsed.
package com.wwdz.ch.db.dto;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class MessageContentRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 发送者id
*/
private Long senderId;
/**
* 消息类型
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
/**
* 消息内容
*/
private String content;
}
package com.wwdz.ch.db.dto;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class MessageRecordRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 接收者id
*/
private Long receiverId;
/**
* 对应消息id
*/
private Integer messageId;
/**
* 消息状态
*/
private Integer state;
/**
* 消息类型
*/
private Integer type;
/**
* 被排除的消息状态
*/
private Integer excluedState;
/**
* 重试次数
*/
private Integer tryNum;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
package com.wwdz.ch.db.dto.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class FollowFansRecordRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 被查询对象的id
*/
private Long searchTargetId;
/**
* 粉丝id
*/
private Long fansId;
/**
* 被关注者id
*/
private Long followerId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态
*/
private Integer state;
}
package com.wwdz.ch.db.impl;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.FollowFansRecordDao;
import com.wwdz.ch.db.domain.FollowFansRecord;
import com.wwdz.ch.db.domain.FollowFansRecordExample;
import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto;
import com.wwdz.ch.db.mapper.FollowFansRecordMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class FollowFansRecordDaoImpl implements FollowFansRecordDao {
@Autowired
FollowFansRecordMapper followFansRecordMapper;
@Override
public int add(FollowFansRecord record) {
followFansRecordMapper.insertSelective(record);
return record.getId();
}
@Override
public boolean delete(FollowFansRecord record) {
return followFansRecordMapper.updateByPrimaryKeySelective(record) > 0;
}
@Override
public List<FollowFansRecord> findList(FollowFansRecordRequestDto dto) {
FollowFansRecordExample example = new FollowFansRecordExample();
FollowFansRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getFollowerId(), criteria::andFollowerIdEqualTo);
JdbcHelper.ifPresent(dto.getFansId(), criteria::andFansIdEqualTo);
criteria.andStateEqualTo(1);
PageHelper.startPage(dto.getPage(), dto.getLimit());
return followFansRecordMapper.selectByExample(example);
}
@Override
public FollowFansRecord findOne(FollowFansRecordRequestDto dto) {
FollowFansRecordExample example = new FollowFansRecordExample();
FollowFansRecordExample.Criteria criteria = example.createCriteria();
criteria.andFollowerIdEqualTo(dto.getFollowerId());
criteria.andFansIdEqualTo(dto.getFansId());
criteria.andStateEqualTo(1);
return followFansRecordMapper.selectOneByExample(example);
}
@Override
public long countFollowers(long id) {
FollowFansRecordExample example = new FollowFansRecordExample();
FollowFansRecordExample.Criteria criteria = example.createCriteria();
criteria.andFansIdEqualTo(id);
criteria.andStateEqualTo(1);
return followFansRecordMapper.countByExample(example);
}
@Override
public long countFans(long id) {
FollowFansRecordExample example = new FollowFansRecordExample();
FollowFansRecordExample.Criteria criteria = example.createCriteria();
criteria.andFollowerIdEqualTo(id);
criteria.andStateEqualTo(1);
return followFansRecordMapper.countByExample(example);
}
}
package com.wwdz.ch.db.impl;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.MessageContentDao;
import com.wwdz.ch.db.domain.MessageContent;
import com.wwdz.ch.db.domain.MessageContentExample;
import com.wwdz.ch.db.dto.MessageContentRequestDto;
import com.wwdz.ch.db.mapper.MessageContentMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class MessageContentDaoImpl implements MessageContentDao {
@Autowired
MessageContentMapper messageContentMapper;
@Override
public int add(MessageContent messageContent) {
messageContentMapper.insertSelective(messageContent);
return messageContent.getId();
}
@Override
public List<MessageContent> findList(MessageContentRequestDto dto) {
MessageContentExample example = new MessageContentExample();
MessageContentExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getSenderId(), criteria::andSenderIdEqualTo);
JdbcHelper.ifPresent(dto.getId(), criteria::andIdEqualTo);
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
PageHelper.startPage(dto.getPage(), dto.getLimit());
return messageContentMapper.selectByExample(example);
}
@Override
public List<MessageContent> findListByIds(List<Integer> idList) {
MessageContentExample example = new MessageContentExample();
MessageContentExample.Criteria criteria = example.createCriteria();
criteria.andIdIn(idList);
return messageContentMapper.selectByExample(example);
}
}
package com.wwdz.ch.db.impl;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.MessageRecordDao;
import com.wwdz.ch.db.domain.MessageRecord;
import com.wwdz.ch.db.domain.MessageRecordExample;
import com.wwdz.ch.db.dto.MessageRecordRequestDto;
import com.wwdz.ch.db.mapper.MessageRecordMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class MessageRecordDaoImpl implements MessageRecordDao {
@Autowired
MessageRecordMapper messageRecordMapper;
@Override
public int add(MessageRecord messageRecord) {
messageRecordMapper.insertSelective(messageRecord);
return messageRecord.getId();
}
@Override
public long count(MessageRecordRequestDto dto) {
MessageRecordExample example = new MessageRecordExample();
MessageRecordExample.Criteria criteria = example.createCriteria();
criteria.andReceiverIdEqualTo(dto.getReceiverId());
criteria.andStateEqualTo(dto.getState());
return messageRecordMapper.countByExample(example);
}
@Override
public List<MessageRecord> findList(MessageRecordRequestDto dto) {
MessageRecordExample example = new MessageRecordExample();
MessageRecordExample.Criteria criteria = example.createCriteria();
criteria.andReceiverIdEqualTo(dto.getReceiverId());
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
JdbcHelper.ifPresent(dto.getState(), criteria::andStateEqualTo);
//排除删除的消息
JdbcHelper.ifPresent(dto.getExcluedState(), criteria::andStateNotEqualTo);
example.setOrderByClause(" update_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return messageRecordMapper.selectByExample(example);
}
@Override
public boolean update(MessageRecord record) {
return messageRecordMapper.updateByPrimaryKeySelective(record) > 0;
}
}
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.FollowFansRecord;
import com.wwdz.ch.db.domain.FollowFansRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface FollowFansRecordMapper {
long countByExample(FollowFansRecordExample example);
int deleteByExample(FollowFansRecordExample example);
int deleteByPrimaryKey(Integer id);
int insert(FollowFansRecord record);
int insertSelective(FollowFansRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
FollowFansRecord selectOneByExample(FollowFansRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
FollowFansRecord selectOneByExampleSelective(@Param("example") FollowFansRecordExample example, @Param("selective") FollowFansRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<FollowFansRecord> selectByExampleSelective(@Param("example") FollowFansRecordExample example, @Param("selective") FollowFansRecord.Column ... selective);
List<FollowFansRecord> selectByExample(FollowFansRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
FollowFansRecord selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") FollowFansRecord.Column ... selective);
FollowFansRecord selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") FollowFansRecord record, @Param("example") FollowFansRecordExample example);
int updateByExample(@Param("record") FollowFansRecord record, @Param("example") FollowFansRecordExample example);
int updateByPrimaryKeySelective(FollowFansRecord record);
int updateByPrimaryKey(FollowFansRecord record);
}
\ No newline at end of file
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.MessageContent;
import com.wwdz.ch.db.domain.MessageContentExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface MessageContentMapper {
long countByExample(MessageContentExample example);
int deleteByExample(MessageContentExample example);
int deleteByPrimaryKey(Integer id);
int insert(MessageContent record);
int insertSelective(MessageContent record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_content
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageContent selectOneByExample(MessageContentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_content
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageContent selectOneByExampleSelective(@Param("example") MessageContentExample example, @Param("selective") MessageContent.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_content
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageContent selectOneByExampleWithBLOBs(MessageContentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_content
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<MessageContent> selectByExampleSelective(@Param("example") MessageContentExample example, @Param("selective") MessageContent.Column ... selective);
List<MessageContent> selectByExampleWithBLOBs(MessageContentExample example);
List<MessageContent> selectByExample(MessageContentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_content
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageContent selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") MessageContent.Column ... selective);
MessageContent selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") MessageContent record, @Param("example") MessageContentExample example);
int updateByExampleWithBLOBs(@Param("record") MessageContent record, @Param("example") MessageContentExample example);
int updateByExample(@Param("record") MessageContent record, @Param("example") MessageContentExample example);
int updateByPrimaryKeySelective(MessageContent record);
int updateByPrimaryKeyWithBLOBs(MessageContent record);
int updateByPrimaryKey(MessageContent record);
}
\ No newline at end of file
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.MessageRecord;
import com.wwdz.ch.db.domain.MessageRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface MessageRecordMapper {
long countByExample(MessageRecordExample example);
int deleteByExample(MessageRecordExample example);
int deleteByPrimaryKey(Integer id);
int insert(MessageRecord record);
int insertSelective(MessageRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageRecord selectOneByExample(MessageRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageRecord selectOneByExampleSelective(@Param("example") MessageRecordExample example, @Param("selective") MessageRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<MessageRecord> selectByExampleSelective(@Param("example") MessageRecordExample example, @Param("selective") MessageRecord.Column ... selective);
List<MessageRecord> selectByExample(MessageRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table message_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
MessageRecord selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") MessageRecord.Column ... selective);
MessageRecord selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") MessageRecord record, @Param("example") MessageRecordExample example);
int updateByExample(@Param("record") MessageRecord record, @Param("example") MessageRecordExample example);
int updateByPrimaryKeySelective(MessageRecord record);
int updateByPrimaryKey(MessageRecord record);
}
\ No newline at end of file
package com.wwdz.ch.wx.entity.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class MessageRequestDto implements Entity {
/**
* 发送者id
*/
private Long senderId;
/**
* 消息类型
*/
private Integer type;
/**
* 消息内容
*/
private String content;
/**
* 接收者id
*/
private Long receiverId;
/**
* 对应消息id
*/
private Integer messageId;
private List<Integer> messageIdList;
/**
* 消息状态
*/
private Integer state;
/**
* 重试次数
*/
private Integer tryNum;
/**
* 创建时间
*/
private Date createTime;
}
package com.wwdz.ch.wx.entity.vo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class FollowFansRecordVo implements Entity {
private Integer id;
/**
* 粉丝id
*/
private Long fansId;
private String fansName;
/**
* 被关注者id
*/
private Long followerId;
private String followerName;
/**
* 关系(已关注,互相关注, 回关)
*/
private String relation;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态
*/
private Integer state;
private String stateName;
}
package com.wwdz.ch.wx.entity.vo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.Map;
@Data
public class MessageVo implements Entity {
/**
* 发送者id
*/
private Long senderId;
private String senderName;
/**
* 消息类型
*/
private Integer type;
private String typeName;
/**
* 消息内容
*/
private Map<String, Object> content;
/**
* 接收者id
*/
private Long receiverId;
private String receiverName;
/**
* 对应消息id
*/
private Integer messageId;
/**
* 消息状态
*/
private Integer state;
/**
* 重试次数
*/
private Integer tryNum;
/**
* 创建时间
*/
private Date createTime;
}
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