refactor: 完善前后端校验

This commit is contained in:
Charles7c 2023-09-18 22:21:25 +08:00
parent 3fd0c08b80
commit 90d825a02f
23 changed files with 117 additions and 60 deletions

View File

@ -31,9 +31,9 @@ import cn.hutool.core.lang.RegexPool;
public class RegexConsts implements RegexPool {
/**
* 用户名正则长度为 4 16 可以包含字母数字下划线以字母开头
* 用户名正则长度为 4 64 可以包含字母数字下划线以字母开头
*/
public static final String USERNAME = "^[a-zA-Z][a-zA-Z0-9_]{3,15}$";
public static final String USERNAME = "^[a-zA-Z][a-zA-Z0-9_]{3,64}$";
/**
* 密码正则长度为 6 32 可以包含字母数字下划线特殊字符同时包含字母和数字
@ -41,14 +41,14 @@ public class RegexConsts implements RegexPool {
public static final String PASSWORD = "^(?=.*\\d)(?=.*[a-z]).{6,32}$";
/**
* 通用编码正则长度为 2 16 可以包含字母数字下划线以字母开头
* 通用编码正则长度为 2 30 可以包含字母数字下划线以字母开头
*/
public static final String GENERAL_CODE = "^[a-zA-Z][a-zA-Z0-9_]{1,15}$";
public static final String GENERAL_CODE = "^[a-zA-Z][a-zA-Z0-9_]{1,29}$";
/**
* 通用名称正则长度为 1 20 可以包含中文字母数字下划线短横线
* 通用名称正则长度为 2 30 可以包含中文字母数字下划线短横线
*/
public static final String GENERAL_NAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{1,20}$";
public static final String GENERAL_NAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{2,30}$";
/**
* 包名正则可以包含大小写字母数字下划线每一级包名不能以数字开头

View File

@ -45,7 +45,7 @@ public class AnnouncementRequest extends BaseRequest {
*/
@Schema(description = "标题", example = "这是公告标题")
@NotBlank(message = "标题不能为空")
@Length(max = 255, message = "标题长度不能超过 {max} 个字符")
@Length(max = 150, message = "标题长度不能超过 {max} 个字符")
private String title;
/**
@ -60,6 +60,7 @@ public class AnnouncementRequest extends BaseRequest {
*/
@Schema(description = "类型(取值于字典 announcement_type", example = "1")
@NotBlank(message = "类型不能为空")
@Length(max = 30, message = "类型长度不能超过 {max} 个字符")
private String type;
/**

View File

@ -16,6 +16,7 @@
package top.charles7c.cnadmin.system.model.request;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ -55,14 +56,14 @@ public class DeptRequest extends BaseRequest {
*/
@Schema(description = "部门名称", example = "测试部")
@NotBlank(message = "部门名称不能为空")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "部门名称长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "部门名称长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线")
private String name;
/**
* 部门排序
*/
@Schema(description = "部门排序", example = "1")
@NotNull(message = "部门排序不能为空")
@Min(value = 1, message = "部门排序最小值为 {value}")
private Integer sort;
/**

View File

@ -43,6 +43,7 @@ public class DictItemRequest extends BaseRequest {
*/
@Schema(description = "字典标签", example = "通知")
@NotBlank(message = "字典标签不能为空")
@Length(max = 30, message = "字典标签长度不能超过 {max} 个字符")
private String label;
/**
@ -50,18 +51,21 @@ public class DictItemRequest extends BaseRequest {
*/
@Schema(description = "字典值", example = "1")
@NotBlank(message = "字典值不能为空")
@Length(max = 30, message = "字典值长度不能超过 {max} 个字符")
private String value;
/**
* 背景颜色
*/
@Schema(description = "背景颜色", example = "blue")
@Length(max = 30, message = "背景颜色长度不能超过 {max} 个字符")
private String color;
/**
* 排序
*/
@Schema(description = "排序", example = "1")
@Min(value = 1, message = "排序最小值为 {value}")
private Integer sort;
/**

View File

@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import org.hibernate.validator.constraints.Length;
import top.charles7c.cnadmin.common.base.BaseRequest;
import top.charles7c.cnadmin.common.constant.RegexConsts;
/**
* 创建或修改字典信息
@ -43,6 +44,7 @@ public class DictRequest extends BaseRequest {
*/
@Schema(description = "字典名称", example = "公告类型")
@NotBlank(message = "字典名称不能为空")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "字典名称长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线")
private String name;
/**
@ -50,6 +52,7 @@ public class DictRequest extends BaseRequest {
*/
@Schema(description = "字典编码", example = "announcement_type")
@NotBlank(message = "字典编码不能为空")
@Pattern(regexp = RegexConsts.GENERAL_CODE, message = "字典编码长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头")
private String code;
/**

View File

@ -16,6 +16,7 @@
package top.charles7c.cnadmin.system.model.request;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ -24,6 +25,8 @@ import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import org.hibernate.validator.constraints.Length;
import top.charles7c.cnadmin.common.base.BaseRequest;
import top.charles7c.cnadmin.common.constant.RegexConsts;
import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
@ -52,6 +55,7 @@ public class MenuRequest extends BaseRequest {
* 菜单图标
*/
@Schema(description = "菜单图标", example = "user")
@Length(max = 50, message = "菜单图标长度不能超过 {max} 个字符")
private String icon;
/**
@ -59,7 +63,7 @@ public class MenuRequest extends BaseRequest {
*/
@Schema(description = "菜单标题", example = "用户管理")
@NotBlank(message = "菜单标题不能为空")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "菜单标题长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "菜单标题长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线")
private String title;
/**
@ -67,30 +71,35 @@ public class MenuRequest extends BaseRequest {
*/
@Schema(description = "菜单排序", example = "1")
@NotNull(message = "菜单排序不能为空")
@Min(value = 1, message = "菜单排序最小值为 {value}")
private Integer sort;
/**
* 权限标识
*/
@Schema(description = "权限标识", example = "system:user:list")
@Length(max = 100, message = "权限标识长度不能超过 {max} 个字符")
private String permission;
/**
* 路由地址
*/
@Schema(description = "路由地址", example = "/system/user")
@Length(max = 255, message = "路由地址长度不能超过 {max} 个字符")
private String path;
/**
* 组件名称
*/
@Schema(description = "组件名称", example = "User")
@Length(max = 50, message = "组件名称长度不能超过 {max} 个字符")
private String name;
/**
* 组件路径
*/
@Schema(description = "组件路径", example = "/system/user/index")
@Length(max = 255, message = "组件路径长度不能超过 {max} 个字符")
private String component;
/**

View File

@ -19,8 +19,8 @@ package top.charles7c.cnadmin.system.model.request;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import lombok.Data;
@ -51,7 +51,7 @@ public class RoleRequest extends BaseRequest {
*/
@Schema(description = "角色名称", example = "测试人员")
@NotBlank(message = "角色名称不能为空")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "角色名称长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "角色名称长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线")
private String name;
/**
@ -59,14 +59,14 @@ public class RoleRequest extends BaseRequest {
*/
@Schema(description = "角色编码", example = "test")
@NotBlank(message = "角色编码不能为空")
@Pattern(regexp = RegexConsts.GENERAL_CODE, message = "角色编码长度为 2 到 16 位,可以包含字母、数字,下划线,以字母开头")
@Pattern(regexp = RegexConsts.GENERAL_CODE, message = "角色编码长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头")
private String code;
/**
* 角色排序
*/
@Schema(description = "角色排序", example = "1")
@NotNull(message = "角色排序不能为空")
@Min(value = 1, message = "角色排序最小值为 {value}")
private Integer sort;
/**

View File

@ -46,7 +46,7 @@ public class UpdateBasicInfoRequest implements Serializable {
*/
@Schema(description = "昵称", example = "张三")
@NotBlank(message = "昵称不能为空")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "昵称长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "昵称长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线")
private String nickname;
/**

View File

@ -51,7 +51,7 @@ public class UserRequest extends BaseRequest {
*/
@Schema(description = "用户名", example = "zhangsan")
@NotBlank(message = "用户名不能为空")
@Pattern(regexp = RegexConsts.USERNAME, message = "用户名长度为 4 到 16 位,可以包含字母、数字,下划线,以字母开头")
@Pattern(regexp = RegexConsts.USERNAME, message = "用户名长度为 4 到 64 位,可以包含字母、数字,下划线,以字母开头")
private String username;
/**
@ -59,7 +59,7 @@ public class UserRequest extends BaseRequest {
*/
@Schema(description = "昵称", example = "张三")
@NotBlank(message = "昵称不能为空")
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "昵称长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线")
@Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{4,30}$", message = "昵称长度为 4 到 30 位,可以包含中文、字母、数字、下划线,短横线")
private String nickname;
/**
@ -67,6 +67,7 @@ public class UserRequest extends BaseRequest {
*/
@Schema(description = "邮箱", example = "123456789@qq.com")
@Pattern(regexp = RegexConsts.EMAIL, message = "邮箱格式错误")
@Length(max = 255, message = "邮箱长度不能超过 {max} 个字符")
private String email;
/**

View File

@ -15,7 +15,7 @@
<a-input
v-model="form.username"
:placeholder="$t('login.form.placeholder.username')"
max-length="50"
:max-length="64"
>
<template #prefix><icon-user /></template>
</a-input>
@ -24,7 +24,7 @@
<a-input-password
v-model="form.password"
:placeholder="$t('login.form.placeholder.password')"
max-length="32"
:max-length="32"
allow-clear
>
<template #prefix><icon-lock /></template>
@ -34,6 +34,7 @@
<a-input
v-model="form.captcha"
:placeholder="$t('login.form.placeholder.captcha')"
:max-length="4"
allow-clear
style="width: 63%"
>

View File

@ -217,7 +217,7 @@
<a-input
v-model="form.title"
placeholder="请输入标题"
max-length="255"
:max-length="150"
style="width: 100%"
/>
</a-form-item>

View File

@ -356,8 +356,14 @@
//
rules: {
parentId: [{ required: true, message: '请选择上级部门' }],
name: [{ required: true, message: '请输入部门名称' }],
sort: [{ required: true, message: '请输入部门排序' }],
name: [
{ required: true, message: '请输入部门名称' },
{
match: /^[\u4e00-\u9fa5a-zA-Z0-9_-]{2,30}$/,
message:
'长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线',
},
],
},
});
const { queryParams, form, rules } = toRefs(data);

View File

@ -271,8 +271,21 @@
form: {} as DataRecord,
//
rules: {
name: [{ required: true, message: '字典名称不能为空' }],
code: [{ required: true, message: '字典编码不能为空' }],
name: [
{ required: true, message: '请输入字典名称' },
{
match: /^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{2,30}$/,
message:
'长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线',
},
],
code: [
{ required: true, message: '请输入字典编码' },
{
match: /^[a-zA-Z][a-zA-Z0-9_]{1,29}$/,
message: '长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头',
},
],
},
});
const { queryParams, form, rules } = toRefs(data);
@ -298,6 +311,7 @@
* @param params 查询参数
*/
const getList = (params: ListParam = { ...queryParams.value }) => {
dictId.value = null;
loading.value = true;
list(params)
.then((res) => {

View File

@ -103,16 +103,25 @@
>
<a-form ref="formRef" :model="form" :rules="rules" size="large">
<a-form-item label="字典标签" field="label">
<a-input v-model="form.label" placeholder="请输入字典标签" />
<a-input
v-model="form.label"
placeholder="请输入字典标签"
:max-length="30"
/>
</a-form-item>
<a-form-item label="字典值" field="value">
<a-input v-model="form.value" placeholder="请输入字典值" />
<a-input
v-model="form.value"
placeholder="请输入字典值"
:max-length="30"
/>
</a-form-item>
<a-form-item label="背景颜色" field="color">
<a-auto-complete
v-model="form.color"
:data="colors"
placeholder="请选择或输入背景颜色"
:max-length="30"
allow-clear
>
<template #option="{ data }">
@ -198,8 +207,8 @@
form: {} as DataRecord,
//
rules: {
label: [{ required: true, message: '字典标签不能为空' }],
value: [{ required: true, message: '字典值不能为空' }],
label: [{ required: true, message: '请输入字典标签' }],
value: [{ required: true, message: '请输入字典值' }],
},
});
const { queryParams, form, rules } = toRefs(data);

View File

@ -246,6 +246,7 @@
<a-input
v-model="form.title"
placeholder="请输入菜单标题"
:max-length="30"
style="width: 182px"
/>
</a-form-item>
@ -266,6 +267,7 @@
<a-input
v-model="form.permission"
placeholder="请输入权限标识"
:max-length="100"
style="width: 182px"
/>
</a-form-item>
@ -273,6 +275,7 @@
<a-input
v-model="form.path"
placeholder="请输入路由地址"
:max-length="255"
style="width: 473px"
/>
</a-form-item>
@ -284,6 +287,7 @@
<a-input
v-model="form.name"
placeholder="请输入组件名称"
:max-length="50"
style="width: 182px"
/>
</a-form-item>
@ -295,6 +299,7 @@
<a-input
v-model="form.component"
placeholder="请输入组件路径"
:max-length="255"
style="width: 182px"
/>
</a-form-item>

View File

@ -494,20 +494,19 @@
name: [
{ required: true, message: '请输入角色名称' },
{
match: /^[\u4e00-\u9fa5a-zA-Z0-9_-]{1,20}$/,
match: /^[\u4e00-\u9fa5a-zA-Z0-9_-]{2,30}$/,
message:
'长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线',
'长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线',
},
],
code: [
{ required: true, message: '请输入角色编码' },
{
match: /^[a-zA-Z][a-zA-Z0-9_]{1,15}$/,
message: '长度为 2 到 16 位,可以包含字母、数字,下划线,以字母开头',
match: /^[a-zA-Z][a-zA-Z0-9_]{1,29}$/,
message: '长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头',
},
],
dataScope: [{ required: true, message: '请选择数据权限' }],
sort: [{ required: true, message: '请输入角色排序' }],
},
});
const { queryParams, form, rules } = toRefs(data);

