jpa相关的配置更改和字段默认值设置

master
土豆兄弟 4 years ago
parent e4b738e2b8
commit 423ba08061

@ -1,3 +1,14 @@
USE ;
DROP TABLE IF EXISTS ``;
CREATE TABLE ab_message (
id bigint(20) NOT NULL AUTO_INCREMENT,
gmt_create datetime DEFAULT NULL,
gmt_modified datetime DEFAULT NULL,
rec_id bigint(20) DEFAULT NULL COMMENT '记录id',
pnum varchar(255) DEFAULT NULL COMMENT 'pnum',
act_name varchar(255) DEFAULT NULL COMMENT '业务名',
start_time datetime DEFAULT NULL COMMENT '业务开始时间',
client_type tinyint(1) DEFAULT NULL COMMENT '业务类别(1:A,2:B,3:C,4:D,5:E,6:F)',
app_id varchar(255) DEFAULT NULL COMMENT '上游推送用户id',
push_time datetime DEFAULT NULL COMMENT '上游推送时间',
send_status tinyint(1) DEFAULT 0 COMMENT '下游推送状态',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

@ -2,10 +2,12 @@ package com.yuyou.openapi.openapi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
@EnableAsync
@EnableJpaAuditing
public class OpenapiApplication {
public static void main(String[] args) {

@ -82,6 +82,12 @@ public class ABMessageConverter {
BeanUtils.copyProperties(abMessageDTO, abMessageDO);
abMessageDO.setPushTime(DateUtil.date(abMessageDTO.getTimestamp() * 1000));
abMessageDO.setStartTime(DateUtil.date(abMessageDTO.getStartTime() * 1000));
try{
abMessageDO.setRecId(Long.valueOf(abMessageDTO.getRecId()));
}catch (Exception e){
log.error("String convert Long type Error.");
}
// AES加密
try {
SecurityService.encrypt(abMessageDTO.getMobile(), SecurityConstants.PHONE);

@ -1,10 +1,11 @@
package com.yuyou.openapi.openapi.model.dataobject;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.util.Date;
/**
@ -14,15 +15,20 @@ import java.util.Date;
*/
@Data
@Table(name = "ab_message")
@Entity
@EntityListeners(AuditingEntityListener.class)
public class ABMessageDO {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@Column(name = "gmt_create")
@CreatedDate
private Date gmtCreate;
@Column(name = "gmt_modified")
@LastModifiedDate
private Date gmtModified;
/**
@ -67,6 +73,9 @@ public class ABMessageDO {
@Column(name = "push_time")
private Date pushTime;
/**
* 0 0 - 1 -
*/
@Column(name = "send_status")
private Integer sendStatus;
private Integer sendStatus = 0;
}

@ -1,11 +1,11 @@
package com.yuyou.openapi.openapi.model.dataobject;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.util.Date;
/**
@ -16,21 +16,25 @@ import java.util.Date;
@Data
@Entity
@Table(name = "app_user")
@EntityListeners(AuditingEntityListener.class)
public class AppUserDO {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
/**
*
*/
@Column(name = "gmt_create")
@CreatedDate
private Date gmtCreate;
/**
*
*/
@Column(name = "gmt_modified")
@LastModifiedDate
private Date gmtModified;
/**

@ -1,10 +1,11 @@
package com.yuyou.openapi.openapi.model.dataobject;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.util.Date;
/**
@ -14,18 +15,23 @@ import java.util.Date;
*/
@Data
@Table(name = "zhangmen_message")
@Entity
@EntityListeners(AuditingEntityListener.class)
public class ZhangmenMessageDO {
/**
* id
*/
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@Column(name = "gmt_create")
@CreatedDate
private Date gmtCreate;
@Column(name = "gmt_modified")
@LastModifiedDate
private Date gmtModified;
/**

@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**

@ -4,7 +4,9 @@ spring:
# 序列化忽略null的k-v配置
jackson:
default-property-inclusion: non_null
# JPA数据层相关配置
jpa:
show-sql: true
---
# 端口
server:

Loading…
Cancel
Save