Commit ff26d761 authored by muhong's avatar muhong

修改 收藏浏览量

parent 1d77f013
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.UserCollectBrowseNum;
public interface UserCollectBrowseNumDao {
UserCollectBrowseNum findByUserId(Long userId);
int insert(UserCollectBrowseNum record);
int update(UserCollectBrowseNum record);
}
package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import lombok.Data;
/**
* @author shiyu
* @date 2023/09/22
*/
@Data
public class UserCollectBrowseNum implements Serializable {
private Integer id;
/**
* 用户id
*/
private Long userId;
/**
* 被收藏数
*/
private Integer collectNum;
/**
* 被浏览量
*/
private Integer browseNum;
/**
* 创建时间
*/
private Date addTime;
/**
* 更新时间
*/
private Date updateTime;
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(", userId=").append(userId);
sb.append(", collectNum=").append(collectNum);
sb.append(", browseNum=").append(browseNum);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
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;
}
UserCollectBrowseNum other = (UserCollectBrowseNum) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getCollectNum() == null ? other.getCollectNum() == null : this.getCollectNum().equals(other.getCollectNum()))
&& (this.getBrowseNum() == null ? other.getBrowseNum() == null : this.getBrowseNum().equals(other.getBrowseNum()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getCollectNum() == null) ? 0 : getCollectNum().hashCode());
result = prime * result + ((getBrowseNum() == null) ? 0 : getBrowseNum().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
userId("user_id", "userId", "BIGINT", false),
collectNum("collect_num", "collectNum", "INTEGER", false),
browseNum("browse_num", "browseNum", "INTEGER", false),
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 UserCollectBrowseNumExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserCollectBrowseNumExample() {
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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public UserCollectBrowseNumExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public UserCollectBrowseNumExample 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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
UserCollectBrowseNumExample example = new UserCollectBrowseNumExample();
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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(UserCollectBrowseNum.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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(UserCollectBrowseNum.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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(UserCollectBrowseNum.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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(UserCollectBrowseNum.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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(UserCollectBrowseNum.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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(UserCollectBrowseNum.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 andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("user_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdNotEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("user_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdGreaterThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("user_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdGreaterThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("user_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdLessThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("user_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdLessThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("user_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andCollectNumIsNull() {
addCriterion("collect_num is null");
return (Criteria) this;
}
public Criteria andCollectNumIsNotNull() {
addCriterion("collect_num is not null");
return (Criteria) this;
}
public Criteria andCollectNumEqualTo(Integer value) {
addCriterion("collect_num =", value, "collectNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCollectNumEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("collect_num = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCollectNumNotEqualTo(Integer value) {
addCriterion("collect_num <>", value, "collectNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCollectNumNotEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("collect_num <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCollectNumGreaterThan(Integer value) {
addCriterion("collect_num >", value, "collectNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCollectNumGreaterThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("collect_num > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCollectNumGreaterThanOrEqualTo(Integer value) {
addCriterion("collect_num >=", value, "collectNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCollectNumGreaterThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("collect_num >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCollectNumLessThan(Integer value) {
addCriterion("collect_num <", value, "collectNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCollectNumLessThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("collect_num < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCollectNumLessThanOrEqualTo(Integer value) {
addCriterion("collect_num <=", value, "collectNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCollectNumLessThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("collect_num <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCollectNumIn(List<Integer> values) {
addCriterion("collect_num in", values, "collectNum");
return (Criteria) this;
}
public Criteria andCollectNumNotIn(List<Integer> values) {
addCriterion("collect_num not in", values, "collectNum");
return (Criteria) this;
}
public Criteria andCollectNumBetween(Integer value1, Integer value2) {
addCriterion("collect_num between", value1, value2, "collectNum");
return (Criteria) this;
}
public Criteria andCollectNumNotBetween(Integer value1, Integer value2) {
addCriterion("collect_num not between", value1, value2, "collectNum");
return (Criteria) this;
}
public Criteria andBrowseNumIsNull() {
addCriterion("browse_num is null");
return (Criteria) this;
}
public Criteria andBrowseNumIsNotNull() {
addCriterion("browse_num is not null");
return (Criteria) this;
}
public Criteria andBrowseNumEqualTo(Integer value) {
addCriterion("browse_num =", value, "browseNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBrowseNumEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("browse_num = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBrowseNumNotEqualTo(Integer value) {
addCriterion("browse_num <>", value, "browseNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBrowseNumNotEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("browse_num <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBrowseNumGreaterThan(Integer value) {
addCriterion("browse_num >", value, "browseNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBrowseNumGreaterThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("browse_num > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBrowseNumGreaterThanOrEqualTo(Integer value) {
addCriterion("browse_num >=", value, "browseNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBrowseNumGreaterThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("browse_num >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBrowseNumLessThan(Integer value) {
addCriterion("browse_num <", value, "browseNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBrowseNumLessThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("browse_num < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBrowseNumLessThanOrEqualTo(Integer value) {
addCriterion("browse_num <=", value, "browseNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBrowseNumLessThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("browse_num <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBrowseNumIn(List<Integer> values) {
addCriterion("browse_num in", values, "browseNum");
return (Criteria) this;
}
public Criteria andBrowseNumNotIn(List<Integer> values) {
addCriterion("browse_num not in", values, "browseNum");
return (Criteria) this;
}
public Criteria andBrowseNumBetween(Integer value1, Integer value2) {
addCriterion("browse_num between", value1, value2, "browseNum");
return (Criteria) this;
}
public Criteria andBrowseNumNotBetween(Integer value1, Integer value2) {
addCriterion("browse_num not between", value1, value2, "browseNum");
return (Criteria) this;
}
public Criteria andAddTimeIsNull() {
addCriterion("add_time is null");
return (Criteria) this;
}
public Criteria andAddTimeIsNotNull() {
addCriterion("add_time is not null");
return (Criteria) this;
}
public Criteria andAddTimeEqualTo(Date value) {
addCriterion("add_time =", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("add_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeNotEqualTo(Date value) {
addCriterion("add_time <>", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeNotEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("add_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeGreaterThan(Date value) {
addCriterion("add_time >", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeGreaterThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("add_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeGreaterThanOrEqualTo(Date value) {
addCriterion("add_time >=", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeGreaterThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("add_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeLessThan(Date value) {
addCriterion("add_time <", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeLessThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("add_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeLessThanOrEqualTo(Date value) {
addCriterion("add_time <=", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeLessThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("add_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeIn(List<Date> values) {
addCriterion("add_time in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotIn(List<Date> values) {
addCriterion("add_time not in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeBetween(Date value1, Date value2) {
addCriterion("add_time between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotBetween(Date value1, Date value2) {
addCriterion("add_time not between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("update_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeNotEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("update_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("update_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("update_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("update_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanOrEqualToColumn(UserCollectBrowseNum.Column column) {
addCriterion(new StringBuilder("update_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private UserCollectBrowseNumExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(UserCollectBrowseNumExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public UserCollectBrowseNumExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @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 user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.impl;
import com.wwdz.ch.db.dao.UserCollectBrowseNumDao;
import com.wwdz.ch.db.domain.UserCollectBrowseNum;
import com.wwdz.ch.db.domain.UserCollectBrowseNumExample;
import com.wwdz.ch.db.mapper.UserCollectBrowseNumMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class UserCollectBrowseNumDaoImpl implements UserCollectBrowseNumDao {
@Autowired
private UserCollectBrowseNumMapper userCollectBrowseNumMapper;
@Override
public UserCollectBrowseNum findByUserId(Long userId) {
UserCollectBrowseNumExample example = new UserCollectBrowseNumExample();
UserCollectBrowseNumExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
return userCollectBrowseNumMapper.selectOneByExample(example);
}
@Override
public int insert(UserCollectBrowseNum record) {
return userCollectBrowseNumMapper.insert(record);
}
@Override
public int update(UserCollectBrowseNum record) {
return userCollectBrowseNumMapper.updateByPrimaryKey(record);
}
}
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.UserCollectBrowseNum;
import com.wwdz.ch.db.domain.UserCollectBrowseNumExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserCollectBrowseNumMapper {
long countByExample(UserCollectBrowseNumExample example);
int deleteByExample(UserCollectBrowseNumExample example);
int deleteByPrimaryKey(Integer id);
int insert(UserCollectBrowseNum record);
int insertSelective(UserCollectBrowseNum record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserCollectBrowseNum selectOneByExample(UserCollectBrowseNumExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserCollectBrowseNum selectOneByExampleSelective(@Param("example") UserCollectBrowseNumExample example, @Param("selective") UserCollectBrowseNum.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<UserCollectBrowseNum> selectByExampleSelective(@Param("example") UserCollectBrowseNumExample example, @Param("selective") UserCollectBrowseNum.Column ... selective);
List<UserCollectBrowseNum> selectByExample(UserCollectBrowseNumExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserCollectBrowseNum selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") UserCollectBrowseNum.Column ... selective);
UserCollectBrowseNum selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") UserCollectBrowseNum record, @Param("example") UserCollectBrowseNumExample example);
int updateByExample(@Param("record") UserCollectBrowseNum record, @Param("example") UserCollectBrowseNumExample example);
int updateByPrimaryKeySelective(UserCollectBrowseNum record);
int updateByPrimaryKey(UserCollectBrowseNum record);
}
\ 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.UserCollectBrowseNumMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.UserCollectBrowseNum">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="collect_num" jdbcType="INTEGER" property="collectNum" />
<result column="browse_num" jdbcType="INTEGER" property="browseNum" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</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, user_id, collect_num, browse_num, add_time, update_time
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNumExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from user_collect_browse_num
<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, user_id, collect_num, browse_num, add_time, update_time
</otherwise>
</choose>
from user_collect_browse_num
<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 user_collect_browse_num
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, user_id, collect_num, browse_num, add_time, update_time
</otherwise>
</choose>
from user_collect_browse_num
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from user_collect_browse_num
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNumExample">
delete from user_collect_browse_num
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNum">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_collect_browse_num (user_id, collect_num, browse_num,
add_time, update_time)
values (#{userId,jdbcType=BIGINT}, #{collectNum,jdbcType=INTEGER}, #{browseNum,jdbcType=INTEGER},
#{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNum">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_collect_browse_num
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="collectNum != null">
collect_num,
</if>
<if test="browseNum != null">
browse_num,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="collectNum != null">
#{collectNum,jdbcType=INTEGER},
</if>
<if test="browseNum != null">
#{browseNum,jdbcType=INTEGER},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNumExample" resultType="java.lang.Long">
select count(*) from user_collect_browse_num
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_collect_browse_num
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.collectNum != null">
collect_num = #{record.collectNum,jdbcType=INTEGER},
</if>
<if test="record.browseNum != null">
browse_num = #{record.browseNum,jdbcType=INTEGER},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user_collect_browse_num
set id = #{record.id,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=BIGINT},
collect_num = #{record.collectNum,jdbcType=INTEGER},
browse_num = #{record.browseNum,jdbcType=INTEGER},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNum">
update user_collect_browse_num
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="collectNum != null">
collect_num = #{collectNum,jdbcType=INTEGER},
</if>
<if test="browseNum != null">
browse_num = #{browseNum,jdbcType=INTEGER},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNum">
update user_collect_browse_num
set user_id = #{userId,jdbcType=BIGINT},
collect_num = #{collectNum,jdbcType=INTEGER},
browse_num = #{browseNum,jdbcType=INTEGER},
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.UserCollectBrowseNumExample" 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 user_collect_browse_num
<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, user_id, collect_num, browse_num, add_time, update_time
</otherwise>
</choose>
from user_collect_browse_num
<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
......@@ -44,6 +44,8 @@ public class FavoritesServiceImpl implements FavoritesService {
@Autowired
private FootPrintDao footPrintDao;
@Autowired
private UserCollectBrowseNumDao userCollectBrowseNumDao;
@Autowired
private ItemCommonService itemCommonService;
@Autowired
private UserTokenManager userTokenManager;
......@@ -364,6 +366,18 @@ public class FavoritesServiceImpl implements FavoritesService {
// 更新收藏册id
favoritesItemsRelationDao.updateFavoritesId(favorites.getUserId(), dto.getFavoritesId(), dto.getItemIds());
// 更新藏品发布者的收藏数
for (Long itemId : dto.getItemIds()) {
UserItemsRelation userItemsRelation = userItemsRelationDao.find(itemId);
if (Objects.nonNull(userItemsRelation)) {
UserCollectBrowseNum userCollectBrowseNum = userCollectBrowseNumDao.findByUserId(userItemsRelation.getUserId());
if (Objects.nonNull(userCollectBrowseNum)) {
userCollectBrowseNum.setCollectNum(userCollectBrowseNum.getCollectNum() + 1);
userCollectBrowseNumDao.update(userCollectBrowseNum);
}
}
}
// 更新收藏册操作时间
favoritesDao.updateTime(dto.getFavoritesId(), null);
logger.info("【请求结束】收藏藏品成功");
......
......@@ -3,10 +3,7 @@ package com.wwdz.ch.wx.impl;
import com.wwdz.ch.core.consts.ViewPermissionEnum;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.*;
import com.wwdz.ch.db.domain.Item;
import com.wwdz.ch.db.domain.ItemsOfficialUsersRelation;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.UserItemsRelation;
import com.wwdz.ch.db.domain.*;
import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto;
import com.wwdz.ch.wx.dao.UserInfo;
......@@ -19,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -38,6 +36,8 @@ public class ItemCommonServiceImpl implements ItemCommonService {
private UserDao userDao;
@Autowired
private ItemDao itemDao;
@Autowired
private UserCollectBrowseNumDao userCollectBrowseNumDao;
@Autowired
private UserTokenManager userTokenManager;
......@@ -85,21 +85,42 @@ public class ItemCommonServiceImpl implements ItemCommonService {
followersNumber = (long) map.get("followerNum");
fansNumber = (long) map.get("fansNum");
}
// 收藏和浏览量、所有人私密数量
UserCollectBrowseNum userCollectBrowseNum = userCollectBrowseNumDao.findByUserId(userInfo.getUserId());
// 所有人私密数量
List<UserItemsRelation> userItemsRelations = userItemsRelationDao.listByUserIds(userInfo.getUserId(), null);
if (CollectionUtils.isNotEmpty(userItemsRelations)) {
List<Long> itemIds = userItemsRelations.stream()
.map(UserItemsRelation::getItemId).collect(Collectors.toList());
collectionsNumber = favoritesItemsRelationDao.countByItemIds(itemIds);
CoinRequestDto coinRequestDto = new CoinRequestDto();
coinRequestDto.setIds(itemIds);
List<Item> itemList = itemDao.findListNotDeleted(coinRequestDto);
List<Item> allItemList = itemList.stream().filter(s -> s.getViewPermission().equals(ViewPermissionEnum.ALL.getCode())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(allItemList)) {
allNumber = allItemList.size();
// 初始浏览量
if (Objects.isNull(userCollectBrowseNum)) {
viewsNumber = footPrintDao.countByItemIds(userInfo.getUserId(), null, allItemList.stream().map(Item::getId).collect(Collectors.toList()));
}
}
privacyNumber = itemList.stream().filter(s -> s.getViewPermission().equals(ViewPermissionEnum.ONLY_ONESELF.getCode())).count();
// 初始收藏量
if (Objects.isNull(userCollectBrowseNum)) {
collectionsNumber = favoritesItemsRelationDao.countByItemIds(itemIds);
}
}
// 收藏和浏览量
if (Objects.isNull(userCollectBrowseNum)) {
UserCollectBrowseNum record = new UserCollectBrowseNum();
record.setUserId(userInfo.getUserId());
record.setCollectNum(Integer.parseInt(String.valueOf(collectionsNumber)));
record.setBrowseNum(Integer.parseInt(String.valueOf(viewsNumber)));
Date date = new Date();
record.setAddTime(date);
record.setUpdateTime(date);
userCollectBrowseNumDao.insert(record);
} else {
collectionsNumber= Long.parseLong(userCollectBrowseNum.getCollectNum().toString());
viewsNumber =Long.parseLong(userCollectBrowseNum.getBrowseNum().toString());
}
userInfo.setCollectionsNumber(collectionsNumber);
......
......@@ -75,6 +75,8 @@ public class ItemServiceImpl implements ItemService {
@Autowired
private ItemsOfficialUsersRelationDao itemsOfficialUsersRelationDao;
@Autowired
private UserCollectBrowseNumDao userCollectBrowseNumDao;
@Autowired
private ItemEsDao itemEsDao;
@Autowired
......@@ -343,6 +345,10 @@ public class ItemServiceImpl implements ItemService {
result.setList(new ArrayList<>());
result.setHasNextPage(false);
// 获取仅自己可见的藏品列表
Long userId = userTokenManager.getUserId(request.getHeader("Authorization"));
// 是否客态
boolean isGuest = !dto.getUserId().equals(userId);
// 获取仅自己可见的藏品列表
List<Long> onlyOneselfItemIds = itemCommonService.getOnlyOneselfItemIds(request.getHeader("Authorization"));
// 分页查询
......@@ -376,7 +382,10 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo.setPrice(getPrice(item.getPrice()));
// 设置是否收藏或是否是自己发布的
itemResponseVo.setIsCollected(1);
itemResponseVo.setIsMine(0);
if (!isGuest) {
itemResponseVo.setIsMine(userItemsRelationDao.isExisted(dto.getUserId(), item.getId()) ? 1 : 0);
}
// 设置收藏数
long count = favoritesItemsRelationDao.countByItemId(item.getId());
itemResponseVo.setCollectCount(StringUtil.formatCount(count));
......@@ -574,6 +583,15 @@ public class ItemServiceImpl implements ItemService {
newVo.setAddTime(now);
newVo.setUpdateTime(now);
footPrintDao.insert(newVo);
// 更新藏品发布者的浏览量
if (Objects.nonNull(userItemsRelation)) {
UserCollectBrowseNum userCollectBrowseNum = userCollectBrowseNumDao.findByUserId(userItemsRelation.getUserId());
if (Objects.nonNull(userCollectBrowseNum)) {
userCollectBrowseNum.setBrowseNum(userCollectBrowseNum.getBrowseNum() + 1);
userCollectBrowseNumDao.update(userCollectBrowseNum);
}
}
} else {
footprint.setUpdateTime(now);
footPrintDao.upateTime(footprint);
......@@ -653,6 +671,15 @@ public class ItemServiceImpl implements ItemService {
long count = favoritesItemsRelationDao.countByItemId(item.getId());
String collectCount = StringUtil.formatCount(count);
// 更新藏品发布者的收藏数
if (Objects.nonNull(userItemsRelation)) {
UserCollectBrowseNum userCollectBrowseNum = userCollectBrowseNumDao.findByUserId(userItemsRelation.getUserId());
if (Objects.nonNull(userCollectBrowseNum)) {
userCollectBrowseNum.setCollectNum(userCollectBrowseNum.getCollectNum() + 1);
userCollectBrowseNumDao.update(userCollectBrowseNum);
}
}
// 发送收藏消息
sendMessage(item.getId(), dto.getUserId(), MessageEnum.TypeEnum.COLLECT.getCode(), MessageEnum.ContentIdTypeEnum.ITEM.getCode());
......
......@@ -410,7 +410,7 @@ public class UserServiceImpl implements UserService {
userInfo.setFollowedId((Integer) map.get("id"));
}
}
itemCommonService.getPageViews(userInfo);
logger.info("【请求结束】查询用户信息(客态)成功");
return Result.success(userInfo);
} catch (Exception e) {
......
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