From 7340bf3f8ccf7c2ab099337d9cde25fd079e9b95 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 3 Apr 2019 15:49:42 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B4=A6=E5=8D=95=E6=93=8D=E4=BD=9C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95][=E6=B7=BB=E5=8A=A0][=E5=AE=9E=E4=BD=93=E5=8F=8Asql]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V201904031540__ADD_BILL_ACTION.sql | 14 ++ .../com/iformall/domain/po/WxBillAction.java | 196 ++++++++++++++++++ .../com/iformall/enums/EnumBillAction.java | 39 ++++ .../iformall/mapper/WxBillActionMapper.java | 16 ++ .../resources/mapper/WxBillActionMapper.xml | 57 +++++ 5 files changed, 322 insertions(+) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V201904031540__ADD_BILL_ACTION.sql create mode 100644 mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java create mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java create mode 100644 mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java create mode 100644 mallinkService/src/main/resources/mapper/WxBillActionMapper.xml diff --git a/mallinkAdmin/src/main/resources/db/migration/V201904031540__ADD_BILL_ACTION.sql b/mallinkAdmin/src/main/resources/db/migration/V201904031540__ADD_BILL_ACTION.sql new file mode 100644 index 000000000..978192cbf --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201904031540__ADD_BILL_ACTION.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS `wx_bill_action` ; +CREATE TABLE `wx_bill_action` ( + `id` bigint(64) NOT NULL COMMENT 'ID', + `tenant_id` varchar(50) NOT NULL COMMENT '租户Id', + `user_id` bigint(64) NOT NULL COMMENT '用户ID', + `user_name` varchar(100) NOT NULL COMMENT '用户名', + `phone` varchar(20) NOT NULL COMMENT '手机号', + `action` smallint(2) NOT NULL COMMENT '动作', + `details` varchar(200) NOT NULL COMMENT '明细', + `createtime` datetime NOT NULL COMMENT '创建时间', + `updatetime` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`id`), + INDEX `id_index` USING BTREE (`id`) comment '' +) ENGINE=`InnoDB` ROW_FORMAT=DYNAMIC COMMENT='账单操作记录' CHECKSUM=0 DELAY_KEY_WRITE=0; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java new file mode 100644 index 000000000..3e539436f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java @@ -0,0 +1,196 @@ +package com.iformall.domain.po; + +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Table(name = "wx_bill_action") +public class WxBillAction implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + + @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") + private String tenantId; + + @io.swagger.annotations.ApiModelProperty(value = "账单ID", name = "billId") + private Long billId; + + @io.swagger.annotations.ApiModelProperty(value = "用户ID", name = "userId") + private Long userId; + + @io.swagger.annotations.ApiModelProperty(value = "用户名称", name = "userName") + private String userName; + + @io.swagger.annotations.ApiModelProperty(value = "手机号", name = "phone") + private String phone; + + @io.swagger.annotations.ApiModelProperty(value = "动作", name = "action") + private Integer action; + + @io.swagger.annotations.ApiModelProperty(value = "描述", name = "details") + private String details; + + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime") + private Date createtime; + + @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") + private Date updatetime; + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public Long getBillId() { + return billId; + } + + public void setBillId(Long billId) { + this.billId = billId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Integer getAction() { + return action; + } + + public void setAction(Integer action) { + this.action = action; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + + public static enum Field { + Id_ASC("`id` ASC"), Id_DESC("`id` DESC"); + private String value; + + Field(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public void setCol(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(WxBillAction.Field... fields) { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + this.sortColumns = sb.toString(); + } + + public void setSortColumns(String sortColumns) { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + List fList = new java.util.ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java b/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java new file mode 100644 index 000000000..d0967c9cf --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java @@ -0,0 +1,39 @@ +package com.iformall.enums; + + +/** + * @author gongbiao + */ + +public enum EnumBillAction { + SELF_SERVICE_PAY(1, "自助缴费"), + UPDATE_BILL(2, "变更账单"), + OFFLINE_PAY(3, "线下缴费"), + DEPOSIT_PAY(4, "押金缴费"), + DEPOSIT_RETURN(5, "押金退款"),; + + public static EnumBillAction getEnum(Integer code) { + for (EnumBillAction value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumBillAction(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java new file mode 100644 index 000000000..7788f7539 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java @@ -0,0 +1,16 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxBillAction; +import com.iformall.domain.po.WxShop; + +import java.util.List; + +/** + * @author gongbiao + */ +public interface WxBillActionMapper extends CommonMapper { + + List findList(WxBillAction wxBillAction); + +} diff --git a/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml b/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml new file mode 100644 index 000000000..e68abb250 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`bill_id`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime` + + + + where 1=1 + + + and `id` = #{id} + + + + and `tenant_id` = #{tenantId} + + + + and `action` = #{action} + + + + and `bill_id` = #{billId} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + +