mirror of https://github.com/elunez/eladmin
加入实体基类、DTO基类、修改部分实体继承基类
parent
bf7c1eebf0
commit
8cb7dc886f
|
@ -44,7 +44,7 @@ public class LimitAspect {
|
|||
String key = limit.key();
|
||||
if (StringUtils.isEmpty(key)) {
|
||||
if (limitType == LimitType.IP) {
|
||||
key = StringUtils.getIP(request);
|
||||
key = StringUtils.getIp(request);
|
||||
} else {
|
||||
key = signatureMethod.getName();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package me.zhengjie.aspect;
|
||||
|
||||
/**
|
||||
* 限流枚举
|
||||
* @author /
|
||||
*/
|
||||
public enum LimitType {
|
||||
// 默认
|
||||
CUSTOMER,
|
||||
// by ip addr
|
||||
IP;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package me.zhengjie.base;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @Date 2019年10月24日20:48:53
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class BaseDTO implements Serializable {
|
||||
|
||||
private Boolean isDelete;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package me.zhengjie.base;
|
||||
|
||||
import lombok.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @Date 2019年10月24日20:46:32
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@MappedSuperclass
|
||||
public class BaseEntity implements Serializable {
|
||||
|
||||
// 删除标识
|
||||
@Column(name = "is_delete", columnDefinition = "bit default 0")
|
||||
private Boolean isDelete = false;
|
||||
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "update_time")
|
||||
@UpdateTimestamp
|
||||
private Timestamp updateTime;
|
||||
|
||||
public @interface New {}
|
||||
|
||||
public @interface Update {}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this);
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
try {
|
||||
for (Field f : fields) {
|
||||
f.setAccessible(true);
|
||||
builder.append(f.getName(), f.get(this)).append("\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
builder.append("toString builder encounter an error");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.mapper;
|
||||
package me.zhengjie.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
public interface EntityMapper<D, E> {
|
||||
public interface BaseMapper<D, E> {
|
||||
|
||||
/**
|
||||
* DTO转Entity
|
|
@ -145,7 +145,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
if (!dest.getParentFile().exists()) {
|
||||
dest.getParentFile().mkdirs();
|
||||
}
|
||||
file.transferTo(dest);// 文件写入
|
||||
// 文件写入
|
||||
file.transferTo(dest);
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -197,7 +198,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
return "音乐";
|
||||
} else if(video.contains(type)){
|
||||
return "视频";
|
||||
} else return "其他";
|
||||
} else {
|
||||
return "其他";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFileTypeByMimeType(String type) {
|
||||
|
@ -215,8 +218,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
* 判断两个文件是否相同
|
||||
*/
|
||||
public static boolean check(File file1, File file2) {
|
||||
String img1Md5 = getMD5(file1);
|
||||
String img2Md5 = getMD5(file2);
|
||||
String img1Md5 = getMd5(file1);
|
||||
String img2Md5 = getMd5(file2);
|
||||
return img1Md5.equals(img2Md5);
|
||||
}
|
||||
|
||||
|
@ -244,7 +247,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
return b;
|
||||
}
|
||||
|
||||
private static String getMD5(byte[] bytes) {
|
||||
private static String getMd5(byte[] bytes) {
|
||||
// 16进制字符
|
||||
char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
try {
|
||||
|
@ -266,8 +269,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static String getMD5(File file) {
|
||||
return getMD5(getByte(file));
|
||||
public static String getMd5(File file) {
|
||||
return getMd5(getByte(file));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public class QueryHelp {
|
|||
join = root.join(name, JoinType.RIGHT);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +106,7 @@ public class QueryHelp {
|
|||
list.add(getExpression(attributeName,join,root).in((Collection<Long>) val));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
field.setAccessible(accessible);
|
||||
|
|
|
@ -107,7 +107,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
/**
|
||||
* 获取ip地址
|
||||
*/
|
||||
public static String getIP(HttpServletRequest request) {
|
||||
public static String getIp(HttpServletRequest request) {
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
|
|
|
@ -38,6 +38,6 @@ public class StringUtilsTest {
|
|||
|
||||
@Test
|
||||
public void testGetIP() {
|
||||
assertEquals("127.0.0.1", getIP(new MockHttpServletRequest()));
|
||||
assertEquals("127.0.0.1", getIp(new MockHttpServletRequest()));
|
||||
}
|
||||
}
|
|
@ -52,7 +52,7 @@ public class LogAspect {
|
|||
currentTime = System.currentTimeMillis();
|
||||
result = joinPoint.proceed();
|
||||
Log log = new Log("INFO",System.currentTimeMillis() - currentTime);
|
||||
logService.save(getUsername(), StringUtils.getIP(RequestHolder.getHttpServletRequest()),joinPoint, log);
|
||||
logService.save(getUsername(), StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint, log);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class LogAspect {
|
|||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
||||
Log log = new Log("ERROR",System.currentTimeMillis() - currentTime);
|
||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||
logService.save(getUsername(), StringUtils.getIP(RequestHolder.getHttpServletRequest()), (ProceedingJoinPoint)joinPoint, log);
|
||||
logService.save(getUsername(), StringUtils.getIp(RequestHolder.getHttpServletRequest()), (ProceedingJoinPoint)joinPoint, log);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.service.mapper;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.domain.Log;
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.service.dto.LogErrorDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-5-22
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LogErrorMapper extends EntityMapper<LogErrorDTO, Log> {
|
||||
public interface LogErrorMapper extends BaseMapper<LogErrorDTO, Log> {
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.service.mapper;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.domain.Log;
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.service.dto.LogSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-5-22
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LogSmallMapper extends EntityMapper<LogSmallDTO, Log> {
|
||||
public interface LogSmallMapper extends BaseMapper<LogSmallDTO, Log> {
|
||||
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
package me.zhengjie.modules.quartz.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -16,7 +13,7 @@ import java.sql.Timestamp;
|
|||
@Data
|
||||
@Entity
|
||||
@Table(name = "quartz_job")
|
||||
public class QuartzJob implements Serializable {
|
||||
public class QuartzJob extends BaseEntity {
|
||||
|
||||
public static final String JOB_KEY = "JOB_KEY";
|
||||
|
||||
|
@ -56,11 +53,4 @@ public class QuartzJob implements Serializable {
|
|||
@Column(name = "remark")
|
||||
@NotBlank
|
||||
private String remark;
|
||||
|
||||
// 创建日期
|
||||
@UpdateTimestamp
|
||||
@Column(name = "update_time")
|
||||
private Timestamp updateTime;
|
||||
|
||||
public interface Update{}
|
||||
}
|
|
@ -2,12 +2,12 @@ package me.zhengjie.modules.system.domain;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -15,9 +15,10 @@ import java.util.Set;
|
|||
* @date 2019-03-25
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name="dept")
|
||||
public class Dept implements Serializable {
|
||||
public class Dept extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -39,10 +40,4 @@ public class Dept implements Serializable {
|
|||
@JsonIgnore
|
||||
@ManyToMany(mappedBy = "depts")
|
||||
private Set<Role> roles;
|
||||
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
@ -12,9 +16,10 @@ import java.util.List;
|
|||
* @date 2019-04-10
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name="dict")
|
||||
public class Dict implements Serializable {
|
||||
public class Dict extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -31,6 +36,4 @@ public class Dict implements Serializable {
|
|||
|
||||
@OneToMany(mappedBy = "dict",cascade={CascadeType.PERSIST,CascadeType.REMOVE})
|
||||
private List<DictDetail> dictDetails;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
@ -10,9 +14,10 @@ import java.io.Serializable;
|
|||
* @date 2019-04-10
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name="dict_detail")
|
||||
public class DictDetail implements Serializable {
|
||||
public class DictDetail extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -36,6 +41,4 @@ public class DictDetail implements Serializable {
|
|||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name = "dict_id")
|
||||
private Dict dict;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import org.hibernate.annotations.*;
|
||||
import javax.persistence.*;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -15,9 +18,10 @@ import java.io.Serializable;
|
|||
* @date 2019-03-29
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name="job")
|
||||
public class Job implements Serializable {
|
||||
public class Job extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -40,10 +44,4 @@ public class Job implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "dept_id")
|
||||
private Dept dept;
|
||||
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
@ -20,7 +21,7 @@ import java.util.Set;
|
|||
@Getter
|
||||
@Setter
|
||||
@Table(name = "menu")
|
||||
public class Menu implements Serializable {
|
||||
public class Menu extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -63,12 +64,6 @@ public class Menu implements Serializable {
|
|||
@JsonIgnore
|
||||
private Set<Role> roles;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time")
|
||||
private Timestamp createTime;
|
||||
|
||||
public interface Update{}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
@ -19,7 +20,7 @@ import java.util.Set;
|
|||
@Getter
|
||||
@Setter
|
||||
@Table(name = "permission")
|
||||
public class Permission implements Serializable{
|
||||
public class Permission extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -40,21 +41,4 @@ public class Permission implements Serializable{
|
|||
@JsonIgnore
|
||||
@ManyToMany(mappedBy = "permissions")
|
||||
private Set<Role> roles;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Permission{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", pid=" + pid +
|
||||
", alias='" + alias + '\'' +
|
||||
", createTime=" + createTime +
|
||||
'}';
|
||||
}
|
||||
|
||||
public interface Update{}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
@ -21,7 +22,7 @@ import java.util.Set;
|
|||
@Table(name = "role")
|
||||
@Getter
|
||||
@Setter
|
||||
public class Role implements Serializable {
|
||||
public class Role extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -59,20 +60,6 @@ public class Role implements Serializable {
|
|||
@JoinTable(name = "roles_depts", joinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "dept_id",referencedColumnName = "id")})
|
||||
private Set<Dept> depts;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Role{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", remark='" + remark + '\'' +
|
||||
", createDateTime=" + createTime +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -2,13 +2,11 @@ package me.zhengjie.modules.system.domain;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -20,7 +18,7 @@ import java.util.Set;
|
|||
@Getter
|
||||
@Setter
|
||||
@Table(name="user")
|
||||
public class User implements Serializable {
|
||||
public class User extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -47,10 +45,6 @@ public class User implements Serializable {
|
|||
|
||||
private String password;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "last_password_reset_time")
|
||||
private Date lastPasswordResetTime;
|
||||
|
||||
|
@ -65,19 +59,4 @@ public class User implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "dept_id")
|
||||
private Dept dept;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"id=" + id +
|
||||
", username='" + username + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", enabled=" + enabled +
|
||||
", password='" + password + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", lastPasswordResetTime=" + lastPasswordResetTime +
|
||||
'}';
|
||||
}
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -2,7 +2,10 @@ package me.zhengjie.modules.system.domain;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.sql.Timestamp;
|
||||
|
@ -12,10 +15,11 @@ import java.sql.Timestamp;
|
|||
* @date 2019年9月7日 16:16:59
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "user_avatar")
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class UserAvatar {
|
||||
@Table(name = "user_avatar")
|
||||
public class UserAvatar extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Data
|
||||
public class DeptDTO implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
public class DeptDTO extends BaseDTO {
|
||||
|
||||
// ID
|
||||
private Long id;
|
||||
|
@ -30,8 +30,6 @@ public class DeptDTO implements Serializable {
|
|||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeptDTO> children;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Data
|
||||
public class DictDTO implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
public class DictDTO extends BaseDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Data
|
||||
public class DictDetailDTO implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
public class DictDetailDTO extends BaseDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class JobDTO implements Serializable {
|
||||
public class JobDTO extends BaseDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
@ -28,8 +26,6 @@ public class JobDTO implements Serializable {
|
|||
|
||||
private String deptSuperiorName;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
public JobDTO(String name, Boolean enabled) {
|
||||
this.name = name;
|
||||
this.enabled = enabled;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-17
|
||||
*/
|
||||
@Data
|
||||
public class MenuDTO {
|
||||
@Getter
|
||||
@Setter
|
||||
public class MenuDTO extends BaseDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
@ -36,6 +36,4 @@ public class MenuDTO {
|
|||
private String icon;
|
||||
|
||||
private List<MenuDTO> children;
|
||||
|
||||
private Timestamp createTime;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-03
|
||||
*/
|
||||
@Data
|
||||
public class PermissionDTO implements Serializable{
|
||||
@Getter
|
||||
@Setter
|
||||
public class PermissionDTO extends BaseDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
@ -21,18 +21,5 @@ public class PermissionDTO implements Serializable{
|
|||
|
||||
private String alias;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private List<PermissionDTO> children;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Permission{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", pid=" + pid +
|
||||
", alias='" + alias + '\'' +
|
||||
", createTime=" + createTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Data
|
||||
public class RoleDTO implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
public class RoleDTO extends BaseDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
@ -27,6 +28,4 @@ public class RoleDTO implements Serializable {
|
|||
private Set<MenuDTO> menus;
|
||||
|
||||
private Set<DeptDTO> depts;
|
||||
|
||||
private Timestamp createTime;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package me.zhengjie.modules.system.service.dto;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -12,8 +12,9 @@ import java.util.Set;
|
|||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Data
|
||||
public class UserDTO implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserDTO extends BaseDTO {
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Long id;
|
||||
|
@ -31,8 +32,6 @@ public class UserDTO implements Serializable {
|
|||
@JsonIgnore
|
||||
private String password;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Date lastPasswordResetTime;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptMapper extends EntityMapper<DeptDTO, Dept> {
|
||||
public interface DeptMapper extends BaseMapper<DeptDTO, Dept> {
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.dto.DeptSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptSmallMapper extends EntityMapper<DeptSmallDTO, Dept> {
|
||||
public interface DeptSmallMapper extends BaseMapper<DeptSmallDTO, Dept> {
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import me.zhengjie.modules.system.service.dto.DictDetailDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictDetailMapper extends EntityMapper<DictDetailDTO, DictDetail> {
|
||||
public interface DictDetailMapper extends BaseMapper<DictDetailDTO, DictDetail> {
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.modules.system.service.dto.DictDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictMapper extends EntityMapper<DictDTO, Dict> {
|
||||
public interface DictMapper extends BaseMapper<DictDTO, Dict> {
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.modules.system.service.dto.JobDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -12,7 +12,7 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-03-29
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {DeptMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface JobMapper extends EntityMapper<JobDTO, Job> {
|
||||
public interface JobMapper extends BaseMapper<JobDTO, Job> {
|
||||
|
||||
@Mapping(source = "deptSuperiorName", target = "deptSuperiorName")
|
||||
JobDTO toDto(Job job, String deptSuperiorName);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.modules.system.service.dto.JobSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-03-29
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface JobSmallMapper extends EntityMapper<JobSmallDTO, Job> {
|
||||
public interface JobSmallMapper extends BaseMapper<JobSmallDTO, Job> {
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Menu;
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.service.dto.MenuDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2018-12-17
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MenuMapper extends EntityMapper<MenuDTO, Menu> {
|
||||
public interface MenuMapper extends BaseMapper<MenuDTO, Menu> {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Permission;
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.service.dto.PermissionDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface PermissionMapper extends EntityMapper<PermissionDTO, Permission> {
|
||||
public interface PermissionMapper extends BaseMapper<PermissionDTO, Permission> {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Role;
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.service.dto.RoleDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = {PermissionMapper.class, MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleMapper extends EntityMapper<RoleDTO, Role> {
|
||||
public interface RoleMapper extends BaseMapper<RoleDTO, Role> {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Role;
|
||||
import me.zhengjie.modules.system.service.dto.RoleDTO;
|
||||
import me.zhengjie.modules.system.service.dto.RoleSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
@ -12,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-5-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleSmallMapper extends EntityMapper<RoleSmallDTO, Role> {
|
||||
public interface RoleSmallMapper extends BaseMapper<RoleSmallDTO, Role> {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.service.dto.UserDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserMapper extends EntityMapper<UserDTO, User> {
|
||||
public interface UserMapper extends BaseMapper<UserDTO, User> {
|
||||
|
||||
@Mapping(source = "user.userAvatar.realName",target = "avatar")
|
||||
UserDTO toDto(User user);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ${package}.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import ${package}.domain.${className};
|
||||
import ${package}.service.dto.${className}DTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date ${date}
|
||||
*/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface ${className}Mapper extends EntityMapper<${className}DTO, ${className}> {
|
||||
public interface ${className}Mapper extends BaseMapper<${className}DTO, ${className}> {
|
||||
|
||||
}
|
|
@ -1,29 +1,22 @@
|
|||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.*;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
|
||||
import me.zhengjie.base.BaseEntity;
|
||||
import javax.persistence.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-09-05
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="local_storage")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LocalStorage implements Serializable {
|
||||
public class LocalStorage extends BaseEntity {
|
||||
|
||||
// ID
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
|
@ -57,16 +50,6 @@ public class LocalStorage implements Serializable {
|
|||
@Column(name = "operate")
|
||||
private String operate;
|
||||
|
||||
// 创建日期
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
// 修改日期
|
||||
@Column(name = "update_time")
|
||||
@UpdateTimestamp
|
||||
private Timestamp updateTime;
|
||||
|
||||
public LocalStorage(String realName,String name, String suffix, String path, String type, String size, String operate) {
|
||||
this.realName = realName;
|
||||
this.name = name;
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package me.zhengjie.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-09-05
|
||||
*/
|
||||
@Data
|
||||
public class LocalStorageDTO implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
public class LocalStorageDTO extends BaseDTO {
|
||||
|
||||
// ID
|
||||
private Long id;
|
||||
|
@ -32,10 +31,4 @@ public class LocalStorageDTO implements Serializable {
|
|||
|
||||
// 操作人
|
||||
private String operate;
|
||||
|
||||
// 创建日期
|
||||
private Timestamp createTime;
|
||||
|
||||
// 修改日期
|
||||
private Timestamp updateTime;
|
||||
}
|
|
@ -56,7 +56,7 @@ public class PictureServiceImpl implements PictureService {
|
|||
public Picture upload(MultipartFile multipartFile, String username) {
|
||||
File file = FileUtil.toFile(multipartFile);
|
||||
// 验证是否重复上传
|
||||
Picture picture = pictureRepository.findByMd5Code(FileUtil.getMD5(file));
|
||||
Picture picture = pictureRepository.findByMd5Code(FileUtil.getMd5(file));
|
||||
if(picture != null){
|
||||
return picture;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class PictureServiceImpl implements PictureService {
|
|||
picture = JSON.parseObject(jsonObject.get("data").toString(), Picture.class);
|
||||
picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize())));
|
||||
picture.setUsername(username);
|
||||
picture.setMd5Code(FileUtil.getMD5(file));
|
||||
picture.setMd5Code(FileUtil.getMd5(file));
|
||||
picture.setFilename(FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename())+"."+FileUtil.getExtensionName(multipartFile.getOriginalFilename()));
|
||||
pictureRepository.save(picture);
|
||||
//删除临时文件
|
||||
|
@ -97,7 +97,6 @@ public class PictureServiceImpl implements PictureService {
|
|||
} catch(Exception e){
|
||||
pictureRepository.delete(picture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.domain.LocalStorage;
|
||||
import me.zhengjie.service.dto.LocalStorageDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @date 2019-09-05
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LocalStorageMapper extends EntityMapper<LocalStorageDTO, LocalStorage> {
|
||||
public interface LocalStorageMapper extends BaseMapper<LocalStorageDTO, LocalStorage> {
|
||||
|
||||
}
|
Loading…
Reference in New Issue