Commit ce646292 authored by shiyu's avatar shiyu

标签制作

parent f18d238e
......@@ -16,6 +16,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
......@@ -154,6 +156,24 @@ public class QiniuStorage implements Storage {
}
public String storeItemQrcodeBase64Str(String baseStr, String keyName) throws Exception {
if (uploadManager == null) {
if (auth == null) {
auth = Auth.create(accessKey, secretKey);
}
uploadManager = new UploadManager(new Configuration());
}
BASE64Decoder base64Decoder = new BASE64Decoder();
byte[] imageByte = base64Decoder.decodeBuffer(baseStr);
InputStream inputStream = new ByteArrayInputStream(imageByte);
BufferedImage image = ImageIO.read(inputStream);
keyName = keyName + "_" + image.getWidth() + "x" + image.getHeight() + BASE64_IMG_SUFFIX;
store(imageByte, keyName);
String url =generateUrl(keyName);
return url;
}
@Override
public Stream<Path> loadAll() {
return null;
......
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.ItemTagQrCode;
public interface ItemTagQrCodeDao {
/**
* 插入商品标签二维码
* @param itemTagQrCode
* @return
*/
long insert(ItemTagQrCode itemTagQrCode);
boolean update(ItemTagQrCode itemTagQrCode);
ItemTagQrCode findByCode(String code);
}
package com.wwdz.ch.db.domain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2024/11/26
*/
@Data
public class ItemTagQrCode implements Entity {
private Long id;
/**
* 二维码编码
*/
private String code;
/**
* 二维码
*/
private String qrCode;
/**
* 类目id
*/
private Integer categoryId;
/**
* 类目名称
*/
private String categoryName;
/**
* 创建时间
*/
private Date createTime;
/**
* 绑定的商品id
*/
private Long itemId;
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(", code=").append(code);
sb.append(", qrCode=").append(qrCode);
sb.append(", categoryId=").append(categoryId);
sb.append(", categoryName=").append(categoryName);
sb.append(", createTime=").append(createTime);
sb.append(", itemId=").append(itemId);
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;
}
ItemTagQrCode other = (ItemTagQrCode) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode()))
&& (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
&& (this.getCategoryName() == null ? other.getCategoryName() == null : this.getCategoryName().equals(other.getCategoryName()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode());
result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
result = prime * result + ((getCategoryName() == null) ? 0 : getCategoryName().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "BIGINT", false),
code("code", "code", "VARCHAR", false),
qrCode("qr_code", "qrCode", "VARCHAR", false),
categoryId("category_id", "categoryId", "INTEGER", false),
categoryName("category_name", "categoryName", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
itemId("item_id", "itemId", "BIGINT", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 ItemTagQrCodeExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ItemTagQrCodeExample() {
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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public ItemTagQrCodeExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public ItemTagQrCodeExample 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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
ItemTagQrCodeExample example = new ItemTagQrCodeExample();
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(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCodeEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("code = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCodeNotEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("code <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCodeGreaterThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("code > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCodeGreaterThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("code >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCodeLessThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("code < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCodeLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("code <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andQrCodeIsNull() {
addCriterion("qr_code is null");
return (Criteria) this;
}
public Criteria andQrCodeIsNotNull() {
addCriterion("qr_code is not null");
return (Criteria) this;
}
public Criteria andQrCodeEqualTo(String value) {
addCriterion("qr_code =", value, "qrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQrCodeEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("qr_code = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQrCodeNotEqualTo(String value) {
addCriterion("qr_code <>", value, "qrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQrCodeNotEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("qr_code <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQrCodeGreaterThan(String value) {
addCriterion("qr_code >", value, "qrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQrCodeGreaterThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("qr_code > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQrCodeGreaterThanOrEqualTo(String value) {
addCriterion("qr_code >=", value, "qrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQrCodeGreaterThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("qr_code >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQrCodeLessThan(String value) {
addCriterion("qr_code <", value, "qrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQrCodeLessThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("qr_code < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQrCodeLessThanOrEqualTo(String value) {
addCriterion("qr_code <=", value, "qrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andQrCodeLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("qr_code <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andQrCodeLike(String value) {
addCriterion("qr_code like", value, "qrCode");
return (Criteria) this;
}
public Criteria andQrCodeNotLike(String value) {
addCriterion("qr_code not like", value, "qrCode");
return (Criteria) this;
}
public Criteria andQrCodeIn(List<String> values) {
addCriterion("qr_code in", values, "qrCode");
return (Criteria) this;
}
public Criteria andQrCodeNotIn(List<String> values) {
addCriterion("qr_code not in", values, "qrCode");
return (Criteria) this;
}
public Criteria andQrCodeBetween(String value1, String value2) {
addCriterion("qr_code between", value1, value2, "qrCode");
return (Criteria) this;
}
public Criteria andQrCodeNotBetween(String value1, String value2) {
addCriterion("qr_code not between", value1, value2, "qrCode");
return (Criteria) this;
}
public Criteria andCategoryIdIsNull() {
addCriterion("category_id is null");
return (Criteria) this;
}
public Criteria andCategoryIdIsNotNull() {
addCriterion("category_id is not null");
return (Criteria) this;
}
public Criteria andCategoryIdEqualTo(Integer value) {
addCriterion("category_id =", value, "categoryId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryIdEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryIdNotEqualTo(Integer value) {
addCriterion("category_id <>", value, "categoryId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryIdNotEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryIdGreaterThan(Integer value) {
addCriterion("category_id >", value, "categoryId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryIdGreaterThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryIdGreaterThanOrEqualTo(Integer value) {
addCriterion("category_id >=", value, "categoryId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryIdGreaterThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryIdLessThan(Integer value) {
addCriterion("category_id <", value, "categoryId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryIdLessThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryIdLessThanOrEqualTo(Integer value) {
addCriterion("category_id <=", value, "categoryId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryIdLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryIdIn(List<Integer> values) {
addCriterion("category_id in", values, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotIn(List<Integer> values) {
addCriterion("category_id not in", values, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdBetween(Integer value1, Integer value2) {
addCriterion("category_id between", value1, value2, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotBetween(Integer value1, Integer value2) {
addCriterion("category_id not between", value1, value2, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryNameIsNull() {
addCriterion("category_name is null");
return (Criteria) this;
}
public Criteria andCategoryNameIsNotNull() {
addCriterion("category_name is not null");
return (Criteria) this;
}
public Criteria andCategoryNameEqualTo(String value) {
addCriterion("category_name =", value, "categoryName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryNameEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_name = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryNameNotEqualTo(String value) {
addCriterion("category_name <>", value, "categoryName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryNameNotEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_name <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryNameGreaterThan(String value) {
addCriterion("category_name >", value, "categoryName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryNameGreaterThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_name > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryNameGreaterThanOrEqualTo(String value) {
addCriterion("category_name >=", value, "categoryName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryNameGreaterThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_name >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryNameLessThan(String value) {
addCriterion("category_name <", value, "categoryName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryNameLessThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_name < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryNameLessThanOrEqualTo(String value) {
addCriterion("category_name <=", value, "categoryName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCategoryNameLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("category_name <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCategoryNameLike(String value) {
addCriterion("category_name like", value, "categoryName");
return (Criteria) this;
}
public Criteria andCategoryNameNotLike(String value) {
addCriterion("category_name not like", value, "categoryName");
return (Criteria) this;
}
public Criteria andCategoryNameIn(List<String> values) {
addCriterion("category_name in", values, "categoryName");
return (Criteria) this;
}
public Criteria andCategoryNameNotIn(List<String> values) {
addCriterion("category_name not in", values, "categoryName");
return (Criteria) this;
}
public Criteria andCategoryNameBetween(String value1, String value2) {
addCriterion("category_name between", value1, value2, "categoryName");
return (Criteria) this;
}
public Criteria andCategoryNameNotBetween(String value1, String value2) {
addCriterion("category_name not between", value1, value2, "categoryName");
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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(ItemTagQrCode.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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(ItemTagQrCode.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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(ItemTagQrCode.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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(ItemTagQrCode.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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(ItemTagQrCode.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 item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("create_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andItemIdIsNull() {
addCriterion("item_id is null");
return (Criteria) this;
}
public Criteria andItemIdIsNotNull() {
addCriterion("item_id is not null");
return (Criteria) this;
}
public Criteria andItemIdEqualTo(Long value) {
addCriterion("item_id =", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("item_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdNotEqualTo(Long value) {
addCriterion("item_id <>", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdNotEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("item_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdGreaterThan(Long value) {
addCriterion("item_id >", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdGreaterThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("item_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdGreaterThanOrEqualTo(Long value) {
addCriterion("item_id >=", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdGreaterThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("item_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdLessThan(Long value) {
addCriterion("item_id <", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdLessThanColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("item_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdLessThanOrEqualTo(Long value) {
addCriterion("item_id <=", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdLessThanOrEqualToColumn(ItemTagQrCode.Column column) {
addCriterion(new StringBuilder("item_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdIn(List<Long> values) {
addCriterion("item_id in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotIn(List<Long> values) {
addCriterion("item_id not in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdBetween(Long value1, Long value2) {
addCriterion("item_id between", value1, value2, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotBetween(Long value1, Long value2) {
addCriterion("item_id not between", value1, value2, "itemId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private ItemTagQrCodeExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(ItemTagQrCodeExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public ItemTagQrCodeExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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 item_tag_qr_code
*
* @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;
import java.util.Date;
@Data
public class ItemTagQrCodeRequestDto implements Entity {
private Long id;
/**
* 二维码编码
*/
private String code;
/**
* 二维码
*/
private String qrCode;
/**
* 类目id
*/
private Integer categoryId;
/**
* 类目名称
*/
private String categoryName;
/**
* 创建时间
*/
private Date createTime;
/**
* 绑定的商品id
*/
private Long itemId;
}
package com.wwdz.ch.db.impl;
import com.wwdz.ch.db.dao.ItemTagQrCodeDao;
import com.wwdz.ch.db.domain.ItemTagQrCode;
import com.wwdz.ch.db.domain.ItemTagQrCodeExample;
import com.wwdz.ch.db.mapper.ItemTagQrCodeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class ItemTagQrCodeDaoImpl implements ItemTagQrCodeDao {
@Autowired
ItemTagQrCodeMapper itemTagQrCodeMapper;
@Override
public long insert(ItemTagQrCode itemTagQrCode) {
itemTagQrCodeMapper.insert(itemTagQrCode);
return itemTagQrCode.getId();
}
@Override
public boolean update(ItemTagQrCode itemTagQrCode) {
ItemTagQrCodeExample example = new ItemTagQrCodeExample();
ItemTagQrCodeExample.Criteria criteria = example.createCriteria();
criteria.andCodeEqualTo(itemTagQrCode.getCode());
return itemTagQrCodeMapper.updateByExampleSelective(itemTagQrCode, example) > 0;
}
@Override
public ItemTagQrCode findByCode(String code) {
ItemTagQrCodeExample example = new ItemTagQrCodeExample();
ItemTagQrCodeExample.Criteria criteria = example.createCriteria();
criteria.andCodeEqualTo(code);
return itemTagQrCodeMapper.selectOneByExample(example);
}
}
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.ItemTagQrCode;
import com.wwdz.ch.db.domain.ItemTagQrCodeExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ItemTagQrCodeMapper {
long countByExample(ItemTagQrCodeExample example);
int deleteByExample(ItemTagQrCodeExample example);
int deleteByPrimaryKey(Long id);
int insert(ItemTagQrCode record);
int insertSelective(ItemTagQrCode record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ItemTagQrCode selectOneByExample(ItemTagQrCodeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ItemTagQrCode selectOneByExampleSelective(@Param("example") ItemTagQrCodeExample example, @Param("selective") ItemTagQrCode.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<ItemTagQrCode> selectByExampleSelective(@Param("example") ItemTagQrCodeExample example, @Param("selective") ItemTagQrCode.Column ... selective);
List<ItemTagQrCode> selectByExample(ItemTagQrCodeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_tag_qr_code
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ItemTagQrCode selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") ItemTagQrCode.Column ... selective);
ItemTagQrCode selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") ItemTagQrCode record, @Param("example") ItemTagQrCodeExample example);
int updateByExample(@Param("record") ItemTagQrCode record, @Param("example") ItemTagQrCodeExample example);
int updateByPrimaryKeySelective(ItemTagQrCode record);
int updateByPrimaryKey(ItemTagQrCode 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.ItemTagQrCodeMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.ItemTagQrCode">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="qr_code" jdbcType="VARCHAR" property="qrCode" />
<result column="category_id" jdbcType="INTEGER" property="categoryId" />
<result column="category_name" jdbcType="VARCHAR" property="categoryName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="item_id" jdbcType="BIGINT" property="itemId" />
</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, code, qr_code, category_id, category_name, create_time, item_id
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.ItemTagQrCodeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from item_tag_qr_code
<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 &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, code, qr_code, category_id, category_name, create_time, item_id
</otherwise>
</choose>
from item_tag_qr_code
<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.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from item_tag_qr_code
where id = #{id,jdbcType=BIGINT}
</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 &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, code, qr_code, category_id, category_name, create_time, item_id
</otherwise>
</choose>
from item_tag_qr_code
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from item_tag_qr_code
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.ItemTagQrCodeExample">
delete from item_tag_qr_code
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.ItemTagQrCode">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into item_tag_qr_code (code, qr_code, category_id,
category_name, create_time, item_id
)
values (#{code,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, #{categoryId,jdbcType=INTEGER},
#{categoryName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{itemId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.ItemTagQrCode">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into item_tag_qr_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">
code,
</if>
<if test="qrCode != null">
qr_code,
</if>
<if test="categoryId != null">
category_id,
</if>
<if test="categoryName != null">
category_name,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="itemId != null">
item_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="qrCode != null">
#{qrCode,jdbcType=VARCHAR},
</if>
<if test="categoryId != null">
#{categoryId,jdbcType=INTEGER},
</if>
<if test="categoryName != null">
#{categoryName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="itemId != null">
#{itemId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.ItemTagQrCodeExample" resultType="java.lang.Long">
select count(*) from item_tag_qr_code
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update item_tag_qr_code
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.qrCode != null">
qr_code = #{record.qrCode,jdbcType=VARCHAR},
</if>
<if test="record.categoryId != null">
category_id = #{record.categoryId,jdbcType=INTEGER},
</if>
<if test="record.categoryName != null">
category_name = #{record.categoryName,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.itemId != null">
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update item_tag_qr_code
set id = #{record.id,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
qr_code = #{record.qrCode,jdbcType=VARCHAR},
category_id = #{record.categoryId,jdbcType=INTEGER},
category_name = #{record.categoryName,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
item_id = #{record.itemId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.ItemTagQrCode">
update item_tag_qr_code
<set>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="qrCode != null">
qr_code = #{qrCode,jdbcType=VARCHAR},
</if>
<if test="categoryId != null">
category_id = #{categoryId,jdbcType=INTEGER},
</if>
<if test="categoryName != null">
category_name = #{categoryName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="itemId != null">
item_id = #{itemId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.ItemTagQrCode">
update item_tag_qr_code
set code = #{code,jdbcType=VARCHAR},
qr_code = #{qrCode,jdbcType=VARCHAR},
category_id = #{categoryId,jdbcType=INTEGER},
category_name = #{categoryName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
item_id = #{itemId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.ItemTagQrCodeExample" 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 item_tag_qr_code
<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 &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, code, qr_code, category_id, category_name, create_time, item_id
</otherwise>
</choose>
from item_tag_qr_code
<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
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper"
targetProject="ch-dao/src/main/java"/>
<table tableName="sign_in_share_image" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="item_tag_qr_code" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -5,16 +5,20 @@ import com.wwdz.ch.core.api.WxAppletApi;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.SupplierItemEnum;
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.util.AESCrypt;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.core.util.QRCodeUtil;
import com.wwdz.ch.core.util.UUID;
import com.wwdz.ch.db.dao.CategoryDao;
import com.wwdz.ch.db.dao.ItemTagOperateRecordDao;
import com.wwdz.ch.db.dao.ItemTagQrCodeDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.domain.ItemTagOperateRecord;
import com.wwdz.ch.db.domain.ItemTagQrCode;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.ItemTagOperateRecordRequestDto;
import com.wwdz.ch.wx.entity.request.ItemTagOperateRequestDto;
......@@ -52,41 +56,6 @@ public class ItemTagOperateServiceImpl implements ItemTagOperateService {
@Autowired
WxAppletApi wxAppletApi;
@Override
public Result createQrCode(ItemTagOperateRequestDto dto) {
try {
int createNum = dto.getCreateNum();
IntStream.rangeClosed(0, createNum).parallel().forEach( i ->{
SupplierItem supplierItem = new SupplierItem();
supplierItem.setDistributionPrice(0L);
supplierItem.setSupplyPrice(0L);
supplierItem.setRebate(new BigDecimal("0"));
supplierItem.setSort(1);
supplierItem.setBuyLimitNum(-1);
supplierItem.setIsAbleSale(false);
supplierItem.setIsOnSale(false);
supplierItem.setStock(1);
supplierItem.setIsOnSale(false);
Date now = new Date();
supplierItem.setCreateTime(now);
supplierItem.setUpdateTime(now);
supplierItem.setIsDeleted(true);
supplierItem.setDistributionPrice(0L);
supplierItem.setType(DistributionEnum.DistributionTypeEnum.BLACK.getCode());
supplierItem.setStatus(SupplierItemEnum.StatusEnum.COMMON.getCode());
supplierItem.setCreatorId(CommConsts.PRINT_ITEM_TAG_CREATOR_ID);
long itemId = supplierItemDao.insert(supplierItem);
//获取页面短链
String url = wxAppletApi.getUrlLink("/pages/detail/index","itemId=" + itemId);
String qrCode = QRCodeUtil.createCodeToBase64(url);
});
} catch (Exception e) {
logger.error("打印标签失败", e);
}
return Result.failed("打印标签失败");
}
@Override
public Result printItemTag(ItemTagOperateRequestDto dto) {
try {
......
package com.wwdz.ch.wx.impl;
import com.wwdz.ch.core.api.WxAppletApi;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.storage.QiniuStorage;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.QRCodeUtil;
import com.wwdz.ch.core.util.UUID;
import com.wwdz.ch.db.dao.ItemTagQrCodeDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.ItemTagQrCode;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.ItemTagQrCodeRequestDto;
import com.wwdz.ch.wx.entity.request.ItemTagOperateRequestDto;
import com.wwdz.ch.wx.service.ItemTagQrCodeService;
import com.xxdxxs.utils.EntityMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class ItemTagQrCodeServiceImpl implements ItemTagQrCodeService {
private static final Logger logger = LoggerFactory.getLogger(ItemTagQrCodeServiceImpl.class);
@Autowired
WxAppletApi wxAppletApi;
@Autowired
ItemTagQrCodeDao itemTagQrCodeDao;
@Autowired
QiniuStorage qiniuStorage;
@Autowired
SupplierItemDao supplierItemDao;
@Override
public Result createQrCode(ItemTagOperateRequestDto dto) {
try {
Date now = new Date();
String code = UUID.fastUUID().toString(true);
ItemTagQrCode itemTagQrCode = new ItemTagQrCode();
itemTagQrCode.setCode(code);
itemTagQrCode.setCategoryId(1774);
itemTagQrCode.setCategoryName("开元通宝");
itemTagQrCode.setCreateTime(now);
//获取页面短链
String url = wxAppletApi.getUrlLink("/pages/detail/index","code=" + code);
String qrCode = QRCodeUtil.createCodeToBase64(url);
String keyName = CommConsts.UPLOAD_PRE_DIRECTORY + code;
String qrCodeUrl = qiniuStorage.storeItemQrcodeBase64Str(qrCode.trim(), keyName);
logger.info("上传的商品标签二维码url :{}", qrCodeUrl);
itemTagQrCode.setQrCode(qrCodeUrl);
itemTagQrCodeDao.insert(itemTagQrCode);
return Result.success(qrCodeUrl);
} catch (Exception e) {
logger.error("创建标签二维码失败", e);
}
return Result.failed("创建标签二维码失败");
}
@Override
public Result findByCode(ItemTagQrCodeRequestDto dto) {
try {
ItemTagQrCode itemTagQrCode = itemTagQrCodeDao.findByCode(dto.getCode());
if (itemTagQrCode != null && itemTagQrCode.getItemId() != null) {
SupplierItem supplierItem = supplierItemDao.findById(itemTagQrCode.getItemId());
SupplierItemVo supplierItemVo = new SupplierItemVo();
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
return Result.success(supplierItemVo);
}
return Result.success(itemTagQrCode);
} catch (Exception e) {
logger.error("根据二维码code查询信息失败", e);
}
return Result.failed();
}
}
......@@ -6,14 +6,6 @@ import com.wwdz.ch.wx.entity.request.ItemTagOperateRequestDto;
public interface ItemTagOperateService {
/**
* 创建无图商品,生成页面二维码
* @return
*/
Result createQrCode(ItemTagOperateRequestDto dto);
/**
* 打印标签
* @param dto
......
package com.wwdz.ch.wx.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.ItemTagQrCodeRequestDto;
import com.wwdz.ch.wx.entity.request.ItemTagOperateRequestDto;
public interface ItemTagQrCodeService {
/**
* 批量生成页面二维码
* @return
*/
Result createQrCode(ItemTagOperateRequestDto dto);
/**
* 根据二维码code查询信息
* @param dto
* @return
*/
Result findByCode(ItemTagQrCodeRequestDto 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