gitlink-notification-system/model/src/main/java/resources/mapper/notification/OperateTableMapper.xml

27 lines
1.2 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.org.gitlink.notification.model.dao.mapper.OperateTableMapper" >
<select id="existTable" parameterType="String" resultType="Integer">
select count(*)
from information_schema.TABLES
where LCASE(table_name)= #{tableName}
</select>
<update id="dropTable">
DROP TABLE IF EXISTS ${tableName}_sys_notification
</update>
<update id="createNewTable" parameterType="String">
CREATE TABLE ${tableName}_sys_notification (
`id` int NOT NULL AUTO_INCREMENT,
`sender` int NOT NULL COMMENT '发送者id',
`receiver` int NOT NULL COMMENT '接受者id',
`content` text NOT NULL COMMENT '消息内容',
`notifacation_url` varchar(255) DEFAULT NULL COMMENT '消息跳转url',
`created_at` datetime DEFAULT NULL COMMENT '创建时间',
`status` tinyint(4) NOT NULL COMMENT '消息状态1-未读2-已读3-未删除4-已删除',
PRIMARY KEY (`id`),
KEY `index_on_receiver_and_status` (`receiver`,`status`),
KEY `index_on_status` (`status`))
</update>
</mapper>