View File

@ -15,7 +15,7 @@
<a-input
v-model="form.username"
:placeholder="$t('userCenter.basicInfo.form.placeholder.username')"
max-length="16"
:max-length="64"
/>
</a-form-item>
<a-form-item
@ -25,7 +25,7 @@
<a-input
v-model="form.nickname"
:placeholder="$t('userCenter.basicInfo.form.placeholder.nickname')"
max-length="20"
:max-length="30"
/>
</a-form-item>
<a-form-item

View File

@ -71,7 +71,7 @@
'userCenter.securitySettings.updateEmail.form.placeholder.captcha'
)
"
max-length="6"
:max-length="6"
allow-clear
style="width: 80%"
/>
@ -100,7 +100,7 @@
'userCenter.securitySettings.updateEmail.form.placeholder.currentPassword'
)
"
max-length="32"
:max-length="32"
allow-clear
/>
</a-form-item>

View File

@ -55,7 +55,7 @@
'userCenter.securitySettings.updatePwd.form.placeholder.oldPassword'
)
"
max-length="32"
:max-length="32"
allow-clear
/>
</a-form-item>
@ -72,7 +72,7 @@
'userCenter.securitySettings.updatePwd.form.placeholder.newPassword'
)
"
max-length="32"
:max-length="32"
allow-clear
/>
</a-form-item>
@ -89,7 +89,7 @@
'userCenter.securitySettings.updatePwd.form.placeholder.rePassword'
)
"
max-length="32"
:max-length="32"
allow-clear
/>
</a-form-item>

