init
This commit is contained in:
13
notice/notice-biz/src/main/resources/bootstrap-dev.yml
Normal file
13
notice/notice-biz/src/main/resources/bootstrap-dev.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.7.127.185:38848
|
||||
namespace: clay
|
||||
|
||||
dubbo:
|
||||
registry:
|
||||
parameters:
|
||||
namespace: dubbo-clay
|
||||
11
notice/notice-biz/src/main/resources/bootstrap-pro.yml
Normal file
11
notice/notice-biz/src/main/resources/bootstrap-pro.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos.fateverse.svc.cluster.local:8848
|
||||
|
||||
management:
|
||||
server:
|
||||
port: 9595
|
||||
41
notice/notice-biz/src/main/resources/bootstrap.yml
Normal file
41
notice/notice-biz/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 8090
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: notice
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.101.108:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
namespace: ${spring.profiles.active}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
namespace: ${spring.profiles.active}
|
||||
shared-configs:
|
||||
- data-id: application-${spring.profiles.active}.yaml
|
||||
refresh: true
|
||||
|
||||
dubbo:
|
||||
application:
|
||||
name: dubbo-${spring.application.name}
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
parameters:
|
||||
namespace: dubbo-${spring.profiles.active}
|
||||
107
notice/notice-biz/src/main/resources/mapper/NoticeMapper.xml
Normal file
107
notice/notice-biz/src/main/resources/mapper/NoticeMapper.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?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.fateverse.notice.mapper.NoticeMapper">
|
||||
|
||||
<sql id="noticeDetails">
|
||||
select notice_id, notice_title, notice_type, send_type, sender_ids, notice_content, content_type, state, cluster, create_by, create_time, update_by, update_time, remark
|
||||
from sys_notice
|
||||
</sql>
|
||||
|
||||
<sql id="noticeVo">
|
||||
select notice_id, notice_title, notice_type, send_type, sender_ids, content_type, state, cluster, create_by, create_time, update_by, update_time, remark
|
||||
from sys_notice
|
||||
</sql>
|
||||
|
||||
<select id="selectById" resultType="cn.fateverse.notice.entity.Notice">
|
||||
<include refid="noticeDetails"/>
|
||||
<where>
|
||||
<if test="publishId != null">and publish_id = #{publishId}</if>
|
||||
<if test="noticeId != null">and notice_id = #{noticeId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSimpleById" resultType="cn.fateverse.notice.entity.Notice">
|
||||
<include refid="noticeVo"/>
|
||||
<where>
|
||||
<if test="publishId != null">and publish_id = #{publishId}</if>
|
||||
<if test="noticeId != null">and notice_id = #{noticeId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.notice.entity.Notice">
|
||||
<include refid="noticeVo"/>
|
||||
<where>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">and notice_title like concat('%',#{noticeTitle},'%')</if>
|
||||
<if test="noticeType != null and noticeType != ''">and notice_type like concat('%',#{noticeType},'%')</if>
|
||||
<if test="sendType != null and sendType != ''">and send_type = #{sendType}</if>
|
||||
<if test="contentType != null and contentType != ''">and content_type = #{contentType}</if>
|
||||
<if test="state != null and state != ''">and state = #{state}</if>
|
||||
<if test="cluster != null and cluster != ''">and cluster = #{cluster}</if>
|
||||
<if test="publishId != null">and publish_id = #{publishId}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="noticeId">
|
||||
insert into sys_notice
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="noticeId != null"> notice_id,</if>
|
||||
<if test="noticeTitle != null and noticeTitle != ''"> notice_title,</if>
|
||||
<if test="noticeType != null and noticeType != ''"> notice_type,</if>
|
||||
<if test="sendType != null and sendType != ''"> send_type,</if>
|
||||
<if test="senderIds != null and senderIds != ''"> sender_ids,</if>
|
||||
<if test="publishId != null and publishId != ''"> publish_id,</if>
|
||||
<if test="noticeContent != null and noticeContent != ''"> notice_content,</if>
|
||||
<if test="contentType != null and contentType != ''"> content_type,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="cluster != null">cluster,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="noticeId != null"> #{noticeId},</if>
|
||||
<if test="noticeTitle != null and noticeTitle != ''"> #{noticeTitle},</if>
|
||||
<if test="noticeType != null and noticeType != ''"> #{noticeType},</if>
|
||||
<if test="sendType != null and sendType != ''"> #{sendType},</if>
|
||||
<if test="senderIds != null and senderIds != ''"> #{senderIds},</if>
|
||||
<if test="publishId != null and publishId != ''"> #{publishId},</if>
|
||||
<if test="noticeContent != null and noticeContent != ''"> #{noticeContent},</if>
|
||||
<if test="contentType != null and contentType != ''"> #{contentType},</if>
|
||||
<if test="state != null">#{state},</if>
|
||||
<if test="cluster != null">#{cluster},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_user_notice
|
||||
<set>
|
||||
<if test="state != null">state = #{state},</if>
|
||||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
<update id="changeState">
|
||||
update sys_user_notice
|
||||
<set>
|
||||
<if test="state != null">state = #{state},</if>
|
||||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from sys_notice where notice_id = #{noticeId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDeleteByIdList">
|
||||
delete from sys_notice where notice_id in
|
||||
<foreach collection="list" open="(" separator="," close=")" item="noticeId">
|
||||
#{noticeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
28
notice/notice-biz/src/main/resources/mapper/NotifyMapper.xml
Normal file
28
notice/notice-biz/src/main/resources/mapper/NotifyMapper.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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.fateverse.notice.mapper.NotifyMapper">
|
||||
|
||||
<select id="selectNoticeList" resultType="cn.fateverse.notice.entity.Notice">
|
||||
select sn.notice_id, sn.notice_title, sn.notice_type, sn.send_type, sn.sender_ids, sn.content_type, sn.cluster, sn.remark,
|
||||
sun.state
|
||||
from sys_notice sn
|
||||
left join sys_user_notice sun on sn.notice_id = sun.notice_id
|
||||
<where>
|
||||
and sn.state = '1'
|
||||
<if test="userId !=null"> and sun.user_id = #{userId}</if>
|
||||
<if test="cluster !=null"> and sn.cluster = #{cluster}</if>
|
||||
<if test="state !=null"> and sun.state = #{state}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNoticeByNoticeId" resultType="cn.fateverse.notice.entity.Notice">
|
||||
select sn.notice_id, sn.notice_title, sn.notice_type, sn.notice_content, sn.send_type, sn.sender_ids, sn.content_type, sn.cluster, sn.remark,
|
||||
sun.state
|
||||
from sys_notice sn
|
||||
left join sys_user_notice sun on sn.notice_id = sun.notice_id
|
||||
where sn.state = '1' and sn.notice_id = #{noticeId} and sun.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?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.fateverse.notice.mapper.UserNoticeMapper">
|
||||
|
||||
<insert id="insert">
|
||||
insert into sys_user_notice
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="noticeId != null">notice_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="noticeId != null">#{noticeId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="state != null">#{state},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into sys_user_notice (notice_id,
|
||||
user_id,
|
||||
state,
|
||||
create_time)
|
||||
values
|
||||
<foreach collection="list" index="index" separator="," item="notice">
|
||||
(#{notice.noticeId},#{notice.userId},#{notice.state},#{notice.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchRead">
|
||||
update sys_user_notice
|
||||
set state = '1'
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="read">
|
||||
update sys_user_notice
|
||||
set state = '1'
|
||||
where user_id = #{userId}
|
||||
and notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete
|
||||
from sys_user_notice
|
||||
where user_id = #{userId}
|
||||
and notice_id = #{noticeId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDelete">
|
||||
delete from sys_user_notice where user_id = #{userId} and notice_id in
|
||||
<foreach collection="noticeIdList" open="(" separator="," close=")" item="noticeId">
|
||||
#{noticeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByNoticeId">
|
||||
delete
|
||||
from sys_user_notice
|
||||
where notice_id = #{noticeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAll">
|
||||
delete
|
||||
from sys_user_notice
|
||||
where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user