Nutz框架下通知公告 包含Clob的读写

基于 Nutz AceAdmin 的 通知公告 (后台)


思路

通知公告存储于4张表,分别为群组公告(DB_GROUP_NOTICE)、区划公告(DB_REGION_NOTICE)、用户公告(DB_USER_NOTICE)、公告内容(DB_NOTICE_INFO)。关联群组公告和区划公告读取用户公告表,然后根据用户公告表,读取用户公告读取状态。若用户公告表中无数据,或数据为已读状态,均视为改公告已读。

读用户通知公告时,根据用户所在群组、所在区划,关联查询群组公告(DB_GROUP_NOTICE)、区划公告(DB_REGION_NOTICE)读取用户公告列表,然后根据公告内容(DB_NOTICE_INFO)中的信息读取用户通知公告的读取状态。

写公告时,先写入公告内容(DB_NOTICE_INFO),然后再写入群组公告(DB_GROUP_NOTICE)、区划公告(DB_REGION_NOTICE)、用户公告(DB_USER_NOTICE)。

公告内容在数据库中以CLOB存储,在页面上用AceAdmin中的 wysiwyg-editor 编辑。

 


Manage层

主要分为读取用户通知公告,发布/修改通知公告

DbNoticeManager

​
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

import com.alibaba.fastjson.JSONArray;
import com.wonders.biz.fl.common.util.BeanUtils;
import com.wonders.biz.workdesk.model.UserDTO;
import com.wonders.biz.workdesk.service.impl.MenuServiceImpl;
import com.wonders.framework.common.constant.MenuConstant;
import com.wonders.framework.common.notice.entity.DbRegionNotice;
import com.wonders.framework.common.redis.session.constant.SessionConstant;
import com.wonders.framework.common.redis.session.util.RedisSessionUtil;
import org.apache.poi.hssf.record.formula.functions.Int;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Criteria;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.sql.SqlCallback;
import org.nutz.dao.util.Daos;
import org.nutz.dao.util.blob.SimpleClob;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

import com.alibaba.fastjson.JSONObject;
import com.wonders.framework.common.flow.util.FlowHttpUtil;
import com.wonders.framework.common.notice.constants.NoticeContants;
import com.wonders.framework.common.notice.dto.DbNoticeInfoDTO;
import com.wonders.framework.common.notice.entity.DbGroupNotice;
import com.wonders.framework.common.notice.entity.DbNoticeInfo;
import com.wonders.framework.common.notice.entity.DbUserNotice;
import org.nutz.lang.util.NutMap;
import org.nutz.trans.Atom;
import org.nutz.trans.Trans;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.rmi.runtime.Log;


@IocBean
public class DbNoticeManager {
	public static final Logger log = LoggerFactory.getLogger(DbNoticeManager.class);

	@Inject
	private Dao dao;


	/**
	 * 保存 通知公告
	 * @param dbNoticeInfoDTO 通知公告DTO
	 * @param regions 接收区划 Code
	 * @param groups 接收群组(角色) Id
	 * @param token 用户token
	 * @return NutMap格式的数据,key: returnCode, returnString, data
	 * @author shidaoshun
	 * @date 2018-8-8
	 */
	public Object saveNoticeInfoNew(final DbNoticeInfoDTO dbNoticeInfoDTO, final List<String> regions, final List<String> groups, String token) {
		final NutMap nutMap = new NutMap().setv("returnCode", "0").setv("returnString", "notice save error");
        final Set<Long> groupsUserSet = new HashSet<Long>();    //  群组用户set
		final Set<Long> regionUserSet = new HashSet<Long>();    //  区划用户set
		final Set<Long> userSet = new HashSet<Long>();  //  用户set
		final HashMap<Long, Integer> groupsUserMap = new HashMap<>(); //  群组用户map
		final HashMap<Long, Integer> regionUserMap = new HashMap<>(); //  区划用户map
		final DbNoticeInfo dbNoticeInfo = new DbNoticeInfo();
		BeanUtils.copyProperties(dbNoticeInfoDTO, dbNoticeInfo);	// DTO -> DO
		if (dbNoticeInfo == null || regions.isEmpty() || groups.isEmpty() || token==null || token=="") {
			return nutMap.setv("returnCode", "0").setv("returnString", "参数为空");
		}

		//1. 查询群组(角色)包含的用户
		//根据Id获取指定群组用户信息
		if(!groups.isEmpty()) {
			String groupsStr = "";
			for(String group:groups){
				groupsStr+=group+",";
			}
			JSONObject jsonObj = new JSONObject();
			jsonObj.put("userId", dbNoticeInfo.getCreateUserId());
			jsonObj.put("groups", groupsStr.substring(0, groupsStr.length()-1));
			String result = FlowHttpUtil.httpAccess(MenuConstant.GET_USERS_BY_GROUP_IDS, jsonObj, token);		//  调用远程服务读取群组(角色)用户
			net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(result);
			List<String> groupList = (List<String>)jsonObject.get("data");
			System.out.println(groupList);
			for(String group : groupList){
                groupsUserSet.add(Long.parseLong(group));		//群组(角色)用户写入用户set
//				Long id = Long.valueOf(group);
//				if (groupsUserMap.containsKey(id)) {
//					groupsUserMap.put(id, groupsUserMap.get(id) + 1);
//				} else {
//					groupsUserMap.put(id, 1);
//				}
			}
		}
		//根据Code获取指定群组用户信息
//        for (String groupCode : groups) {
//            JSONObject param = new JSONObject();
//            param.put("code", groupCode);
//            String result = FlowHttpUtil.httpAccess(MenuConstant.GET_GROUP_USERS, param, token);    //  调用远程服务读取群组(角色)用户
//            JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
//            List<String> groupUserList = (List<String>)jsonObject.get("data");
//            for (String user : groupUserList) {    //群组(角色)用户写入用户set
//                log.debug(user);
//                userSet.add(Long.valueOf(user));
//            }
//        }

		//2. 查询区划包含的用户 && 获取用户电话号码
		for (String regionCode: regions){
			JSONObject param = new JSONObject();
			param.put("regionCode", regionCode);
			String result = FlowHttpUtil.httpAccess(MenuConstant.FIND_USERS_BY_REGION_CODE, param, token);    //  调用远程服务读取区划用户
			JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
			JSONArray regionUserList = (JSONArray) jsonObject.get("data");
			if (regionUserList != null){
				for (Object jsonObject1: regionUserList) { //  区划用户写入用户set
					JSONObject t = (JSONObject) jsonObject1;
                    regionUserSet.add(Long.valueOf(t.get("id") + ""));
					Long id = Long.valueOf(t.get("id") + "");
					if (regionUserMap.containsKey(id)) {
						regionUserMap.put(id, regionUserMap.get(id) + 1);
					} else {
						regionUserMap.put(id, 1);
					}
					log.debug(t.get("id") + "");
				}
			}
		}

		//3.1 判断两个用户组的交集
		userSet.addAll(regionUserSet);
		userSet.retainAll(groupsUserSet);

		//3.2. 将自己去除。发布人默认已读此通知公告
		userSet.remove(Long.valueOf(dbNoticeInfo.getCreateUserId()));

		//4. 事务操作
		Trans.exec(Connection.TRANSACTION_READ_COMMITTED, new Atom() {
			@Override
			public void run() {

				//4.1 删除原关系。编辑通知公告时,去除原发送对象
				dao.clear(DbUserNotice.class, Cnd.where("noticeId", "=",dbNoticeInfo.getId()));
				dao.clear(DbGroupNotice.class, Cnd.where("noticeId", "=",dbNoticeInfo.getId()));
				dao.clear(DbRegionNotice.class, Cnd.where("noticeId", "=", dbNoticeInfo.getId()));

				//4.2 保存通知公告DTO  dbNoticeInfo
				if (dbNoticeInfo.getId() != null) {
					dao.update(dbNoticeInfo);
				} else {
					dao.insert(dbNoticeInfo);
				}

				//4.3 保存群组通知公告
				for (String groupId : groups) {
					DbGroupNotice dbGroupNotice = new DbGroupNotice();
					dbGroupNotice.setNoticeId(dbNoticeInfo.getId());
					dbGroupNotice.setGroupId(Long.valueOf(groupId));
					dbGroupNotice.setCreateUserId(dbNoticeInfo.getCreateUserId());
					dbGroupNotice.setCreateTime(new Date());
					dao.insert(dbGroupNotice);
				}

				//4.4 保存区划通知公告
				for (String resionCode : regions) {
					DbRegionNotice dbRegionNotice = new DbRegionNotice();
					dbRegionNotice.setNoticeId(dbNoticeInfo.getId());
					dbRegionNotice.setRegionCode(resionCode);
					dbRegionNotice.setCreateUserId(dbNoticeInfo.getCreateUserId());
					dbRegionNotice.setCreateTime(new Date());
					dao.insert(dbRegionNotice);
				}

				//4.5 保存用户通知公告。在用户通知公告表中对每个接收公告的用户都保存一条“未读”状态的记录
				for (Long userId : userSet) {
					DbUserNotice userNotice = new DbUserNotice();
					userNotice.setIsGroup(NoticeContants.YES);
					userNotice.setUserId(userId);
					userNotice.setNoticeId(dbNoticeInfo.getId());
					userNotice.setReadStatus(dbNoticeInfoDTO.getReadStatus());
					userNotice.setTagStatus(NoticeContants.UNTAG);
					userNotice.setCreateUserId(dbNoticeInfo.getCreateUserId());
					userNotice.setCreateTime(new Date());
					dao.insert(userNotice);
				}

				//5. 封装返回值
				nutMap.setv("returnCode", "1").setv("returnString", "notice save success!");
			}
		});
		return nutMap;
	}

	/**
	 * 分页查询通知公告读取情况
	 * 查询条件 : userId : "xxxx"
	 * @param filter 查询条件。 包含userId, token, sessionId, pager
	 * @return JSONObject 格式的数据,key: returnCode, returnString, data
	 * @author shidaoshun
	 */
	public Object queryUserNoticeByPageNew (Map<String, Object> filter) {
		JSONObject result = new JSONObject();
		String userId = (String) filter.get("userId");
		String token = (String) filter.get("token");
		String sessionId = (String) filter.get("sessionId");
		Pager pager = (Pager) filter.get("pager");
		result.put("returnCode", "0");
		result.put("returnString", "query user notice error");

		//1.读取用户所属群组
		//通过远程服务接口 MenuConstant.GET_USER_GROUPS 读取用户群组信息
		JSONObject groupParam = new JSONObject();
		groupParam.put("userId", Long.valueOf("6"));
		String groupResult = FlowHttpUtil.httpAccess(MenuConstant.GET_USER_GROUPS, groupParam, token);    //  调用远程服务
		JSONObject resultJson = (JSONObject) JSONObject.parse(groupResult);
		JSONArray dataJson = (JSONArray) resultJson.get("data");
		Long[] groupsId = new Long[dataJson.size()];
		for (int i=0; i<dataJson.size(); i++) {
			JSONObject rowJson = (JSONObject) dataJson.get(i);
			groupsId[i] = Long.valueOf(rowJson.getString("id"));
		}

		//2. 读取用户区划
		// 通过 redis 读取用户区划信息
		JSONObject regionParam = new JSONObject();
		String regionResult = RedisSessionUtil.getInstance().getSessionString(sessionId, SessionConstant.USER_REGION);	// {"createBy":"1","createDate":"2018-07-14 00:00:00","id":3,"regionNo":"310105000000","updateBy":"","updateDate":null}
		JSONObject regionJson = JSONObject.parseObject(regionResult);
		String region = (String) regionJson.get("regionNo");


		//3. 联合查询用户通知公告的消息
		//3.1 自定义sql
        Sql sqls = Sqls.create("select  NOTICE_ID, USER_ID, NOTICE_TYPE,  NOTICE_SUBJECT, NOTICE_CONTENT, NOTICE_LEVEL, PUBLISH_STATUS, SMS_NOTIFY, ATTACHMENT_ID, PUBLISH_DATE, CANCEL_REASON, CANCEL_DATE, EXT1, EXT2, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, " +
				"  (select max(un.READ_STATUS) " +
				"   from DB_USER_NOTICE un " +
				"   where un.NOTICE_ID = NOTICE_ID " +
				"         and un.USER_ID = @USERID " +
				"  ) AS READ_STATUS " +
				"from ( " +
				"  select NOTICE_ID, info.* " +
				"  from  DB_NOTICE_INFO info, ( " +
				"                               select NOTICE_ID from V_GROUP_REGION_NOTICE " +
				"                               where REGION_CODE in (@REGIONCODE) and GROUP_ID in (@GROUPID) " +
				"                               group by NOTICE_ID " +
				"                             ) infoList " +
				"  where info.ID = infoList.NOTICE_ID " +
				") " +
				"where 1=1 ");

		//3.2参数注入
		sqls.params().set("USERID", userId);
		sqls.params().set("REGIONCODE", Long.valueOf(region));
		// 测试数据
//		Integer[] groups = {10041, 10042, 101, 102, 103, 104, 10022, 10043, 10061, 10001, 10023};
//		sqls.params().set("GROUPID", groups);
		// 正式写法
		sqls.params().set("GROUPID", groupsId);
		sqls.setPager(pager);	//Pager分页

		//3.3 设置回调
		sqls.setCallback(new SqlCallback() {
			@Override
			public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
				List<DbNoticeInfoDTO> list = new ArrayList<>();
				while (rs.next()) {
					DbNoticeInfoDTO dbNoticeInfoDTO = new DbNoticeInfoDTO();
					dbNoticeInfoDTO.setId(rs.getLong("NOTICE_ID1"));
					list.add(dbNoticeInfoDTO);
				}
				return list;
			}
		});
		sqls.setCallback(Sqls.callback.entities());
		sqls.setEntity(dao.getEntity(DbNoticeInfoDTO.class));