View File

@ -303,12 +303,14 @@
v-model="form.username"
placeholder="请输入用户名"
style="width: 162px"
:max-length="64"
/>
</a-form-item>
<a-form-item label="昵称" field="nickname">
<a-input
v-model="form.nickname"
placeholder="请输入昵称"
:max-length="30"
style="width: 162px"
/>
</a-form-item>
@ -316,6 +318,7 @@
<a-input
v-model="form.email"
placeholder="请输入邮箱"
:max-length="255"
style="width: 162px"
/>
</a-form-item>
@ -323,6 +326,7 @@
<a-input
v-model="form.phone"
placeholder="请输入手机号码"
:max-length="15"
style="width: 162px"
/>
</a-form-item>

View File

@ -3,17 +3,17 @@
-- changeset Charles7c:1
CREATE TABLE IF NOT EXISTS `sys_menu` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`title` varchar(50) NOT NULL COMMENT '菜单标题',
`title` varchar(30) NOT NULL COMMENT '菜单标题',
`parent_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级菜单ID',
`type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '菜单类型1目录2菜单3按钮',
`path` varchar(512) DEFAULT NULL COMMENT '路由地址',
`path` varchar(255) DEFAULT NULL COMMENT '路由地址',
`name` varchar(50) DEFAULT NULL COMMENT '组件名称',
`component` varchar(255) DEFAULT NULL COMMENT '组件路径',
`icon` varchar(255) DEFAULT NULL COMMENT '菜单图标',
`icon` varchar(50) DEFAULT NULL COMMENT '菜单图标',
`is_external` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否外链',
`is_cache` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否缓存',
`is_hidden` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否隐藏',
`permission` varchar(255) DEFAULT NULL COMMENT '权限标识',
`permission` varchar(100) DEFAULT NULL COMMENT '权限标识',
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '菜单排序',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态1启用2禁用',
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
@ -29,10 +29,10 @@ CREATE TABLE IF NOT EXISTS `sys_menu` (
CREATE TABLE IF NOT EXISTS `sys_dept` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`name` varchar(50) NOT NULL COMMENT '部门名称',
`name` varchar(30) NOT NULL COMMENT '部门名称',
`parent_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级部门ID',
`ancestors` varchar(512) DEFAULT '' COMMENT '祖级列表',
`description` varchar(512) DEFAULT NULL COMMENT '描述',
`description` varchar(200) DEFAULT NULL COMMENT '描述',
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '部门排序',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态1启用2禁用',
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
@ -49,10 +49,10 @@ CREATE TABLE IF NOT EXISTS `sys_dept` (
CREATE TABLE IF NOT EXISTS `sys_role` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`name` varchar(50) NOT NULL COMMENT '角色名称',
`code` varchar(50) NOT NULL COMMENT '角色编码',
`name` varchar(30) NOT NULL COMMENT '角色名称',
`code` varchar(30) NOT NULL COMMENT '角色编码',
`data_scope` tinyint(1) NOT NULL DEFAULT 4 COMMENT '数据权限1全部数据权限2本部门及以下数据权限3本部门数据权限4仅本人数据权限5自定义数据权限',
`description` varchar(512) DEFAULT NULL COMMENT '描述',
`description` varchar(200) DEFAULT NULL COMMENT '描述',
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '角色排序',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态1启用2禁用',
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
@ -81,14 +81,14 @@ CREATE TABLE IF NOT EXISTS `sys_role_dept` (
CREATE TABLE IF NOT EXISTS `sys_user` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`username` varchar(50) NOT NULL COMMENT '用户名',
`nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
`password` varchar(255) DEFAULT NULL COMMENT '密码',
`username` varchar(64) NOT NULL COMMENT '用户名',
`nickname` varchar(30) DEFAULT NULL COMMENT '昵称',
`password` varchar(32) DEFAULT NULL COMMENT '密码',
`gender` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别0未知12',
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
`phone` varchar(50) DEFAULT NULL COMMENT '手机号码',
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',
`phone` varchar(15) DEFAULT NULL COMMENT '手机号码',
`avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
`description` varchar(512) DEFAULT NULL COMMENT '描述',
`description` varchar(200) DEFAULT NULL COMMENT '描述',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态1启用2禁用',
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
`pwd_reset_time` datetime DEFAULT NULL COMMENT '最后一次修改密码时间',

View File

@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `gen_field_config` (
CREATE TABLE IF NOT EXISTS `sys_announcement` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`title` varchar(255) NOT NULL COMMENT '标题',
`title` varchar(150) NOT NULL COMMENT '标题',
`content` mediumtext NOT NULL COMMENT '内容',
`type` varchar(30) NOT NULL COMMENT '类型',
`effective_time` datetime DEFAULT NULL COMMENT '生效时间',

View File

@ -3,9 +3,9 @@
-- changeset Charles7c:1
CREATE TABLE IF NOT EXISTS `sys_dict` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`name` varchar(50) NOT NULL COMMENT '字典名称',
`name` varchar(30) NOT NULL COMMENT '字典名称',
`code` varchar(30) NOT NULL COMMENT '字典编码',
`description` varchar(512) DEFAULT NULL COMMENT '描述',
`description` varchar(200) DEFAULT NULL COMMENT '描述',
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
@ -18,11 +18,11 @@ CREATE TABLE IF NOT EXISTS `sys_dict` (
CREATE TABLE IF NOT EXISTS `sys_dict_item` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`label` varchar(50) NOT NULL COMMENT '字典标签',
`label` varchar(30) NOT NULL COMMENT '字典标签',
`value` varchar(30) NOT NULL COMMENT '字典值',
`color` varchar(30) DEFAULT NULL COMMENT '背景颜色',
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '字典项排序',
`description` varchar(512) DEFAULT NULL COMMENT '描述',
`description` varchar(200) DEFAULT NULL COMMENT '描述',
`dict_id` bigint(20) UNSIGNED NOT NULL COMMENT '字典ID',
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',