Browse Source

Add IdEntity

deason 6 năm trước cách đây
mục cha
commit
22845af750

+ 96 - 109
examcloud-core-questions-dao/src/main/java/cn/com/qmth/examcloud/core/questions/dao/entity/CourseProperty.java

@@ -1,120 +1,107 @@
 package cn.com.qmth.examcloud.core.questions.dao.entity;
 
-import java.io.Serializable;
+import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyDto;
 
 import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 
-import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyDto;
-
 /**
- * @describle 课程属性
  * @author weiwenhai
- * @date   2017.11.2
+ * @describle 课程属性
+ * @date 2017.11.2
  */
 @Entity
-@Table(name ="ecs_ques_course_property")
-public class CourseProperty implements Serializable{
-
-	private static final long serialVersionUID = 3370756666063937765L;
-
-	@Id
-	@GeneratedValue
-	private Long id;
-	
-	@NotNull
-	private String name;
-	
-	@NotNull
-	private Long courseId;
-	
-	@NotNull
-	private Long orgId;
-	
-	private String courseCode;
-	
-	private Boolean enable;
-	
-	private String courseName;
-
-	public CourseProperty(){}
-	
-	public CourseProperty(CoursePropertyDto coursePropertyDto){
-		this.id = coursePropertyDto.getId();
-		this.name = coursePropertyDto.getName();
-		this.courseId = coursePropertyDto.getCourseId();
-		this.orgId = coursePropertyDto.getOrgId();
-		this.courseCode = coursePropertyDto.getCourseCode();
-		if(coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("0")){
-			this.enable = false;
-		}else if(coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("1")){
-			this.enable = true;
-		}else {
-			this.enable = null;
-		}
-	}
-	
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Long getCourseId() {
-		return courseId;
-	}
-
-	public void setCourseId(Long courseId) {
-		this.courseId = courseId;
-	}
-
-	public Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	public static long getSerialversionuid() {
-		return serialVersionUID;
-	}
-
-	public Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-
-	public String getCourseCode() {
-		return courseCode;
-	}
-
-	public void setCourseCode(String courseCode) {
-		this.courseCode = courseCode;
-	}
-
-	public String getCourseName() {
-		return courseName;
-	}
-
-	public void setCourseName(String courseName) {
-		this.courseName = courseName;
-	}
-	
-}
+@Table(name = "ecs_ques_course_property")
+public class CourseProperty extends IdEntity {
+    @NotNull
+    private String name;
+
+    @NotNull
+    private Long courseId;
+
+    @NotNull
+    private Long orgId;
+
+    private String courseCode;
+
+    private Boolean enable;
+
+    private String courseName;
+
+    public CourseProperty() {
+
+    }
+
+    public CourseProperty(CoursePropertyDto coursePropertyDto) {
+        this.id = coursePropertyDto.getId();
+        this.name = coursePropertyDto.getName();
+        this.courseId = coursePropertyDto.getCourseId();
+        this.orgId = coursePropertyDto.getOrgId();
+        this.courseCode = coursePropertyDto.getCourseCode();
+        if (coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("0")) {
+            this.enable = false;
+        } else if (coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("1")) {
+            this.enable = true;
+        } else {
+            this.enable = null;
+        }
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Long courseId) {
+        this.courseId = courseId;
+    }
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+}

+ 38 - 0
examcloud-core-questions-dao/src/main/java/cn/com/qmth/examcloud/core/questions/dao/entity/IdEntity.java

@@ -0,0 +1,38 @@
+/*
+ * *************************************************
+ * Copyright (c) 2019 QMTH. All Rights Reserved.
+ * Created by Deason on 2019-05-05 09:58:45.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.questions.dao.entity;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import java.io.Serializable;
+
+/**
+ * MySql 自增ID
+ *
+ * @author: fengdesheng
+ * @since: 2019/5/5
+ */
+@MappedSuperclass
+public abstract class IdEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    protected Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+}

+ 97 - 111
examcloud-core-questions-dao/src/main/java/cn/com/qmth/examcloud/core/questions/dao/entity/Property.java

@@ -1,123 +1,109 @@
 package cn.com.qmth.examcloud.core.questions.dao.entity;
 
-import java.io.Serializable;
+import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PropertyDto;
 
 import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 
-import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PropertyDto;
 /**
- * @describle  属性 
  * @author weiwenhai
- * @date   2017.11.6
+ * @describle 属性
+ * @date 2017.11.6
  */
 @Entity
 @Table(name = "ecs_ques_property")
-public class Property implements Serializable{
-
-	private static final long serialVersionUID = -417218505125002677L;
-	
-	@Id
-	@GeneratedValue
-	private Long id;
-	
-	@NotNull
-	private String name;
-	
-	@NotNull
-	private Long parentId;
-	
-	@NotNull
-	private Integer number;//序号
-	
-	@NotNull
-	private Long coursePropertyId;
-	
-	private String remark;
-	
-	@NotNull
-	private Long orgId;
-	
-	public Property(){
-		
-	}
-	
-	public Property(PropertyDto propertyDto){
-		this.id = propertyDto.getId();
-		this.name = propertyDto.getName();
-		this.parentId = propertyDto.getParentId();
-		this.number = propertyDto.getNumber();
-		this.coursePropertyId = propertyDto.getCoursePropertyId();
-		this.remark = propertyDto.getRemark();
-	}
-	
-	public Property(String name,Long parentId,Long coursePropertyId){
-		this.name = name;
-		this.parentId = parentId;
-		this.coursePropertyId = coursePropertyId;
-	}
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Long getParentId() {
-		return parentId;
-	}
-
-	public void setParentId(Long parentId) {
-		this.parentId = parentId;
-	}
-
-	public Integer getNumber() {
-		return number;
-	}
-
-	public void setNumber(Integer number) {
-		this.number = number;
-	}
-
-	public Long getCoursePropertyId() {
-		return coursePropertyId;
-	}
-
-	public void setCoursePropertyId(Long coursePropertyId) {
-		this.coursePropertyId = coursePropertyId;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	public Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	public static long getSerialversionuid() {
-		return serialVersionUID;
-	}
-	
-}
+public class Property extends IdEntity {
+    @NotNull
+    private String name;
+
+    @NotNull
+    private Long parentId;
+
+    @NotNull
+    private Integer number;//序号
+
+    @NotNull
+    private Long coursePropertyId;
+
+    private String remark;
+
+    @NotNull
+    private Long orgId;
+
+    public Property() {
+
+    }
+
+    public Property(PropertyDto propertyDto) {
+        this.id = propertyDto.getId();
+        this.name = propertyDto.getName();
+        this.parentId = propertyDto.getParentId();
+        this.number = propertyDto.getNumber();
+        this.coursePropertyId = propertyDto.getCoursePropertyId();
+        this.remark = propertyDto.getRemark();
+    }
+
+    public Property(String name, Long parentId, Long coursePropertyId) {
+        this.name = name;
+        this.parentId = parentId;
+        this.coursePropertyId = coursePropertyId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Long getCoursePropertyId() {
+        return coursePropertyId;
+    }
+
+    public void setCoursePropertyId(Long coursePropertyId) {
+        this.coursePropertyId = coursePropertyId;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+
+}