package com.qxueyou.scc.notice.model;
|
|
import java.io.Serializable;
|
import java.util.Date;
|
import java.util.List;
|
|
import javax.persistence.CascadeType;
|
import javax.persistence.Column;
|
import javax.persistence.Entity;
|
import javax.persistence.FetchType;
|
import javax.persistence.GeneratedValue;
|
import javax.persistence.Id;
|
import javax.persistence.JoinColumn;
|
import javax.persistence.NamedQuery;
|
import javax.persistence.OneToMany;
|
import javax.persistence.Table;
|
import javax.persistence.Transient;
|
|
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.Where;
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import com.qxueyou.scc.base.model.ITrace;
|
import com.qxueyou.scc.sys.model.SysAttachment;
|
|
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModelProperty;
|
/**
|
* The persistent class for the notice database table.
|
*
|
*/
|
@ApiModel
|
@Entity
|
@Table(name = "notice")
|
@NamedQuery(name = "Notice.findAll", query = "SELECT n FROM Notice n")
|
public class Notice implements Serializable, ITrace {
|
private static final long serialVersionUID = 1L;
|
|
/** 主键 */
|
@Id
|
@GeneratedValue(generator = "hibernate-uuid")
|
@GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
|
@Column(name = "NOTICE_ID", unique = true, nullable = false, length = 32)
|
private String noticeId;
|
|
/** 内容 */
|
@ApiModelProperty(value="内容",name="content")
|
@Column(name = "CONTENT", columnDefinition = "CLOB")
|
private String content;
|
|
/** 简介 */
|
@ApiModelProperty(value="简介",name="brief")
|
@Column(name = "BRIEF", length = 255)
|
private String brief;
|
|
/** 创建者ID */
|
@Column(name = "CREATE_ID", nullable = false, length = 32)
|
private String createId;
|
|
/** 创建时间 */
|
|
@Column(name = "CREATE_TIME", nullable = false)
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
private Date createTime;
|
|
/** 创建者 */
|
@Column(name = "CREATOR", nullable = false, length = 100)
|
private String creator;
|
|
/** 删除标志 */
|
@Column(name = "DELETE_FLAG", nullable = false)
|
private boolean deleteFlag;
|
|
/** 通知范围 1:班级通知 ;0: 平台通知 */
|
@Column(name = "NOTICE_SCOPE")
|
private int noticeScope;
|
|
/** 通知图标路径 */
|
@ApiModelProperty(value="通知图标路径",name="imgPath")
|
@Column(name = "IMG_PATH")
|
private String imgPath;
|
|
/*
|
* 班级通知
|
*/
|
public static int NOTICE_SCOPE_CLASS = 1;
|
|
/*
|
* 平台通知
|
*/
|
public static int NOTICE_SCOPE_ORG = 0;
|
|
public static String NOTICE_CLASS_MSG_USER_ID = "notice-class";
|
|
public static String NOTICE_ORG_MSG_USER_ID = "notice-org";
|
|
public static String NOTICE_SYS_MSG = "sys_msg";
|
|
public static String SYS_MSG_NAME = "系统消息";
|
|
/** 通知类型:1:平台通知 0:课程通知 */
|
@ApiModelProperty(value="通知类型",name="noticeType",example="0平台通知,1课程通知,3信息发布,4其他通知,5活动通知")
|
@Column(name = "NOTICE_TYPE")
|
private int noticeType;
|
|
/*
|
* 平台通知
|
*/
|
public static int NOTICE_TYPE_TERRACE = 0;
|
|
/*
|
* 课程通知
|
*/
|
public static int NOTICE_TYPE_COURSES = 1;
|
|
/*
|
* 信息发布
|
*/
|
public static int NOTICE_TYPE_INF = 3;
|
|
/*
|
* 其他通知
|
*/
|
public static int NOTICE_TYPE_OTHER = 4;
|
|
/*
|
* 其他通知
|
*/
|
public static int NOTICE_TYPE_ACTIVE = 5;
|
|
/*
|
* 平台通知
|
*/
|
public static String NOTICE_TYPE_NAME_TERRACE = "平台通知";
|
|
/*
|
* 上课通知
|
*/
|
public static String NOTICE_TYPE_NAME_COURSES = "课程通知";
|
|
/*
|
* 信息发布
|
*/
|
public static String NOTICE_TYPE_NAME_INF = "信息发布";
|
|
/*
|
* 信息发布
|
*/
|
public static String NOTICE_TYPE_NAME_OTHER = "其他通知";
|
|
/*
|
* 信息发布
|
*/
|
public static String NOTICE_TYPE_NAME_ACTIVE = "活动通知";
|
|
/** 通知类型名称 */
|
@ApiModelProperty(value="通知类型名称",name="noticeTypeName",example="平台通知,课程通知,信息发布,其他通知,活动通知")
|
@Column(name = "NOTICE_TYPE_NAME", length = 150)
|
private String noticeTypeName;
|
|
/** 范围ID:平台通知:机构ID 班级通知:班级ID */
|
@ApiModelProperty(value="范围ID",name="scopeId",example="平台通知:机构ID 班级通知:班级ID")
|
@Column(name = "SCOPE_ID")
|
private String scopeId;
|
|
@ApiModelProperty(value="状态",name="status",example="0 草稿 1已发布 2已废弃")
|
/** 状态: 0 草稿 1已发布 2已废弃 */
|
@Column(name = "STATUS", length = 32)
|
private short status;
|
|
/*
|
* 草稿
|
*/
|
public static short STATUS_DRAFT = 0;
|
|
/*
|
* 已发布
|
*/
|
public static short STATUS_ISSUED = 1;
|
|
/*
|
* 已废弃
|
*/
|
public static short STATUS_DISCARD = 2;
|
|
/** 标题 */
|
@ApiModelProperty(value="标题",name="title")
|
@Column(name = "TITLE", length = 255)
|
private String title;
|
|
/** 修改人ID */
|
@Column(name = "UPDATE_ID", length = 32)
|
private String updateId;
|
|
/** 修改时间 */
|
@Column(name = "UPDATE_TIME", nullable = false)
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
private Date updateTime;
|
|
/** 修改人 */
|
@Column(name = "UPDATOR", length = 100)
|
private String updator;
|
|
/** 浏览总次数:一人可以多次 */
|
@ApiModelProperty(value="浏览总次数",name="viewCount",example="一人可以多次")
|
@Column(name = "VIEW_COUNT")
|
private int viewCount;
|
|
/** 发布时间 */
|
@ApiModelProperty(value="发布时间",name="issuedTime")
|
@Column(name = "ISSUED_TIME")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
private Date issuedTime;
|
|
/** 浏览总人次:一人记录一次 */
|
@ApiModelProperty(value="浏览总人次",name="viwerCount",example="一人记录一次")
|
@Column(name = "VIWER_COUNT")
|
private int viwerCount;
|
|
@Transient
|
private Integer totalPeople;
|
|
@Transient
|
private Integer arrivePeople;
|
|
@Transient
|
private Integer readPeople;
|
|
|
|
|
@OneToMany(cascade=CascadeType.ALL ,fetch = FetchType.LAZY)
|
@JoinColumn(name = "REALATED_OBJECT_ID", referencedColumnName = "NOTICE_ID", updatable = false, insertable = false)
|
@Where(clause="DELETE_FLAG=0")
|
private List<SysAttachment> lstSysAttachment;
|
|
public List<SysAttachment> getLstSysAttachment() {
|
return lstSysAttachment;
|
}
|
|
public void setLstSysAttachment(List<SysAttachment> lstSysAttachment) {
|
this.lstSysAttachment = lstSysAttachment;
|
}
|
|
|
|
|
public Date getIssuedTime() {
|
return issuedTime;
|
}
|
|
public void setIssuedTime(Date issuedTime) {
|
this.issuedTime = issuedTime;
|
}
|
|
public String getNoticeId() {
|
return this.noticeId;
|
}
|
|
public void setNoticeId(String noticeId) {
|
this.noticeId = noticeId;
|
}
|
|
public String getContent() {
|
return this.content;
|
}
|
|
public void setContent(String content) {
|
this.content = content;
|
}
|
|
public String getCreateId() {
|
return this.createId;
|
}
|
|
public void setCreateId(String createId) {
|
this.createId = createId;
|
}
|
|
public Date getCreateTime() {
|
return this.createTime;
|
}
|
|
public void setCreateTime(Date createTime) {
|
this.createTime = createTime;
|
}
|
|
public String getCreator() {
|
return this.creator;
|
}
|
|
public void setCreator(String creator) {
|
this.creator = creator;
|
}
|
|
public boolean getDeleteFlag() {
|
return this.deleteFlag;
|
}
|
|
public void setDeleteFlag(boolean deleteFlag) {
|
this.deleteFlag = deleteFlag;
|
}
|
|
public int getNoticeScope() {
|
return this.noticeScope;
|
}
|
|
public void setNoticeScope(int noticeScope) {
|
this.noticeScope = noticeScope;
|
}
|
|
public int getNoticeType() {
|
return this.noticeType;
|
}
|
|
public void setNoticeType(int noticeType) {
|
this.noticeType = noticeType;
|
|
switch (noticeType) {
|
|
case 1: {
|
setNoticeTypeName(NOTICE_TYPE_NAME_TERRACE);
|
break;
|
}
|
case 2: {
|
setNoticeTypeName(NOTICE_TYPE_NAME_COURSES);
|
break;
|
}
|
case 3: {
|
setNoticeTypeName(NOTICE_TYPE_NAME_INF);
|
break;
|
}
|
case 4: {
|
setNoticeTypeName(NOTICE_TYPE_NAME_OTHER);
|
break;
|
}
|
case 5: {
|
setNoticeTypeName(NOTICE_TYPE_NAME_ACTIVE);
|
break;
|
}
|
|
}
|
}
|
|
public String getNoticeTypeName() {
|
return this.noticeTypeName;
|
}
|
|
public void setNoticeTypeName(String noticeTypeName) {
|
this.noticeTypeName = noticeTypeName;
|
}
|
|
public String getScopeId() {
|
return this.scopeId;
|
}
|
|
public void setScopeId(String scopeId) {
|
this.scopeId = scopeId;
|
}
|
|
public short getStatus() {
|
return this.status;
|
}
|
|
public void setStatus(short status) {
|
this.status = status;
|
}
|
|
public String getTitle() {
|
return this.title;
|
}
|
|
public void setTitle(String title) {
|
this.title = title;
|
}
|
|
public String getUpdateId() {
|
return this.updateId;
|
}
|
|
public void setUpdateId(String updateId) {
|
this.updateId = updateId;
|
}
|
|
public Date getUpdateTime() {
|
return this.updateTime;
|
}
|
|
public void setUpdateTime(Date updateTime) {
|
this.updateTime = updateTime;
|
}
|
|
public String getUpdator() {
|
return this.updator;
|
}
|
|
public void setUpdator(String updator) {
|
this.updator = updator;
|
}
|
|
public int getViewCount() {
|
return viewCount;
|
}
|
|
public void setViewCount(int viewCount) {
|
this.viewCount = viewCount;
|
}
|
|
public int getViwerCount() {
|
return viwerCount;
|
}
|
|
public void setViwerCount(int viwerCount) {
|
this.viwerCount = viwerCount;
|
}
|
|
public String getImgPath() {
|
return imgPath;
|
}
|
|
public void setImgPath(String imgPath) {
|
this.imgPath = imgPath;
|
}
|
|
public Integer getTotalPeople() {
|
return totalPeople;
|
}
|
|
public void setTotalPeople(Integer totalPeople) {
|
this.totalPeople = totalPeople;
|
}
|
|
public Integer getArrivePeople() {
|
return arrivePeople;
|
}
|
|
public void setArrivePeople(Integer arrivePeople) {
|
this.arrivePeople = arrivePeople;
|
}
|
|
public Integer getReadPeople() {
|
return readPeople;
|
}
|
|
public void setReadPeople(Integer readPeople) {
|
this.readPeople = readPeople;
|
}
|
|
public String getBrief() {
|
return brief;
|
}
|
|
public void setBrief(String brief) {
|
this.brief = brief;
|
}
|
|
/**
|
* 返回不包含content的所有字段
|
*
|
* @return
|
*/
|
public static String getColumnsWithOutContent() {
|
StringBuilder buf = new StringBuilder(120);
|
buf.append("noticeId,");
|
buf.append("createId,");
|
buf.append("createTime,");
|
buf.append("creator,");
|
buf.append("deleteFlag,");
|
buf.append("noticeScope,");
|
buf.append("noticeType,");
|
buf.append("noticeTypeName,");
|
buf.append("scopeId,");
|
buf.append("status,");
|
buf.append("title,");
|
buf.append("brief,");
|
buf.append("updateId,");
|
buf.append("updateTime,");
|
buf.append("updator,");
|
buf.append("viewCount,");
|
buf.append("viwerCount");
|
return buf.toString();
|
}
|
|
/**
|
* 返回不包含content的所有字段
|
*
|
* @return
|
*/
|
public static String getPrefixColumnsWithOutContent() {
|
StringBuilder buf = new StringBuilder(120);
|
buf.append("n.NOTICE_ID AS noticeId,");
|
buf.append("n.CREATE_ID AS createId,");
|
buf.append("n.CREATE_TIME AS createTime,");
|
buf.append("n.CREATOR AS creator,");
|
buf.append("n.NOTICE_SCOPE AS noticeScope,");
|
buf.append("n.NOTICE_TYPE AS noticeType,");
|
buf.append("n.NOTICE_TYPE_NAME AS noticeTypeName,");
|
buf.append("n.SCOPE_ID AS scopeId,");
|
buf.append("n.STATUS AS status,");
|
buf.append("n.TITLE AS title,");
|
buf.append("n.BRIEF AS brief,");
|
buf.append("n.UPDATE_ID AS updateId,");
|
buf.append("n.UPDATE_TIME AS updateTime,");
|
buf.append("n.UPDATOR AS updator,");
|
buf.append("n.VIEW_COUNT AS viewCount,");
|
buf.append("n.VIWER_COUNT AS viwerCount");
|
return buf.toString();
|
}
|
|
/**
|
* 返回不包含content的所有字段
|
*
|
* @return
|
*/
|
public static Notice fromObject(Object[] objs) {
|
|
Notice notice = new Notice();
|
|
notice.setNoticeId((String) objs[0]);
|
notice.setCreateId((String) objs[1]);
|
notice.setCreateTime((Date) objs[2]);
|
notice.setCreator((String) objs[3]);
|
notice.setDeleteFlag((Boolean) objs[4]);
|
notice.setNoticeScope((Integer) objs[5]);
|
notice.setNoticeType((Integer) objs[6]);
|
notice.setNoticeTypeName((String) objs[7]);
|
notice.setScopeId((String) objs[8]);
|
notice.setStatus((Short) objs[9]);
|
notice.setTitle((String) objs[10]);
|
notice.setBrief((String) objs[11]);
|
notice.setUpdateId((String) objs[12]);
|
notice.setUpdateTime((Date) objs[13]);
|
notice.setUpdator((String) objs[14]);
|
notice.setViewCount((Integer) objs[15]);
|
notice.setViwerCount((Integer) objs[16]);
|
notice.setTotalPeople((Integer) objs[17]);
|
notice.setArrivePeople((Integer) objs[18]);
|
notice.setReadPeople((Integer) objs[19]);
|
return notice;
|
}
|
|
}
|