		//3.4 读取数据
		dao.execute(sqls);
		List<DbNoticeInfoDTO> dbNoticeInfoDTOList = sqls.getList(DbNoticeInfoDTO.class);

		//4. 封装返回值
		result = new JSONObject();
		result.put("data", dbNoticeInfoDTOList);
		result.put("returnCode", "1");
		result.put("returnString", "");
		return result;
	}
	
}

​

DbNoticeInfo

import java.sql.Clob;
import java.util.Date;

import com.wonders.framework.common.util.ClobUtil;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.util.blob.SimpleClob;


@Table("DB_NOTICE_INFO")
public class DbNoticeInfo {

	@Id
	@Column("ID")
	@Prev({@SQL(value="select SEQ_DB_NOTICE_INFO.nextval FROM dual", db=DB.ORACLE)})
	private Long id; // id

	@Column("USER_ID")
	private Long userId; // businessNo

	@Column("NOTICE_TYPE")
	private String noticeType; // type

	@Column("NOTICE_SUBJECT")
	private String noticeSubject; // noticeSubject

	@Column("NOTICE_CONTENT")
	@ColDefine(type = ColType.TEXT)
	private Clob noticeContent;	// noticeContent

	@Column("NOTICE_LEVEL")
	private String noticeLevel; // noticeLevel

	@Column("PUBLISH_STATUS")
	private String publishStatus; // isPublic

	@Column("SMS_NOTIFY")
	private String smsNotify; // validity

	@Column("ATTACHMENT_ID")
	private String attachmentId; // createDate

	@Column("PUBLISH_DATE")
	private Date publishDate;

	@Column("CANCEL_REASON")
	private String cancelReason;

	@Column("CANCEL_DATE")
	private Date cancelDate;

	@Column("EXT1")
	private String ext1;

	@Column("EXT2")
	private String ext2;

	@Column("CREATE_USER_ID")
	private String createUserId;

	@Column("CREATE_TIME")
	private Date createTime;

	@Column("UPDATE_USER_ID")
	private String updateUserId;

	@Column("UPDATE_TIME")
	private Date updateTime;

	@Column("USER_NAME")
	private String userName;

	@Column("ORGAN_NODE_ID")
	private Long organNodeId;

	@Column("SMS_CONTENT")
	private String smsContent;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getNoticeType() {
		return noticeType;
	}

	public void setNoticeType(String noticeType) {
		this.noticeType = noticeType;
	}

	public String getNoticeSubject() {
		return noticeSubject;
	}

	public void setNoticeSubject(String noticeSubject) {
		this.noticeSubject = noticeSubject;
	}

	public Clob getNoticeContent() {
		return noticeContent;
	}

	public void setNoticeContent(Clob noticeContent) {
		this.noticeContent = noticeContent;
	}

	public String getNoticeLevel() {
		return noticeLevel;
	}

	public void setNoticeLevel(String noticeLevel) {
		this.noticeLevel = noticeLevel;
	}

	public String getPublishStatus() {
		return publishStatus;
	}

	public void setPublishStatus(String publishStatus) {
		this.publishStatus = publishStatus;
	}

	public String getSmsNotify() {
		return smsNotify;
	}

	public void setSmsNotify(String smsNotify) {
		this.smsNotify = smsNotify;
	}

	public String getAttachmentId() {
		return attachmentId;
	}

	public void setAttachmentId(String attachmentId) {
		this.attachmentId = attachmentId;
	}

	public Date getPublishDate() {
		return publishDate;
	}

