plf hace 5 años
padre
commit
0ad93621ee

+ 19 - 0
base-module/src/main/java/com/caimei/module/base/entity/bo/JsonForm.java

@@ -0,0 +1,19 @@
+package com.caimei.module.base.entity.bo;
+
+public class JsonForm {
+	private boolean return_code;
+	private String  return_message;
+	public boolean isReturn_code() {
+		return return_code;
+	}
+	public void setReturn_code(boolean return_code) {
+		this.return_code = return_code;
+	}
+	public String getReturn_message() {
+		return return_message;
+	}
+	public void setReturn_message(String return_message) {
+		this.return_message = return_message;
+	}
+
+}

+ 109 - 0
base-module/src/main/java/com/caimei/module/base/entity/bo/JsonModel.java

@@ -0,0 +1,109 @@
+package com.caimei.module.base.entity.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/4
+ */
+@Data
+public class JsonModel implements Serializable {
+    /**
+     * 状态码
+     */
+    private int code;
+    /**
+     * 提示信息
+     */
+    private String msg;
+    /**
+     * 返回的数据
+     */
+    private Object data;
+
+    public JsonModel() {
+    }
+
+    public JsonModel(Integer code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public JsonModel(Integer code, String msg, Object data) {
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public static JsonModel newInstance() {
+        JsonModel jsonModel = new JsonModel();
+        return jsonModel.success();
+    }
+
+    public JsonModel success() {
+        this.code = 0;
+        this.msg = "操作成功";
+        return this;
+    }
+
+    public JsonModel success(Object data) {
+        this.code = 0;
+        this.msg = "操作成功";
+        this.data = data;
+        return this;
+    }
+
+    public JsonModel success(String msg, Object data) {
+        this.code = 0;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public JsonModel success(int code, String msg, Object data) {
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public JsonModel error() {
+        this.code = -1;
+        this.msg = "操作失败";
+        return this;
+    }
+
+    public JsonModel error(String msg) {
+        this.code = -1;
+        this.msg = msg;
+        return this;
+    }
+
+    public JsonModel error(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+        return this;
+    }
+
+    public JsonModel error(int code, String msg, Object data) {
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return "JsonModel{" +
+                "code=" + code +
+                ", msg='" + msg + '\'' +
+                ", data=" + data +
+                '}';
+    }
+
+    private static final long serialVersionUID = 1L;
+}

+ 114 - 0
base-module/src/main/java/com/caimei/module/base/entity/bo/PageModel.java

@@ -0,0 +1,114 @@
+package com.caimei.module.base.entity.bo;
+
+import lombok.Builder;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/9
+ */
+@Data
+public class PageModel<T> implements Serializable {
+    /** 当前页码 */
+    @Builder.Default
+    private int pageNum = 1;
+    /** 每页大小 */
+    @Builder.Default
+    private int pageSize = 10;
+    /** 总记录数 */
+    private int totalRecord;
+    /** 总页数 */
+    private int totalPage;
+    /** 是否有后一页 */
+    private boolean hasNextPage;
+    /** 是否有前一页 */
+    private boolean hasPreviousPage;
+    /** 查询结果 */
+    List<T> results;
+
+    public PageModel(List<T> list) {
+        if (list instanceof com.github.pagehelper.Page) {
+            com.github.pagehelper.Page<T> page = (com.github.pagehelper.Page<T>) list;
+            this.pageNum = page.getPageNum();
+            this.pageSize = page.getPageSize();
+            this.totalRecord = (int) page.getTotal();
+            this.totalPage = page.getPages();
+            setHasPreviousAndNext();
+            this.results = page;
+        } else if (list instanceof Collection) {
+            this.pageNum = 1;
+            this.pageSize = list.size();
+            this.totalRecord = list.size();
+            this.totalPage = 1;
+            this.results = list;
+        }
+    }
+
+    public PageModel(int pageNum, int pageSize, int totalRecord, List<T> results) {
+        super();
+        this.pageNum = pageNum;
+        this.pageSize = pageSize;
+        this.totalRecord = totalRecord;
+        this.totalPage = totalRecord % pageSize == 0 ? totalRecord / pageSize : totalRecord / pageSize + 1;
+        this.results = results;
+        if (this.pageNum < 2) {
+            hasPreviousPage = false;
+        } else {
+            hasPreviousPage = true;
+        }
+        if (this.pageNum < totalPage) {
+            hasNextPage = true;
+        } else {
+            hasNextPage = false;
+        }
+    }
+
+    public PageModel(int pageNum, int maxSize, int totalRecord, int totalPage,
+                     List<T> results) {
+        super();
+        this.pageNum = pageNum;
+        this.pageSize = maxSize;
+        this.totalRecord = totalRecord;
+        this.totalPage = totalPage;
+        this.results = results;
+        if (this.pageNum < 2) {
+            hasPreviousPage = false;
+        } else {
+            hasPreviousPage = true;
+        }
+        if (this.pageNum < totalPage) {
+            hasNextPage = true;
+        } else {
+            hasNextPage = false;
+        }
+    }
+
+    public PageModel() {super();}
+
+    public void setHasPreviousAndNext() {
+        if (this.pageNum < 2) {
+            hasPreviousPage = false;
+        } else {
+            hasPreviousPage = true;
+        }
+        if (this.pageNum < totalPage) {
+            hasNextPage = true;
+        } else {
+            hasNextPage = false;
+        }
+    }
+
+    public int countTotalPage() {
+        int total = totalRecord % pageSize == 0 ? totalRecord / pageSize : totalRecord / pageSize + 1;
+        this.setTotalPage(total);
+        return total;
+    }
+
+    private static final long serialVersionUID = 1L;
+}

+ 7 - 0
base-module/src/main/java/com/caimei/module/base/entity/vo/SellerCatVo.java

@@ -4,6 +4,8 @@ import com.caimei.module.base.entity.po.BpOrderProductCart;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.List;
+
 /**
  * Description
  *
@@ -13,4 +15,9 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 @Data
 public class SellerCatVo extends BpOrderProductCart {
+
+    /**
+     * 阶梯价格
+     */
+    List<LadderPriceVo> ladderPriceList;
 }