build: message ddl move to project

This commit is contained in:
CaptainB 2023-08-15 15:01:29 +08:00 committed by 刘瑞斌
parent c5982e09e7
commit e5fa9b4383
15 changed files with 104 additions and 98 deletions

View File

@ -1,4 +1,4 @@
package io.metersphere.system.domain;
package io.metersphere.project.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package io.metersphere.system.domain;
package io.metersphere.project.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package io.metersphere.system.domain;
package io.metersphere.project.domain;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package io.metersphere.system.domain;
package io.metersphere.project.domain;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package io.metersphere.system.domain;
package io.metersphere.project.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package io.metersphere.system.domain;
package io.metersphere.project.domain;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,7 +1,7 @@
package io.metersphere.system.mapper;
package io.metersphere.project.mapper;
import io.metersphere.system.domain.MessageTaskBlob;
import io.metersphere.system.domain.MessageTaskBlobExample;
import io.metersphere.project.domain.MessageTaskBlob;
import io.metersphere.project.domain.MessageTaskBlobExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

View File

@ -1,10 +1,10 @@
<?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="io.metersphere.system.mapper.MessageTaskBlobMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.MessageTaskBlob">
<mapper namespace="io.metersphere.project.mapper.MessageTaskBlobMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.MessageTaskBlob">
<id column="id" jdbcType="VARCHAR" property="id" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.MessageTaskBlob">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.MessageTaskBlob">
<result column="template" jdbcType="LONGVARCHAR" property="template" />
</resultMap>
<sql id="Example_Where_Clause">
@ -71,7 +71,7 @@
<sql id="Blob_Column_List">
`template`
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.system.domain.MessageTaskBlobExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.MessageTaskBlobExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
@ -87,7 +87,7 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.system.domain.MessageTaskBlobExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.project.domain.MessageTaskBlobExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -113,17 +113,17 @@
delete from message_task_blob
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.MessageTaskBlobExample">
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.MessageTaskBlobExample">
delete from message_task_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.MessageTaskBlob">
<insert id="insert" parameterType="io.metersphere.project.domain.MessageTaskBlob">
insert into message_task_blob (id, `template`)
values (#{id,jdbcType=VARCHAR}, #{template,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.MessageTaskBlob">
<insert id="insertSelective" parameterType="io.metersphere.project.domain.MessageTaskBlob">
insert into message_task_blob
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -142,7 +142,7 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.MessageTaskBlobExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="io.metersphere.project.domain.MessageTaskBlobExample" resultType="java.lang.Long">
select count(*) from message_task_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -177,7 +177,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.MessageTaskBlob">
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.MessageTaskBlob">
update message_task_blob
<set>
<if test="template != null">
@ -186,7 +186,7 @@
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.MessageTaskBlob">
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.MessageTaskBlob">
update message_task_blob
set `template` = #{template,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}

View File

@ -1,7 +1,7 @@
package io.metersphere.system.mapper;
package io.metersphere.project.mapper;
import io.metersphere.system.domain.MessageTask;
import io.metersphere.system.domain.MessageTaskExample;
import io.metersphere.project.domain.MessageTask;
import io.metersphere.project.domain.MessageTaskExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

View File

@ -1,7 +1,7 @@
<?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="io.metersphere.system.mapper.MessageTaskMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.MessageTask">
<mapper namespace="io.metersphere.project.mapper.MessageTaskMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.MessageTask">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="event" jdbcType="VARCHAR" property="event" />
@ -73,7 +73,7 @@
<sql id="Base_Column_List">
id, `type`, event, receiver, task_type, webhook, test_id, create_time, project_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.MessageTaskExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.project.domain.MessageTaskExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -97,13 +97,13 @@
delete from message_task
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.MessageTaskExample">
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.MessageTaskExample">
delete from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.MessageTask">
<insert id="insert" parameterType="io.metersphere.project.domain.MessageTask">
insert into message_task (id, `type`, event,
receiver, task_type, webhook,
test_id, create_time, project_id
@ -113,7 +113,7 @@
#{testId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.MessageTask">
<insert id="insertSelective" parameterType="io.metersphere.project.domain.MessageTask">
insert into message_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -174,7 +174,7 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.MessageTaskExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="io.metersphere.project.domain.MessageTaskExample" resultType="java.lang.Long">
select count(*) from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -230,7 +230,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.MessageTask">
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.MessageTask">
update message_task
<set>
<if test="type != null">
@ -260,7 +260,7 @@
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.MessageTask">
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.MessageTask">
update message_task
set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},

View File

@ -1,7 +1,7 @@
package io.metersphere.system.mapper;
package io.metersphere.project.mapper;
import io.metersphere.system.domain.Notification;
import io.metersphere.system.domain.NotificationExample;
import io.metersphere.project.domain.Notification;
import io.metersphere.project.domain.NotificationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

View File

@ -1,7 +1,7 @@
<?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="io.metersphere.system.mapper.NotificationMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.Notification">
<mapper namespace="io.metersphere.project.mapper.NotificationMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.Notification">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="receiver" jdbcType="VARCHAR" property="receiver" />
@ -76,7 +76,7 @@
id, `type`, receiver, title, `status`, create_time, `operator`, `operation`, resource_id,
resource_type, resource_name
</sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.NotificationExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.project.domain.NotificationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -100,13 +100,13 @@
delete from notification
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.NotificationExample">
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.NotificationExample">
delete from notification
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.Notification">
<insert id="insert" parameterType="io.metersphere.project.domain.Notification">
insert into notification (id, `type`, receiver,
title, `status`, create_time,
`operator`, `operation`, resource_id,
@ -116,7 +116,7 @@
#{operator,jdbcType=VARCHAR}, #{operation,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{resourceType,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.Notification">
<insert id="insertSelective" parameterType="io.metersphere.project.domain.Notification">
insert into notification
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -189,7 +189,7 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.NotificationExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="io.metersphere.project.domain.NotificationExample" resultType="java.lang.Long">
select count(*) from notification
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -253,7 +253,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.Notification">
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.Notification">
update notification
<set>
<if test="type != null">
@ -289,7 +289,7 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.Notification">
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.Notification">
update notification
set `type` = #{type,jdbcType=VARCHAR},
receiver = #{receiver,jdbcType=VARCHAR},

View File

@ -55,51 +55,6 @@ CREATE TABLE IF NOT EXISTS license
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '';
CREATE TABLE IF NOT EXISTS message_task
(
`id` VARCHAR(50) NOT NULL COMMENT '',
`type` VARCHAR(50) NOT NULL COMMENT '消息类型',
`event` VARCHAR(255) NOT NULL COMMENT '通知事件类型',
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人id',
`task_type` VARCHAR(64) NOT NULL COMMENT '任务类型',
`webhook` VARCHAR(255) COMMENT 'webhook地址',
`test_id` VARCHAR(50) NOT NULL DEFAULT 'none' COMMENT '具体测试的ID',
`create_time` BIGINT NOT NULL DEFAULT 0 COMMENT '创建时间',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知任务';
CREATE INDEX idx_project_id ON message_task (`project_id`);
CREATE INDEX idx_create_time ON message_task (`create_time`);
CREATE INDEX idx_receiver ON message_task (`receiver`);
CREATE INDEX idx_test_id ON message_task (`test_id`);
CREATE TABLE IF NOT EXISTS notification
(
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
`type` VARCHAR(30) NOT NULL COMMENT '通知类型',
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人',
`title` VARCHAR(255) NOT NULL COMMENT '标题',
`status` VARCHAR(30) NOT NULL COMMENT '状态',
`create_time` BIGINT NOT NULL COMMENT '创建时间',
`operator` VARCHAR(50) NOT NULL COMMENT '操作人',
`operation` VARCHAR(50) NOT NULL COMMENT '操作',
`resource_id` VARCHAR(50) NOT NULL COMMENT '资源ID',
`resource_type` VARCHAR(50) NOT NULL COMMENT '资源类型',
`resource_name` VARCHAR(255) NOT NULL COMMENT '资源名称',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知';
CREATE INDEX idx_receiver ON notification (`receiver`);
CREATE INDEX idx_receiver_type ON notification (`receiver`, `type`);
CREATE INDEX idx_notification_create_time ON notification (`create_time`);
CREATE TABLE IF NOT EXISTS novice_statistics
(
`id` VARCHAR(50) NOT NULL COMMENT '',
@ -368,14 +323,6 @@ CREATE TABLE IF NOT EXISTS user_extend
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '用户扩展';
CREATE TABLE IF NOT EXISTS message_task_blob
(
`id` VARCHAR(50) NOT NULL COMMENT '',
`template` TEXT COMMENT '消息模版',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知任务大字段';
CREATE TABLE IF NOT EXISTS test_resource_pool_organization
(

View File

@ -346,5 +346,62 @@ CREATE INDEX idx_create_user ON api_template (create_user);
CREATE INDEX idx_project_id ON api_template (project_id);
CREATE TABLE IF NOT EXISTS message_task
(
`id` VARCHAR(50) NOT NULL COMMENT '',
`type` VARCHAR(50) NOT NULL COMMENT '消息类型',
`event` VARCHAR(255) NOT NULL COMMENT '通知事件类型',
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人id',
`task_type` VARCHAR(64) NOT NULL COMMENT '任务类型',
`webhook` VARCHAR(255) COMMENT 'webhook地址',
`test_id` VARCHAR(50) NOT NULL DEFAULT 'none' COMMENT '具体测试的ID',
`create_time` BIGINT NOT NULL DEFAULT 0 COMMENT '创建时间',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知任务';
CREATE INDEX idx_project_id ON message_task (`project_id`);
CREATE INDEX idx_create_time ON message_task (`create_time`);
CREATE INDEX idx_receiver ON message_task (`receiver`);
CREATE INDEX idx_test_id ON message_task (`test_id`);
CREATE TABLE IF NOT EXISTS message_task_blob
(
`id` VARCHAR(50) NOT NULL COMMENT '',
`template` TEXT COMMENT '消息模版',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知任务大字段';
CREATE TABLE IF NOT EXISTS notification
(
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
`type` VARCHAR(30) NOT NULL COMMENT '通知类型',
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人',
`title` VARCHAR(255) NOT NULL COMMENT '标题',
`status` VARCHAR(30) NOT NULL COMMENT '状态',
`create_time` BIGINT NOT NULL COMMENT '创建时间',
`operator` VARCHAR(50) NOT NULL COMMENT '操作人',
`operation` VARCHAR(50) NOT NULL COMMENT '操作',
`resource_id` VARCHAR(50) NOT NULL COMMENT '资源ID',
`resource_type` VARCHAR(50) NOT NULL COMMENT '资源类型',
`resource_name` VARCHAR(255) NOT NULL COMMENT '资源名称',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知';
CREATE INDEX idx_receiver ON notification (`receiver`);
CREATE INDEX idx_receiver_type ON notification (`receiver`, `type`);
CREATE INDEX idx_notification_create_time ON notification (`create_time`);
-- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -89,7 +89,9 @@
<table tableName="bug_template_extend"/>
<table tableName="bug_template"/>
<table tableName="api_template"/>
<table tableName="message_task"/>
<table tableName="message_task_blob"/>
<table tableName="notification"/>
<!-- 要忽略的字段-->
<!-- <table tableName="test_case">
<ignoreColumn column="follow_people"/>