	public void setPublishDate(Date publishDate) {
		this.publishDate = publishDate;
	}

	public String getCancelReason() {
		return cancelReason;
	}

	public void setCancelReason(String cancelReason) {
		this.cancelReason = cancelReason;
	}

	public Date getCancelDate() {
		return cancelDate;
	}

	public void setCancelDate(Date cancelDate) {
		this.cancelDate = cancelDate;
	}

	public String getExt1() {
		return ext1;
	}

	public void setExt1(String ext1) {
		this.ext1 = ext1;
	}

	public String getExt2() {
		return ext2;
	}

	public void setExt2(String ext2) {
		this.ext2 = ext2;
	}

	public String getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(String createUserId) {
		this.createUserId = createUserId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(String updateUserId) {
		this.updateUserId = updateUserId;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Long getOrganNodeId() {
		return organNodeId;
	}

	public void setOrganNodeId(Long organNodeId) {
		this.organNodeId = organNodeId;
	}

	public String getSmsContent() {
		return smsContent;
	}

	public void setSmsContent(String smsContent) {
		this.smsContent = smsContent;
	}
}

DbGroupNotice

import java.util.Date;

import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Prev;
import org.nutz.dao.entity.annotation.SQL;
import org.nutz.dao.entity.annotation.Table;


@Table("DB_GROUP_NOTICE")
public class DbGroupNotice {

	@Id
	@Prev(@SQL(value="select SEQ_DB_GROUP_NOTICE.nextval from dual", db=DB.ORACLE))
	@Column("ID")
	private Long id;
	
	@Column("NOTICE_ID")
	private Long noticeId;
	
	@Column("GROUP_ID")
	private Long groupId;
	
	@Column("CREATE_USER_ID")
	private String createUserId;
	
	@Column("CREATE_TIME")
	private Date createTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getNoticeId() {
		return noticeId;
	}

	public void setNoticeId(Long noticeId) {
		this.noticeId = noticeId;
	}

	public Long getGroupId() {
		return groupId;
	}

	public void setGroupId(Long groupId) {
		this.groupId = groupId;
	}

	public String getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(String createUserId) {
		this.createUserId = createUserId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	
}

DbRegionNotice

import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;

import java.util.Date;

/**
 * @Auther: shidaoshun
 * @Date: 2018/8/8 09:52
 * @Description: 消息区划关系
 */

@Table("DB_REGION_NOTICE")
public class DbRegionNotice {
    @Id
    @Prev(@SQL(value="select SEQ_DB_REGION_NOTICE.nextval from dual", db=DB.ORACLE))
    @Column("ID")
    private Long id;
    @Column("NOTICE_ID")
    private Long noticeId;
    @Column("REGION_CODE")
    private String regionCode;
    @Column("CREATE_USER_ID")
    private String createUserId;
    @Column("CREATE_TIME")
    private Date createTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getNoticeId() {
        return noticeId;
    }

    public void setNoticeId(Long noticeId) {
        this.noticeId = noticeId;
    }

    public String getRegionCode() {
        return regionCode;
    }

    public void setRegionCode(String regionCode) {
        this.regionCode = regionCode;
    }

    public String getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(String createUserId) {
        this.createUserId = createUserId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

DbUserNotice

import java.util.Date;

import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Prev;
import org.nutz.dao.entity.annotation.SQL;
import org.nutz.dao.entity.annotation.Table;



@Table("DB_USER_NOTICE")
public class DbUserNotice {


	@Id
	@Prev(@SQL(value="select SEQ_DB_USER_NOTICE.nextval from dual", db=DB.ORACLE))
	@Column("ID")
	private Long id; // id

	@Column("USER_ID")
	private Long userId; // userId

	@Column("NOTICE_ID")
	private Long noticeId; // noticeId

	@Column("READ_STATUS")
	private String readStatus;
	
	@Column("IS_GROUP")
	private String isGroup;
	
	@Column("READ_DATE")
	public Date readDate; 

	@Column("TAG_STATUS")
	private String tagStatus; // validity

	@Column("CREATE_USER_ID")
	private String createUserId;
	
	@Column("CREATE_TIME")
	private Date createTime;
	
	@Column("UPDATE_USER_ID")
	private String updateUserId;
	
	@Column("UPDATE_TIME")
	private Date updateTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getNoticeId() {
		return noticeId;
	}

	public void setNoticeId(Long noticeId) {
		this.noticeId = noticeId;
	}

	public String getReadStatus() {
		return readStatus;
	}

	public void setReadStatus(String readStatus) {
		this.readStatus = readStatus;
	}

	public String getIsGroup() {
		return isGroup;
	}

	public void setIsGroup(String isGroup) {
		this.isGroup = isGroup;
	}

	public Date getReadDate() {
		return readDate;
	}

	public void setReadDate(Date readDate) {
		this.readDate = readDate;
	}

	public String getTagStatus() {
		return tagStatus;
	}

	public void setTagStatus(String tagStatus) {
		this.tagStatus = tagStatus;
	}

	public String getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(String createUserId) {
		this.createUserId = createUserId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(String updateUserId) {
		this.updateUserId = updateUserId;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
}

数据库

DB_NOTICE_INFO

create table DB_NOTICE_INFO
(
  ID             NUMBER(19) not null
    constraint PK_DB_NOTICE_INFO
    primary key,
  USER_ID        NUMBER(19),
  NOTICE_TYPE    VARCHAR2(2)   default NULL,
  NOTICE_SUBJECT VARCHAR2(300) default NULL,
  NOTICE_LEVEL   VARCHAR2(2)   default NULL,
  PUBLISH_STATUS VARCHAR2(2)   default NULL,
  SMS_NOTIFY     VARCHAR2(2),
  ATTACHMENT_ID  VARCHAR2(32),
  PUBLISH_DATE   DATE,
  CANCEL_REASON  VARCHAR2(300),
  CANCEL_DATE    DATE,
  EXT1           VARCHAR2(60),
  EXT2           VARCHAR2(60),
  CREATE_USER_ID VARCHAR2(32),
  CREATE_TIME    DATE,
  UPDATE_USER_ID VARCHAR2(32),
  UPDATE_TIME    DATE,
  NOTICE_CONTENT CLOB,
  USER_NAME      VARCHAR2(72),
  ORGAN_NODE_ID  NUMBER(19),
  SMS_CONTENT    VARCHAR2(300)
)
/

comment on table DB_NOTICE_INFO
is '个人首页-个人站内消息表'
/

comment on column DB_NOTICE_INFO.ID
is '消息ID'
/

comment on column DB_NOTICE_INFO.USER_ID
is '发送人主键,外键CS_USER'
/

comment on column DB_NOTICE_INFO.NOTICE_TYPE
is '信息类别代码,[取值 1:公告| 2:通知| 3:系统消息]'
/

comment on column DB_NOTICE_INFO.NOTICE_SUBJECT
is '信息主题'
/

comment on column DB_NOTICE_INFO.NOTICE_LEVEL
is '信息等级代码,[取值 1~9, 等级越高越紧急,在显示时可以用颜色区分]'
/

comment on column DB_NOTICE_INFO.PUBLISH_STATUS
is '是否发布代码,[取值 0 :未发布|1:发布|2:已撤销]'
/

comment on column DB_NOTICE_INFO.SMS_NOTIFY
is '是否短信通知代码,[取值 0 :不需要|1:需要]'
/

comment on column DB_NOTICE_INFO.ATTACHMENT_ID
is '附件表主键ID'
/

comment on column DB_NOTICE_INFO.PUBLISH_DATE
is '发布时间'
/

comment on column DB_NOTICE_INFO.CANCEL_REASON
is '撤销原因'
/

comment on column DB_NOTICE_INFO.CANCEL_DATE
is '撤销时间'
/

comment on column DB_NOTICE_INFO.EXT1
is '扩展信息1'
/

comment on column DB_NOTICE_INFO.EXT2
is '扩展信息2'
/

comment on column DB_NOTICE_INFO.CREATE_USER_ID
is '创建人姓名'
/

comment on column DB_NOTICE_INFO.CREATE_TIME
is '创建时间'
/

comment on column DB_NOTICE_INFO.UPDATE_USER_ID
is '更新人姓名'
/

comment on column DB_NOTICE_INFO.UPDATE_TIME
is '更新时间'
/

comment on column DB_NOTICE_INFO.NOTICE_CONTENT
is '信息内容'
/

comment on column DB_NOTICE_INFO.USER_NAME
is '消息发送人姓名'
/

comment on column DB_NOTICE_INFO.ORGAN_NODE_ID
is '发布部门ID;外键到CS_ORGAN_NODE.ID'
/

comment on column DB_NOTICE_INFO.SMS_CONTENT
is '短信内容'
/

DB_GROUP_NOTICE

create table DB_GROUP_NOTICE
(
  ID             NUMBER(19) default NULL not null
    constraint PK_DB_GROUP_NOTICE
    primary key,
  NOTICE_ID      NUMBER(19) default NULL
    constraint FK_DB_GROUP_FK_GROUP_DB_NOTIC
    references DB_NOTICE_INFO,
  GROUP_ID       NUMBER(19),
  CREATE_USER_ID VARCHAR2(32),
  CREATE_TIME    DATE
)
/

comment on table DB_GROUP_NOTICE
is '个人首页-消息群组关系表'
/

comment on column DB_GROUP_NOTICE.ID
is '消息群组关系ID[主键]'
/

comment on column DB_GROUP_NOTICE.NOTICE_ID
is '公告信息ID,外键DB_NOTICE_INFO'
/

comment on column DB_GROUP_NOTICE.GROUP_ID
is '消息接受群组ID'
/

comment on column DB_GROUP_NOTICE.CREATE_USER_ID
is '创建人姓名'
/

comment on column DB_GROUP_NOTICE.CREATE_TIME
is '创建时间'
/

DB_REGION_NOTICE

create table DB_REGION_NOTICE
(
  ID             NUMBER(19) not null
    constraint PK_DB_NOTICE_REGION
    primary key,
  NOTICE_ID      NUMBER(19)
    constraint FK_DB_NOTIC_REFERENCE_DB_NOTIC
    references DB_NOTICE_INFO,
  REGION_CODE    VARCHAR2(12),
  CREATE_USER_ID VARCHAR2(32),
  CREATE_TIME    DATE
)
/

comment on table DB_REGION_NOTICE
is '个人首页-消息区划关系表'
/

comment on column DB_REGION_NOTICE.ID
is '消息区划关系ID[主键]'
/

comment on column DB_REGION_NOTICE.NOTICE_ID
is '消息ID[外键]'
/

comment on column DB_REGION_NOTICE.REGION_CODE
is '消息接受区划代码,外键到DC_REGION.CODE'
/

comment on column DB_REGION_NOTICE.CREATE_USER_ID
is '创建人姓名'
/

comment on column DB_REGION_NOTICE.CREATE_TIME
is '创建时间'
/

DB_USER_NOTICE

create table DB_USER_NOTICE
(
  ID             NUMBER(19) not null
    constraint PK_DB_USER_NOTICE
    primary key,
  NOTICE_ID      NUMBER(19)  default NULL
    constraint FK_DB_USER_FK_USER_N_DB_NOTIC
    references DB_NOTICE_INFO,
  USER_ID        NUMBER(19)  default NULL,
  READ_STATUS    VARCHAR2(2) default NULL,
  READ_DATE      DATE,
  TAG_STATUS     VARCHAR2(2),
  CREATE_USER_ID VARCHAR2(32),
  CREATE_TIME    DATE,
  UPDATE_USER_ID VARCHAR2(32),
  UPDATE_TIME    DATE,
  IS_GROUP       VARCHAR2(2)
)
/

comment on table DB_USER_NOTICE
is '个人首页-消息人员关系表
'
/

comment on column DB_USER_NOTICE.ID
is '消息关系ID[主键]'
/

comment on column DB_USER_NOTICE.NOTICE_ID
is '公告信息ID,外键DB_NOTICE_INFO'
/

comment on column DB_USER_NOTICE.USER_ID
is '用户ID,外键CS_USER'
/

comment on column DB_USER_NOTICE.READ_STATUS
is '读取状态代码,[取值 1:是|0:否],DIC=YESNO'
/

comment on column DB_USER_NOTICE.READ_DATE
is '读取时间'
/

comment on column DB_USER_NOTICE.TAG_STATUS
is '标记状态代码,[取值 0:未标记|1:标记为未读 | 2:标记为日程]'
/

comment on column DB_USER_NOTICE.CREATE_USER_ID
is '创建人姓名'
/

comment on column DB_USER_NOTICE.CREATE_TIME
is '创建时间'
/

comment on column DB_USER_NOTICE.UPDATE_USER_ID
is '更新人姓名'
/

comment on column DB_USER_NOTICE.UPDATE_TIME
is '更新时间'
/

comment on column DB_USER_NOTICE.IS_GROUP
is '是否来自群组,如果既属于个人同时又属于群组,则记录否;取值DIC=YESNO'
/

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值