Commit 0abe87a3 authored by shiyu's avatar shiyu

ai助手

parent 31cb41b2
...@@ -41,6 +41,8 @@ public class MessageEnum { ...@@ -41,6 +41,8 @@ public class MessageEnum {
SHARE(1, "分享信息"), SHARE(1, "分享信息"),
COLLECT(2, "收藏信息"), COLLECT(2, "收藏信息"),
FOLLOW(3, "关注信息"), FOLLOW(3, "关注信息"),
AI_CHAT(4, "AI聊天信息"),
CHAT(5, "聊天信息"),
; ;
private int code; private int code;
...@@ -106,7 +108,7 @@ public class MessageEnum { ...@@ -106,7 +108,7 @@ public class MessageEnum {
ITEM_SHARE(1, "分享了您的藏品"), ITEM_SHARE(1, "分享了您的藏品"),
ITEM_COLLECT(2, "收藏了您的藏品"), ITEM_COLLECT(2, "收藏了您的藏品"),
FAVORITES_SHARE(3, "分享了您的收藏册"), FAVORITES_SHARE(3, "分享了您的收藏册"),
FAVORITES_COLLECT(3, "收藏了您的收藏册"), FAVORITES_COLLECT(4, "收藏了您的收藏册"),
; ;
private int code; private int code;
......
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import java.util.List;
public interface AiAssistantDao {
List<AiAssistant> findList (AiAssistantRequestDto dto);
}
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import java.util.List;
public interface AiDefaultQuestionDao {
/**
* 查询默认问题列表
* @param dto
* @return
*/
List<AiDefaultQuestion> findList (AiDefaultQuestionRequestDto dto);
}
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/11
*/
@Data
public class AiAssistant implements Entity {
private Integer id;
/**
* 头像
*/
private String avatar;
/**
* 名称
*/
private String name;
/**
* 类型
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
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(", avatar=").append(avatar);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
sb.append(", createTime=").append(createTime);
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;
}
AiAssistant other = (AiAssistant) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
avatar("avatar", "avatar", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
type("type", "type", "INTEGER", true),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 AiAssistantExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AiAssistantExample() {
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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AiAssistantExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AiAssistantExample 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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
AiAssistantExample example = new AiAssistantExample();
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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(AiAssistant.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 andAvatarIsNull() {
addCriterion("avatar is null");
return (Criteria) this;
}
public Criteria andAvatarIsNotNull() {
addCriterion("avatar is not null");
return (Criteria) this;
}
public Criteria andAvatarEqualTo(String value) {
addCriterion("avatar =", value, "avatar");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAvatarEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("avatar = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAvatarNotEqualTo(String value) {
addCriterion("avatar <>", value, "avatar");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAvatarNotEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("avatar <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAvatarGreaterThan(String value) {
addCriterion("avatar >", value, "avatar");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAvatarGreaterThanColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("avatar > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAvatarGreaterThanOrEqualTo(String value) {
addCriterion("avatar >=", value, "avatar");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAvatarGreaterThanOrEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("avatar >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAvatarLessThan(String value) {
addCriterion("avatar <", value, "avatar");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAvatarLessThanColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("avatar < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAvatarLessThanOrEqualTo(String value) {
addCriterion("avatar <=", value, "avatar");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAvatarLessThanOrEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("avatar <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAvatarLike(String value) {
addCriterion("avatar like", value, "avatar");
return (Criteria) this;
}
public Criteria andAvatarNotLike(String value) {
addCriterion("avatar not like", value, "avatar");
return (Criteria) this;
}
public Criteria andAvatarIn(List<String> values) {
addCriterion("avatar in", values, "avatar");
return (Criteria) this;
}
public Criteria andAvatarNotIn(List<String> values) {
addCriterion("avatar not in", values, "avatar");
return (Criteria) this;
}
public Criteria andAvatarBetween(String value1, String value2) {
addCriterion("avatar between", value1, value2, "avatar");
return (Criteria) this;
}
public Criteria andAvatarNotBetween(String value1, String value2) {
addCriterion("avatar not between", value1, value2, "avatar");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andNameEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`name` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andNameNotEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`name` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andNameGreaterThanColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`name` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andNameGreaterThanOrEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`name` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andNameLessThanColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`name` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andNameLessThanOrEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`name` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(AiAssistant.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(AiAssistant.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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(AiAssistant.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 static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private AiAssistantExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(AiAssistantExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AiAssistantExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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.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/11
*/
@Data
public class AiDefaultQuestion implements Entity {
private Integer id;
/**
* 问题
*/
private String question;
/**
* 问题类型
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
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(", question=").append(question);
sb.append(", type=").append(type);
sb.append(", createTime=").append(createTime);
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;
}
AiDefaultQuestion other = (AiDefaultQuestion) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getQuestion() == null ? other.getQuestion() == null : this.getQuestion().equals(other.getQuestion()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getQuestion() == null) ? 0 : getQuestion().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
question("question", "question", "VARCHAR", false),
type("type", "type", "INTEGER", true),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 AiDefaultQuestionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AiDefaultQuestionExample() {
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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AiDefaultQuestionExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AiDefaultQuestionExample 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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
AiDefaultQuestionExample example = new AiDefaultQuestionExample();
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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(AiDefaultQuestion.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 andQuestionIsNull() {
addCriterion("question is null");
return (Criteria) this;
}
public Criteria andQuestionIsNotNull() {
addCriterion("question is not null");
return (Criteria) this;
}
public Criteria andQuestionEqualTo(String value) {
addCriterion("question =", value, "question");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQuestionEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("question = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQuestionNotEqualTo(String value) {
addCriterion("question <>", value, "question");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQuestionNotEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("question <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQuestionGreaterThan(String value) {
addCriterion("question >", value, "question");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQuestionGreaterThanColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("question > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQuestionGreaterThanOrEqualTo(String value) {
addCriterion("question >=", value, "question");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQuestionGreaterThanOrEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("question >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQuestionLessThan(String value) {
addCriterion("question <", value, "question");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQuestionLessThanColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("question < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQuestionLessThanOrEqualTo(String value) {
addCriterion("question <=", value, "question");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQuestionLessThanOrEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("question <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQuestionLike(String value) {
addCriterion("question like", value, "question");
return (Criteria) this;
}
public Criteria andQuestionNotLike(String value) {
addCriterion("question not like", value, "question");
return (Criteria) this;
}
public Criteria andQuestionIn(List<String> values) {
addCriterion("question in", values, "question");
return (Criteria) this;
}
public Criteria andQuestionNotIn(List<String> values) {
addCriterion("question not in", values, "question");
return (Criteria) this;
}
public Criteria andQuestionBetween(String value1, String value2) {
addCriterion("question between", value1, value2, "question");
return (Criteria) this;
}
public Criteria andQuestionNotBetween(String value1, String value2) {
addCriterion("question not between", value1, value2, "question");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(AiDefaultQuestion.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(AiDefaultQuestion.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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(AiDefaultQuestion.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 static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private AiDefaultQuestionExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(AiDefaultQuestionExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AiDefaultQuestionExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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.dto.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class AiAssistantRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 名称
*/
private String name;
/**
* 类型
*/
private Integer type;
}
package com.wwdz.ch.db.dto.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class AiDefaultQuestionRequestDto extends BaseRequestDto implements Entity {
/**
* 问题类型
*/
private Integer type;
}
package com.wwdz.ch.db.impl;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.AiAssistantDao;
import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.domain.AiAssistantExample;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.db.mapper.AiAssistantMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class AiAssistantDaoImpl implements AiAssistantDao {
@Autowired
AiAssistantMapper aiAssistantMapper;
@Override
public List<AiAssistant> findList(AiAssistantRequestDto dto) {
AiAssistantExample aiAssistantExample = new AiAssistantExample();
PageHelper.startPage(dto.getPage(), dto.getLimit());
return aiAssistantMapper.selectByExample(aiAssistantExample);
}
}
package com.wwdz.ch.db.impl;
import com.wwdz.ch.db.dao.AiDefaultQuestionDao;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import com.wwdz.ch.db.mapper.AiDefaultQuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class AiDefaultQuestionDaoImpl implements AiDefaultQuestionDao {
@Autowired
AiDefaultQuestionMapper aiDefaultQuestionMapper;
@Override
public List<AiDefaultQuestion> findList(AiDefaultQuestionRequestDto dto) {
List<AiDefaultQuestion> list = aiDefaultQuestionMapper.selectRandom(dto);
return list;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wwdz.ch.db.mapper.AiAssistantMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.AiAssistant">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, avatar, `name`, `type`, create_time
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.AiAssistantExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from ai_assistant
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, avatar, `name`, `type`, create_time
</otherwise>
</choose>
from ai_assistant
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ai_assistant
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, avatar, `name`, `type`, create_time
</otherwise>
</choose>
from ai_assistant
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from ai_assistant
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.AiAssistantExample">
delete from ai_assistant
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.AiAssistant">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ai_assistant (avatar, `name`, `type`,
create_time)
values (#{avatar,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.AiAssistant">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ai_assistant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="avatar != null">
avatar,
</if>
<if test="name != null">
`name`,
</if>
<if test="type != null">
`type`,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="avatar != null">
#{avatar,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.AiAssistantExample" resultType="java.lang.Long">
select count(*) from ai_assistant
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ai_assistant
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.avatar != null">
avatar = #{record.avatar,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ai_assistant
set id = #{record.id,jdbcType=INTEGER},
avatar = #{record.avatar,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.AiAssistant">
update ai_assistant
<set>
<if test="avatar != null">
avatar = #{avatar,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.AiAssistant">
update ai_assistant
set avatar = #{avatar,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.AiAssistantExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<include refid="Base_Column_List" />
from ai_assistant
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, avatar, `name`, `type`, create_time
</otherwise>
</choose>
from ai_assistant
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wwdz.ch.db.mapper.AiDefaultQuestionMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.AiDefaultQuestion">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="question" jdbcType="VARCHAR" property="question" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, question, `type`, create_time
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from ai_default_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, question, `type`, create_time
</otherwise>
</choose>
from ai_default_question
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ai_default_question
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, question, `type`, create_time
</otherwise>
</choose>
from ai_default_question
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from ai_default_question
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestionExample">
delete from ai_default_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestion">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ai_default_question (question, `type`, create_time
)
values (#{question,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestion">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ai_default_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="question != null">
question,
</if>
<if test="type != null">
`type`,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="question != null">
#{question,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestionExample" resultType="java.lang.Long">
select count(*) from ai_default_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ai_default_question
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.question != null">
question = #{record.question,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ai_default_question
set id = #{record.id,jdbcType=INTEGER},
question = #{record.question,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestion">
update ai_default_question
<set>
<if test="question != null">
question = #{question,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestion">
update ai_default_question
set question = #{question,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.AiDefaultQuestionExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<include refid="Base_Column_List" />
from ai_default_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, question, `type`, create_time
</otherwise>
</choose>
from ai_default_question
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
<select id="selectRandom" parameterType="com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto" resultType="com.wwdz.ch.db.domain.AiDefaultQuestion">
select * from ai_default_question where `type` = #{dto.type} LIMIT #{dto.limit} order by rand()
</select>
</mapper>
\ No newline at end of file
...@@ -38,7 +38,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer { ...@@ -38,7 +38,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
.addPathPatterns("/**") .addPathPatterns("/**")
// 放行路径 // 放行路径
.excludePathPatterns("/*.html", "/**/*.html", "/**/*.css", "/**/*.js" .excludePathPatterns("/*.html", "/**/*.html", "/**/*.css", "/**/*.js"
, "/wx/user/loginByWx", "/wx/user/loginByMobile", "/wx/user/loginRegCaptcha", "/wx/user/updateRegCaptcha", "/wx/user/login", "/wx/user/fillCode" , "/wx/user/loginByWx", "/wx/user/loginByMobile", "/wx/user/loginRegCaptcha", "/wx/user/updateRegCaptcha", "/wx/user/login", "/wx/user/fillCode",
"/wx/item/**"
); );
} }
} }
...@@ -27,6 +27,13 @@ public class CacheCodeConstants { ...@@ -27,6 +27,13 @@ public class CacheCodeConstants {
*/ */
public static final String USER_INFO_KEY = "cjxc:wx:user:info:{0}"; public static final String USER_INFO_KEY = "cjxc:wx:user:info:{0}";
/**
* 缓存关注者新发布藏品记录
* <p>{0}被关注者id:粉丝id</p>
*/
public static final String UNREAD_ITEM_OF_FOLLOWER_KEY = "cjxc:unread:{0}";
/** /**
* 短信验证码类型枚举 * 短信验证码类型枚举
*/ */
......
package com.wwdz.ch.wx.impl;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.AiAssistantDao;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.wx.service.AiAssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AiAssistantServiceImpl implements AiAssistantService {
@Autowired
AiAssistantDao aiAssistantDao;
@Override
public Result findList(AiAssistantRequestDto dto) {
return null;
}
}
package com.wwdz.ch.wx.impl;
import com.wwdz.ch.db.dao.AiDefaultQuestionDao;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import com.wwdz.ch.wx.service.AiDefaultQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AiDefaultQuestionServiceImpl implements AiDefaultQuestionService {
@Autowired
AiDefaultQuestionDao aiDefaultQuestionDao;
@Override
public List<AiDefaultQuestion> findList(AiDefaultQuestionRequestDto dto) {
List<AiDefaultQuestion> aiDefaultQuestionList = aiDefaultQuestionDao.findList(dto);
return null;
}
}
...@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo; ...@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
import com.qiniu.storage.model.FileInfo; import com.qiniu.storage.model.FileInfo;
import com.wwdz.ch.core.consts.*; import com.wwdz.ch.core.consts.*;
import com.wwdz.ch.core.storage.QiniuStorage; import com.wwdz.ch.core.storage.QiniuStorage;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil; import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.db.bean.EsPageInfo; import com.wwdz.ch.db.bean.EsPageInfo;
...@@ -15,6 +16,7 @@ import com.wwdz.ch.db.dto.request.CoinRequestDto; ...@@ -15,6 +16,7 @@ import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.dto.request.EsSearchRequestDto; import com.wwdz.ch.db.dto.request.EsSearchRequestDto;
import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto; import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto;
import com.wwdz.ch.db.es.ItemEsDao; import com.wwdz.ch.db.es.ItemEsDao;
import com.wwdz.ch.wx.constant.CacheCodeConstants;
import com.wwdz.ch.wx.constant.LoginTypeEnum; import com.wwdz.ch.wx.constant.LoginTypeEnum;
import com.wwdz.ch.wx.entity.MessageContentText; import com.wwdz.ch.wx.entity.MessageContentText;
import com.wwdz.ch.wx.entity.request.ItemRequestDto; import com.wwdz.ch.wx.entity.request.ItemRequestDto;
...@@ -33,10 +35,13 @@ import com.wwdz.ch.wx.util.RedisUtil; ...@@ -33,10 +35,13 @@ import com.wwdz.ch.wx.util.RedisUtil;
import com.wwdz.ch.wx.util.StringUtil; import com.wwdz.ch.wx.util.StringUtil;
import com.xxdxxs.utils.CommonUtils; import com.xxdxxs.utils.CommonUtils;
import com.xxdxxs.utils.DateUtils; import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.MapUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -51,6 +56,7 @@ import java.io.ByteArrayOutputStream; ...@@ -51,6 +56,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.text.MessageFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -61,47 +67,67 @@ import java.util.stream.Collectors; ...@@ -61,47 +67,67 @@ import java.util.stream.Collectors;
@Service @Service
public class ItemServiceImpl implements ItemService { public class ItemServiceImpl implements ItemService {
private static final Logger logger = LoggerFactory.getLogger(ItemServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(ItemServiceImpl.class);
@Autowired @Autowired
private ItemDao itemDao; private ItemDao itemDao;
@Autowired @Autowired
private UserItemsRelationDao userItemsRelationDao; private UserItemsRelationDao userItemsRelationDao;
@Autowired @Autowired
private FavoritesItemsRelationDao favoritesItemsRelationDao; private FavoritesItemsRelationDao favoritesItemsRelationDao;
@Autowired @Autowired
private CategoryDao categoryDao; private CategoryDao categoryDao;
@Autowired @Autowired
private FootPrintDao footPrintDao; private FootPrintDao footPrintDao;
@Autowired @Autowired
private FavoritesDao favoritesDao; private FavoritesDao favoritesDao;
@Autowired @Autowired
private UserDao userDao; private UserDao userDao;
@Autowired @Autowired
private ItemsOfficialUsersRelationDao itemsOfficialUsersRelationDao; private ItemsOfficialUsersRelationDao itemsOfficialUsersRelationDao;
@Autowired @Autowired
private UserCollectBrowseNumDao userCollectBrowseNumDao; private UserCollectBrowseNumDao userCollectBrowseNumDao;
@Autowired @Autowired
private ItemEsDao itemEsDao; private ItemEsDao itemEsDao;
@Autowired @Autowired
private WxLoginManager wxLoginManager; private WxLoginManager wxLoginManager;
@Autowired @Autowired
private AlipayLoginManager alipayLoginManager; private AlipayLoginManager alipayLoginManager;
@Autowired @Autowired
private TikTokLoginManager tikTokLoginManager; private TikTokLoginManager tikTokLoginManager;
@Autowired @Autowired
private UserTokenManager userTokenManager; private UserTokenManager userTokenManager;
@Autowired @Autowired
private QiniuStorage qiniuStorage; private QiniuStorage qiniuStorage;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired @Autowired
private ItemCommonService itemCommonService; private ItemCommonService itemCommonService;
@Autowired @Autowired
private MessageService messageService; private MessageService messageService;
@Autowired @Autowired
private FollowFansRecordService followFansRecordService; private FollowFansRecordService followFansRecordService;
@Autowired
FollowFansRecordDao followFansRecordDao;
@Override @Override
public Result nameList(ItemRequestDto dto) { public Result nameList(ItemRequestDto dto) {
try { try {
...@@ -204,7 +230,70 @@ public class ItemServiceImpl implements ItemService { ...@@ -204,7 +230,70 @@ public class ItemServiceImpl implements ItemService {
@Override @Override
public Result itemsOfFollower(ItemRequestDto dto) { public Result itemsOfFollower(ItemRequestDto dto) {
return null; try {
PageInfo<AgentTranceResponseVo> agentTranceResponseVoPageInfo = new PageInfo<>();
List<AgentTranceResponseVo> resultList = new ArrayList<>();
//查询关注列表
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFansId(dto.getUserId());
followFansRecordRequestDto.setLimit(100000);
List<FollowFansRecord> followFansRecordList = followFansRecordDao.findList(followFansRecordRequestDto);
List<Long> followerIds = followFansRecordList.stream().map(FollowFansRecord::getFollowerId).collect(Collectors.toList());
// 获取官方用户id
List<ItemsOfficialUsersRelation> itemsOfficialUsersRelations = itemsOfficialUsersRelationDao.list();
List<Long> officialUserIdList = itemsOfficialUsersRelations.stream().map(ItemsOfficialUsersRelation::getUserId).collect(Collectors.toList());
List<Long> filterFollowerIds = followerIds.stream().filter(i -> !officialUserIdList.contains(i)).collect(Collectors.toList());
//查询关注者发布的商品id,排除官方的账号
List<UserItemsRelation> userItemsRelations = userItemsRelationDao.listByUserIds(null, filterFollowerIds);
List<Long> itemIdList = userItemsRelations.stream().map(UserItemsRelation::getItemId).collect(Collectors.toList());
CoinRequestDto coinRequestDto = new CoinRequestDto();
coinRequestDto.setPage(dto.getPage());
coinRequestDto.setLimit(dto.getSize());
coinRequestDto.setIds(itemIdList);
PageInfo<Item> pageInfo = itemDao.findPageNotDeleted(coinRequestDto);
BeanUtils.copyProperties(pageInfo, agentTranceResponseVoPageInfo);
List<Item> itemList = pageInfo.getList();
for (Item item : itemList) {
ItemResponseVo itemResponseVo = new ItemResponseVo();
itemResponseVo.setItemId(item.getId());
// 查询商品被收藏的次数
long collectCount = favoritesItemsRelationDao.countByItemId(item.getId());
itemResponseVo.setCollectCount(StringUtil.formatCount(collectCount));
itemResponseVo.setHomePageImage(MediaUtil.getHomePageImage(item.getImages(), item.getVideos()));
itemResponseVo.setName(item.getName());
itemResponseVo.setPrice(getPrice(item.getPrice()));
itemResponseVo.setIsCollected(favoritesItemsRelationDao.isCollected(dto.getUserId(), item.getId(), null) ? 1 : 0);
itemResponseVo.setDetail(item.getDetail());
itemResponseVo.setSourceType(item.getSourceType());
itemResponseVo.setViewPermission(0);
// 设置藏品发布用户的昵称和头像
itemCommonService.getNicknameAvatar(item.getId(), itemResponseVo);
AgentTranceResponseVo agentTranceResponseVo = new AgentTranceResponseVo();
agentTranceResponseVo.setAgentTraceInfo_("");
agentTranceResponseVo.setViewType(1);
agentTranceResponseVo.setDetail(itemResponseVo);
resultList.add(agentTranceResponseVo);
}
agentTranceResponseVoPageInfo.setList(resultList);
//删除redis中未读关注者新增藏品的记录
for (Long follower : followerIds) {
String key = MessageFormat.format(CacheCodeConstants.UNREAD_ITEM_OF_FOLLOWER_KEY, follower + ":" + dto.getUserId());
if (redisUtil.hasKey(key)) {
redisUtil.del(key);
}
}
return Result.success(agentTranceResponseVoPageInfo);
} catch (Exception e) {
logger.error("获取关注用户发布的藏品失败:{}", e);
}
return Result.failed();
} }
@Override @Override
...@@ -486,6 +575,9 @@ public class ItemServiceImpl implements ItemService { ...@@ -486,6 +575,9 @@ public class ItemServiceImpl implements ItemService {
favoritesDao.updateTime(dto.getFavoritesId(), null); favoritesDao.updateTime(dto.getFavoritesId(), null);
} }
//将用户更新藏品的通知放入redis中
updateItemForFansByRedis(dto.getUserId());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", item.getId()); map.put("id", item.getId());
return Result.success(map); return Result.success(map);
...@@ -1125,4 +1217,51 @@ public class ItemServiceImpl implements ItemService { ...@@ -1125,4 +1217,51 @@ public class ItemServiceImpl implements ItemService {
} }
} }
} }
/**
* 用户上传新的藏品,更新redis中的记录
* 让该用户的粉丝在进入主页时能够知道关注者新增了藏品
* redis key为 被关注者id:粉丝id, value为上传新藏品的时间
* 当粉丝查看过关注者新发的藏品则删除该缓存
* @param userId
*/
private void updateItemForFansByRedis(long userId) {
//查询该用户的所有粉丝
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(userId);
followFansRecordRequestDto.setPage(1);
followFansRecordRequestDto.setLimit(100000);
List<FollowFansRecord> followFansRecordList = followFansRecordDao.findList(followFansRecordRequestDto);
List<Long> fansIdList = followFansRecordList.stream().map(FollowFansRecord::getFansId).collect(Collectors.toList());
Date now = new Date();
fansIdList.forEach(fansId -> {
String key = MessageFormat.format(CacheCodeConstants.UNREAD_ITEM_OF_FOLLOWER_KEY, userId + ":" + fansId);
redisUtil.set(key, now);
});
}
@Override
public Result checkUnreadItemOfFollower(ItemRequestDto dto) {
try {
//查询关注列表
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFansId(dto.getUserId());
followFansRecordRequestDto.setLimit(100000);
List<FollowFansRecord> followFansRecordList = followFansRecordDao.findList(followFansRecordRequestDto);
List<Long> followerIds = followFansRecordList.stream().map(FollowFansRecord::getFollowerId).collect(Collectors.toList());
Map<String, Boolean> map = new HashMap<>();
map.put("hasUnread", false);
for (Long follower : followerIds) {
String key = MessageFormat.format(CacheCodeConstants.UNREAD_ITEM_OF_FOLLOWER_KEY, follower + ":" + dto.getUserId());
if (redisUtil.hasKey(key)) {
map.put("hasUnread", true);
break;
}
}
return Result.success(map);
} catch (Exception e) {
logger.error("检查是否有关注者的新藏品未查看 error : {}", e);
}
return Result.failed();
}
} }
...@@ -461,7 +461,7 @@ public class UserServiceImpl implements UserService { ...@@ -461,7 +461,7 @@ public class UserServiceImpl implements UserService {
user.setUsername(UUID.randomUUID().toString().replace("-", "")); user.setUsername(UUID.randomUUID().toString().replace("-", ""));
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
user.setPassword(bCryptPasswordEncoder.encode("Aa123456")); user.setPassword(bCryptPasswordEncoder.encode("Aa123456"));
user.setWeixinOpenid(""); user.setWeixinOpenid(dto.getWxOpenId());
user.setProfile(""); user.setProfile("");
user.setBackground(""); user.setBackground("");
user.setWechatId(""); user.setWechatId("");
...@@ -488,10 +488,10 @@ public class UserServiceImpl implements UserService { ...@@ -488,10 +488,10 @@ public class UserServiceImpl implements UserService {
userDao.insert(user); userDao.insert(user);
} else { } else {
// 注册过的用户修改最后登录的时间以及绑定微信openid和支付宝user_id // 注册过的用户修改最后登录的时间以及绑定微信openid和支付宝user_id
if (StringUtils.isNotBlank(dto.getWxOpenId())) { if (org.springframework.util.StringUtils.hasLength(dto.getWxOpenId())) {
user.setWeixinOpenid(dto.getWxOpenId()); user.setWeixinOpenid(dto.getWxOpenId());
} }
if (StringUtils.isNotBlank(dto.getAlipayUserId())) { if (org.springframework.util.StringUtils.hasLength(dto.getAlipayUserId())) {
user.setAlipayUserId(dto.getAlipayUserId()); user.setAlipayUserId(dto.getAlipayUserId());
} }
user.setLastLoginTime(new Date()); user.setLastLoginTime(new Date());
......
...@@ -54,7 +54,7 @@ public class WxLoginManager { ...@@ -54,7 +54,7 @@ public class WxLoginManager {
try { try {
WxMaJscode2SessionResult result = this.wxMaService.getUserService().getSessionInfo(loginCode); WxMaJscode2SessionResult result = this.wxMaService.getUserService().getSessionInfo(loginCode);
openId = result.getOpenid(); openId = result.getOpenid();
logger.info("获取openId成功"); logger.info("获取openId成功 openId :{}", openId);
} catch (Exception e) { } catch (Exception e) {
logger.error("获取微信登录用户的openId失败", e); logger.error("获取微信登录用户的openId失败", e);
} }
......
package com.wwdz.ch.wx.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
public interface AiAssistantService {
/**
* 查询ai助手列表
* @param dto
* @return
*/
Result findList(AiAssistantRequestDto dto);
}
package com.wwdz.ch.wx.service;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import java.util.List;
public interface AiDefaultQuestionService {
/**
* 查询默认问题列表
* @param dto
* @return
*/
List<AiDefaultQuestion> findList (AiDefaultQuestionRequestDto dto);
}
...@@ -143,4 +143,13 @@ public interface ItemService { ...@@ -143,4 +143,13 @@ public interface ItemService {
* @return * @return
*/ */
Result shareSendMessage(ItemRequestDto dto, HttpServletRequest request); Result shareSendMessage(ItemRequestDto dto, HttpServletRequest request);
/**
* 检查是否有关注者的新藏品未查看
*
* @param dto
* @return
*/
Result checkUnreadItemOfFollower(ItemRequestDto 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.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.wx.service.AiAssistantService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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/aiAssistant")
public class AiAssistantController {
private static final Logger logger = LoggerFactory.getLogger(AiAssistantController.class);
@Autowired
AiAssistantService aiAssistantService;
@Autowired
AiDef
@ApiOperation(value = "查询ai助手列表")
@PostMapping("/findList")
public Result findList(@RequestBody AiAssistantRequestDto dto) {
logger.info("【请求开始】查询ai助手列表,请求参数:{}", JSON.toJSONString(dto));
if (dto.getType() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return aiAssistantService.findList(dto);
}
@ApiOperation(value = "查询ai默认问题")
@PostMapping("/findDefaultQuestions")
public Result findDefaultQuestions(@RequestBody AiAssistantRequestDto dto) {
logger.info("【请求开始】查询ai助手列表,请求参数:{}", JSON.toJSONString(dto));
if (dto.getType() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return aiAssistantService.findList(dto);
}
}
...@@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -56,6 +57,15 @@ public class WxItemController { ...@@ -56,6 +57,15 @@ public class WxItemController {
@PostMapping("/itemsOfFollower") @PostMapping("/itemsOfFollower")
public Result itemsOfFollower(@RequestBody ItemRequestDto dto) { public Result itemsOfFollower(@RequestBody ItemRequestDto dto) {
logger.info("【请求开始】关注人发布的商品列表,请求参数:{}", JSON.toJSONString(dto)); logger.info("【请求开始】关注人发布的商品列表,请求参数:{}", JSON.toJSONString(dto));
if (Objects.isNull(dto.getUserId())) {
return Result.failed("用户id不能为空");
}
if (Objects.isNull(dto.getPage())) {
return Result.failed("当前页不能为空");
}
if (Objects.isNull(dto.getSize())) {
return Result.failed("页面大小不能为空");
}
return itemService.itemsOfFollower(dto); return itemService.itemsOfFollower(dto);
} }
...@@ -135,7 +145,7 @@ public class WxItemController { ...@@ -135,7 +145,7 @@ public class WxItemController {
return itemService.update(dto); return itemService.update(dto);
} }
@ApiOperation(value = "详情") @ApiOperation(value = "藏品详情")
@PostMapping("/info") @PostMapping("/info")
public Result info(@RequestBody ItemRequestDto dto) { public Result info(@RequestBody ItemRequestDto dto) {
logger.info("【请求开始】藏品详情查询,请求参数:{}", JSON.toJSONString(dto)); logger.info("【请求开始】藏品详情查询,请求参数:{}", JSON.toJSONString(dto));
...@@ -240,4 +250,15 @@ public class WxItemController { ...@@ -240,4 +250,15 @@ public class WxItemController {
} }
return itemService.uploadVideo(file); return itemService.uploadVideo(file);
} }
@ApiOperation(value = "检查是否有关注者的新藏品未查看")
@PostMapping("/checkUnreadItemOfFollower")
public Result checkUnreadItemOfFollower(@RequestBody ItemRequestDto dto) {
logger.info("【请求开始】检查是否有关注者的新藏品未查看,请求参数:{}", JSON.toJSONString(dto));
if (ObjectUtils.isEmpty(dto.getUserId())) {
return Result.failed("用户id不能为空");
}
return itemService.checkUnreadItemOfFollower(dto);
}
} }
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