Просмотр исходного кода

[账单操作记录][添加][实体及sql]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
7340bf3f8c
5 измененных файлов: 322 добавлений и 0 удалений
  1. +14
    -0
      mallinkAdmin/src/main/resources/db/migration/V201904031540__ADD_BILL_ACTION.sql
  2. +196
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java
  3. +39
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java
  4. +16
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java
  5. +57
    -0
      mallinkService/src/main/resources/mapper/WxBillActionMapper.xml

+ 14
- 0
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;

+ 196
- 0
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<Long> 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<Long> getIds() {
return ids;
}

public void setIds(List<Long> 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<Field> 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));
}
}
}

+ 39
- 0
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;
}
}

+ 16
- 0
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<WxBillAction, Long> {

List<WxShop> findList(WxBillAction wxBillAction);

}

+ 57
- 0
mallinkService/src/main/resources/mapper/WxBillActionMapper.xml Просмотреть файл

@@ -0,0 +1,57 @@
<?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.iformall.mapper.WxBillActionMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillAction">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="bill_id" jdbcType="BIGINT" property="bill_id"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="user_name" jdbcType="VARCHAR" property="userName"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="action" jdbcType="INTEGER" property="action"/>
<result column="details" jdbcType="VARCHAR" property="details"/>
<result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`bill_id`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime`
</sql>
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != action ">
and `action` = #{action}
</if>
<if test=" null != billId ">
and `bill_id` = #{billId}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxBillAction" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_bill_action
<include refid="dynamicWhereConditions"/>
</select>


</mapper>

Загрузка…
Отмена
Сохранить