CREATE TABLE IF NOT EXISTS `im_notice` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `notice_id` char(36) DEFAULT NULL COMMENT '主键', `notice_title` varchar(255) DEFAULT NULL COMMENT '通知标题', `notice_msg` varchar(500) DEFAULT NULL COMMENT '通知内容', `notice_target` varchar(255) DEFAULT NULL COMMENT '通知触发目标', `notice_system` varchar(255) DEFAULT NULL COMMENT '通知业务系统', `notice_module` varchar(255) DEFAULT NULL COMMENT '通知业务模块', `notice_menu` varchar(255) DEFAULT NULL COMMENT '通知业务菜单', `notice_service_id` varchar(255) DEFAULT NULL COMMENT '通知业务ID', `user_id` char(36) DEFAULT NULL COMMENT '通知人', `user_username` varchar(255) DEFAULT NULL COMMENT '用户名', `user_name` varchar(255) DEFAULT NULL COMMENT '用户昵称', `is_send` int(1) DEFAULT '0' COMMENT '是否发送', `is_handle` int(1) DEFAULT '0' COMMENT '是否处理', `gmt_create` datetime DEFAULT NULL COMMENT '创建时间', `creator` char(36) DEFAULT NULL COMMENT '创建人', `gmt_modified` datetime DEFAULT NULL COMMENT '修改时间', `modifier` char(36) DEFAULT NULL COMMENT '修改人', `is_delete` int(1) DEFAULT '0' COMMENT '是否删除', PRIMARY KEY (`id`), UNIQUE KEY `notice_id` (`notice_id`) USING BTREE, KEY `notice_title` (`notice_title`) USING BTREE, KEY `notice_msg` (`notice_msg`) USING BTREE, KEY `notice_target` (`notice_target`) USING BTREE, KEY `notice_module` (`notice_module`) USING BTREE, KEY `notice_service_id` (`notice_service_id`) USING BTREE, KEY `user_id` (`user_id`) USING BTREE, KEY `is_handle` (`is_handle`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='小程序用户';
INSERT INTO im_notice ( notice_id, notice_title, notice_msg, notice_target, notice_system, notice_module, notice_menu, notice_service_id, user_id, user_name, user_username, is_send, is_handle, gmt_create, creator, gmt_modified, modifier, is_delete ) VALUES( #{noticeId}, #{noticeTitle}, #{noticeMsg}, #{noticeTarget}, #{noticeSystem}, #{noticeModule}, #{noticeMenu}, #{noticeServiceId}, #{userId}, #{userName}, #{userUsername}, #{isSend}, #{isHandle}, #{gmtCreate}, #{creator}, #{gmtModified}, #{modifier}, #{isDelete} )
UPDATE im_notice SET is_handle = #{isHandle}, gmt_modified = #{gmtModified}, modifier = #{modifier} WHERE notice_system = #{noticeSystem} AND notice_service_id = #{noticeServiceId}
UPDATE im_notice SET is_send = #{isSend}, gmt_modified = #{gmtModified}, modifier = #{modifier} WHERE notice_id = #{noticeId}
DELETE FROM im_notice WHERE notice_service_id IN #{serviceIds[${index}]}
UPDATE im_notice SET is_delete = 1, gmt_modified = #{gmtModified}, modifier = #{modifier} WHERE notice_id IN #{noticeIds[${index}]}
SELECT notice_id, notice_title, notice_msg, notice_target, notice_system, notice_module, notice_menu, notice_service_id, user_id, user_name, user_username, is_send, is_handle, gmt_create, creator, gmt_modified, modifier, is_delete FROM im_notice WHERE is_delete = 0 AND notice_id = #{noticeId} AND notice_system = #{noticeSystem} AND notice_module = #{noticeModule} AND notice_menu = #{noticeMenu} AND notice_service_id = #{noticeServiceId} AND user_id = #{userId}
SELECT notice_id, notice_title, notice_msg, notice_target, notice_system, notice_module, notice_menu, notice_service_id, user_id, user_name, user_username, is_send, is_handle, gmt_create, creator, gmt_modified, modifier, is_delete FROM im_notice WHERE is_delete = 0 AND notice_system = #{noticeSystem} AND notice_module = #{noticeModule} AND notice_menu = #{noticeMenu} AND notice_service_id = #{noticeServiceId} AND user_id = #{userId} AND is_send = #{isSend} AND is_handle = #{isHandle} AND notice_service_id = #{serviceId} AND LEFT(gmt_create, 10) = #{date} AND notice_service_id IN #{serviceIds[${index}]} AND LEFT(gmt_create, 10) >= #{startTime} AND LEFT(gmt_create, 10) <= #{endTime}
SELECT notice_id, notice_title, notice_msg, notice_target, notice_system, notice_module, notice_menu, notice_service_id, user_id, user_name, user_username, is_send, is_handle, LEFT(gmt_create, 19) gmt_create, LEFT(gmt_modified, 19) gmt_modified FROM im_notice WHERE is_delete = 0 AND ( user_name LIKE CONCAT('%', #{keywords}, '%') OR user_username LIKE CONCAT('%', #{keywords}, '%') OR notice_title LIKE CONCAT('%', #{keywords}, '%') OR notice_msg LIKE CONCAT('%', #{keywords}, '%') ) AND notice_system = #{noticeSystem} AND notice_module = #{noticeModule} AND notice_menu = #{noticeMenu} AND notice_service_id = #{noticeServiceId} AND user_id = #{userId} AND is_handle = #{isHandle} AND notice_service_id = #{serviceId} AND notice_service_id IN #{serviceIds[${index}]} AND LEFT(gmt_create, 10) >= #{startTime} AND LEFT(gmt_create, 10) <= #{endTime}
SELECT notice_system FROM im_notice WHERE is_delete = 0 AND user_id = #{userId} GROUP BY notice_system
SELECT notice_module FROM im_notice WHERE is_delete = 0 AND user_id = #{userId}`` AND notice_system = #{noticeSystem} GROUP BY notice_module
SELECT notice_menu FROM im_notice WHERE is_delete = 0 AND user_id = #{userId} AND notice_system = #{noticeSystem} AND notice_module = #{noticeModule} GROUP BY notice_menu
SELECT COUNT(*) FROM im_notice WHERE is_delete = 0 AND user_id = #{userId} AND notice_system = #{noticeSystem} AND notice_module = #{noticeModule} AND notice_menu = #{noticeMenu} AND is_handle = #{isHandle}