317 lines
10 KiB
XML
317 lines
10 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="ink.wgink.module.instantmessage.dao.INoticeDao">
|
||
|
|
||
|
<cache flushInterval="3600000"/>
|
||
|
|
||
|
<resultMap id="noticePO" type="ink.wgink.module.instantmessage.pojo.pos.NoticePO">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="notice_id" property="noticeId"/>
|
||
|
<result column="notice_title" property="noticeTitle"/>
|
||
|
<result column="notice_msg" property="noticeMsg"/>
|
||
|
<result column="notice_target" property="noticeTarget"/>
|
||
|
<result column="notice_system" property="noticeSystem"/>
|
||
|
<result column="notice_module" property="noticeModule"/>
|
||
|
<result column="notice_menu" property="noticeMenu"/>
|
||
|
<result column="notice_service_id" property="noticeServiceId"/>
|
||
|
<result column="user_id" property="userId"/>
|
||
|
<result column="is_handle" property="isHandle"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
<result column="creator" property="creator"/>
|
||
|
<result column="gmt_modified" property="gmtModified"/>
|
||
|
<result column="modifier" property="modifier"/>
|
||
|
<result column="is_delete" property="isDelete"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<!-- 建表 -->
|
||
|
<update id="createTable">
|
||
|
CREATE TABLE IF NOT EXISTS `socket_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(255) 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_service_id` varchar(255) DEFAULT NULL COMMENT '通知业务ID',
|
||
|
`user_id` char(36) DEFAULT NULL 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 DEFAULT CHARSET=utf8 COMMENT='小程序用户';
|
||
|
</update>
|
||
|
|
||
|
<!-- 保存 -->
|
||
|
<insert id="save" parameterType="map">
|
||
|
INSERT INTO socket_notice (
|
||
|
notice_id,
|
||
|
notice_title,
|
||
|
notice_msg,
|
||
|
notice_target,
|
||
|
notice_system,
|
||
|
notice_module,
|
||
|
notice_menu,
|
||
|
notice_service_id,
|
||
|
user_id,
|
||
|
is_handle,
|
||
|
gmt_create,
|
||
|
creator,
|
||
|
gmt_modified,
|
||
|
modifier,
|
||
|
is_delete
|
||
|
) VALUES(
|
||
|
#{noticeId},
|
||
|
#{noticeTitle},
|
||
|
#{noticeMsg},
|
||
|
#{noticeTarget},
|
||
|
#{noticeSystem},
|
||
|
#{noticeModule},
|
||
|
#{noticeMenu},
|
||
|
#{noticeServiceId},
|
||
|
#{userId},
|
||
|
#{isHandle},
|
||
|
#{gmtCreate},
|
||
|
#{creator},
|
||
|
#{gmtModified},
|
||
|
#{modifier},
|
||
|
#{isDelete}
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 更新已办状态 -->
|
||
|
<update id="updateHandle" parameterType="map">
|
||
|
UPDATE
|
||
|
socket_notice
|
||
|
SET
|
||
|
is_handle = #{isHandle},
|
||
|
gmt_modified = #{gmtModified},
|
||
|
modifier = #{modifier}
|
||
|
WHERE
|
||
|
notice_system = #{noticeSystem}
|
||
|
AND
|
||
|
notice_service_id = #{noticeServiceId}
|
||
|
</update>
|
||
|
|
||
|
<!-- 删除 -->
|
||
|
<delete id="delete" parameterType="map">
|
||
|
DELETE FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
<if test="serviceIds != null and serviceIds.size > 0">
|
||
|
notice_service_id IN
|
||
|
<foreach collection="serviceIds" index="index" open="(" separator="," close=")">
|
||
|
#{serviceIds[${index}]}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</delete>
|
||
|
|
||
|
<!-- 详情 -->
|
||
|
<select id="getPO" parameterType="map" resultMap="noticePO">
|
||
|
SELECT
|
||
|
notice_id,
|
||
|
notice_title,
|
||
|
notice_msg,
|
||
|
notice_target,
|
||
|
notice_system,
|
||
|
notice_module,
|
||
|
notice_menu,
|
||
|
notice_service_id,
|
||
|
user_id,
|
||
|
is_handle,
|
||
|
gmt_create,
|
||
|
creator,
|
||
|
gmt_modified,
|
||
|
modifier,
|
||
|
is_delete
|
||
|
FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
is_delete = 0
|
||
|
<if test="noticeId != null and noticeId != ''">
|
||
|
AND
|
||
|
notice_id = #{noticeId}
|
||
|
</if>
|
||
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||
|
AND
|
||
|
notice_system = #{noticeSystem}
|
||
|
</if>
|
||
|
<if test="noticeModule != null and noticeModule != ''">
|
||
|
AND
|
||
|
notice_module = #{noticeModule}
|
||
|
</if>
|
||
|
<if test="noticeMenu != null and noticeMenu">
|
||
|
AND
|
||
|
notice_menu = #{noticeMenu}
|
||
|
</if>
|
||
|
<if test="noticeServiceId != null and noticeServiceId != ''">
|
||
|
AND
|
||
|
notice_service_id = #{noticeServiceId}
|
||
|
</if>
|
||
|
<if test="userId != null and userId != ''">
|
||
|
AND
|
||
|
user_id = #{userId}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 列表 -->
|
||
|
<select id="listPO" parameterType="map" resultMap="noticePO">
|
||
|
SELECT
|
||
|
notice_id,
|
||
|
notice_title,
|
||
|
notice_msg,
|
||
|
notice_target,
|
||
|
notice_system,
|
||
|
notice_module,
|
||
|
notice_menu,
|
||
|
notice_service_id,
|
||
|
user_id,
|
||
|
is_handle,
|
||
|
gmt_create,
|
||
|
creator,
|
||
|
gmt_modified,
|
||
|
modifier,
|
||
|
is_delete
|
||
|
FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
is_delete = 0
|
||
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||
|
AND
|
||
|
notice_system = #{noticeSystem}
|
||
|
</if>
|
||
|
<if test="noticeModule != null and noticeModule != ''">
|
||
|
AND
|
||
|
notice_module = #{noticeModule}
|
||
|
</if>
|
||
|
<if test="noticeMenu != null and noticeMenu">
|
||
|
AND
|
||
|
notice_menu = #{noticeMenu}
|
||
|
</if>
|
||
|
<if test="noticeServiceId != null and noticeServiceId != ''">
|
||
|
AND
|
||
|
notice_service_id = #{noticeServiceId}
|
||
|
</if>
|
||
|
<if test="userId != null and userId != ''">
|
||
|
AND
|
||
|
user_id = #{userId}
|
||
|
</if>
|
||
|
<if test="isHandle != null">
|
||
|
AND
|
||
|
is_handle = #{isHandle}
|
||
|
</if>
|
||
|
<if test="serviceId != null and serviceId != ''">
|
||
|
AND
|
||
|
notice_service_id = #{serviceId}
|
||
|
</if>
|
||
|
<if test="serviceIds != null and serviceIds.size > 0">
|
||
|
AND
|
||
|
notice_service_id IN
|
||
|
<foreach collection="serviceIds" index="index" open="(" separator="," close=")">
|
||
|
#{serviceIds[${index}]}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 系统列表 -->
|
||
|
<select id="listSystems" parameterType="map" resultType="java.lang.String">
|
||
|
SELECT
|
||
|
notice_system
|
||
|
FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
is_delete = 0
|
||
|
<if test="userId != null and userId != ''">
|
||
|
AND
|
||
|
user_id = #{userId}
|
||
|
</if>
|
||
|
GROUP BY
|
||
|
notice_system
|
||
|
</select>
|
||
|
|
||
|
<!-- 模块列表 -->
|
||
|
<select id="listModules" parameterType="map" resultType="java.lang.String">
|
||
|
SELECT
|
||
|
notice_module
|
||
|
FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
is_delete = 0
|
||
|
<if test="userId != null and userId != ''">
|
||
|
AND
|
||
|
user_id = #{userId}
|
||
|
</if>
|
||
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||
|
AND
|
||
|
notice_system = #{noticeSystem}
|
||
|
</if>
|
||
|
GROUP BY
|
||
|
notice_module
|
||
|
</select>
|
||
|
|
||
|
<!-- 菜单列表 -->
|
||
|
<select id="listMenus" parameterType="map" resultType="java.lang.String">
|
||
|
SELECT
|
||
|
notice_menu
|
||
|
FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
is_delete = 0
|
||
|
<if test="userId != null and userId != ''">
|
||
|
AND
|
||
|
user_id = #{userId}
|
||
|
</if>
|
||
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||
|
AND
|
||
|
notice_system = #{noticeSystem}
|
||
|
</if>
|
||
|
<if test="noticeModule != null and noticeModule != ''">
|
||
|
AND
|
||
|
notice_module = #{noticeModule}
|
||
|
</if>
|
||
|
GROUP BY
|
||
|
notice_menu
|
||
|
</select>
|
||
|
|
||
|
<!-- 统计 -->
|
||
|
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||
|
SELECT
|
||
|
COUNT(*)
|
||
|
FROM
|
||
|
socket_notice
|
||
|
WHERE
|
||
|
is_delete = 0
|
||
|
<if test="userId != null and userId != ''">
|
||
|
AND
|
||
|
user_id = #{userId}
|
||
|
</if>
|
||
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||
|
AND
|
||
|
notice_system = #{noticeSystem}
|
||
|
</if>
|
||
|
<if test="noticeModule != null and noticeModule != ''">
|
||
|
AND
|
||
|
notice_module = #{noticeModule}
|
||
|
</if>
|
||
|
<if test="noticeMenu != null and noticeMenu != ''">
|
||
|
AND
|
||
|
notice_menu = #{noticeMenu}
|
||
|
</if>
|
||
|
<if test="isHandle != null">
|
||
|
AND
|
||
|
is_handle = #{isHandle}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|