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 lstSysAttachment; public List getLstSysAttachment() { return lstSysAttachment; } public void setLstSysAttachment(List 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; } }