选择项目架构。
确定管理员和用户是同一张表还是不同表。
确定前端密码加密方式(md5、rsa、des、aes)。
确定数据库密码加密方式(md5、rsa、des、aes)。
勾选基础功能。
提供每个表的建表语句即可。
drop table if exists `news`;
create table `news` (
`id` int primary key not null auto_increment,
news_type tinyint not null default 1 comment '新闻类型,1自有新闻,2合作伙伴新闻',
source_id int comment '新闻来源表id,source_news表,外键,如果为空则表示该新闻为原创文章',
partner varchar(50) comment '合作伙伴,partner新闻合作伙伴表id,外键',
`media` varchar(50) comment '来源媒体,新闻来源的媒体,外键,对应media表id',
`newsid` varchar(50) comment '源ID,新闻合作伙伴推送过来时自带的新闻id',
`author` varchar(50) comment '作者,新闻发布的作者',
`digest` varchar(200) comment '新闻内容摘要,允许为null',
`content` text not null comment '新闻内容,含相关页面标签如等'
,
`ctext` text not null comment '新闻内容,不含相关页面标签',
`title` varchar(200) not null comment '标题',
`img1` varchar(200) comment '图片链接1',
`img2` varchar(200) comment '图片链接2',
`img3` varchar(200) comment '图片链接3',
`newsurl` varchar(200) comment 'http链接,新闻详情指向的URL',
`newsurlhttps` varchar(200) comment 'https链接,新闻详情指向的https URL',
`source_channel` varchar(50) comment '源频道,源频道是合作方提供,到底是频道id还是频道name不用管,用映射关系表和我们的频道进行对应',
`copyright` varchar(500) comment '版权说明',
`type` tinyint default 1 comment '新闻类型,1普通新闻,2图文新闻',
is_contain_image tinyint default 0 comment'是否包含图片,0未知,1包含,2不包含',
image_count int default 0 comment'图片个数',
`newstime` datetime comment '新闻发生时间',
push_time datetime comment '发布时间,此发布时间是在我们系统发布时间,与source_news表的push_time无关',
`remark` varchar(200) comment '备注',
create_admin_user_id int comment '创建人,发布人用户(管理端)id,外键',
update_admin_user_id int comment '最后修改人',
push_admin_user_id int comment '最后发布人',
`valid` tinyint not null default '1' comment '状态,0=无效,1=有效,3=已删除',
`is_auto_import` tinyint not null default 3 comment '是否系统自动导入,1系统自动导入,2人为手动导入,3非导入',
`is_not_review` tinyint not null default 1 comment '是否免审,1需要审核,2无需审核',
`status` tinyint not null default 1 comment '发布状态,1草稿(未修改),2已发布待审核,3审核已驳回,4审核已通过',
`weight_type` tinyint not null default 3 comment '权重类型,1置顶,2热门,3普通',
`weight` int not null default 1 comment '权重值,值越大,权重越高',
`weight_start_time` datetime comment '权重开始时间,如果为空则表示立即生效',
`weight_end_time` datetime comment '权重结束时间,如果为空则表示永久生效',
`weightstr` varchar(2000) not null default '00' comment '所有标签的权重值拼接的字符串',
approve_admin_user_id varchar(50) comment '审批人id,如有多个按分号;分隔',
approve_time datetime comment '最后审核通过时间',
update_time datetime comment '修改时间',
create_time timestamp not null default current_timestamp comment '录入时间'
) engine=innodb default charset=utf8 comment='新闻表';
点击生成。
修改生成后的代码。
生成的结果:
1.能生成完整的前端代码。
2.提供基础的表格json配置文件:
{
"data" : "id",
"table" : "news",
"showName" : "",
"style" : "width: 3%;",
"align" : "center"
},{
"data" : "source_id",//数据库列名
"field" : "sourceId",//实体类属性名
"showName" : " 新闻来源表id",//显示的列名
"style" : "width: 3%;",//列的css样式,一般只设置宽度即可
"searchType" : "browse",//搜索类型,即在表格上方的搜索区域中,该字段使用什么搜索方式,
"refTable" : "source",//该字段所引用的表的表名
"refId" : "id",//该字段所引用的表的列名
"refName" : "name",//最终显示引用的表的列名
"refWhere" : "1=1"//引用的表的条件
},{
"data" : "partner",
"showName" : " 合作伙伴",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "media",
"showName" : " 来源媒体",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "newsid",
"showName" : " 源ID",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "author",
"showName" : " 作者",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "digest",
"showName" : " 新闻内容摘要",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "title",
"showName" : " 标题",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "newsurl",
"showName" : " http链接",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "newsurlhttps",
"showName" : " https链接",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "source_channel",
"showName" : " 源频道",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "copyright",
"showName" : " 版权说明",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "type_name",
"field" : "type",
"showName" : " 新闻类型",
"style" : "width: 3%;",
"searchType" : "option",
},{
"data" : "is_contain_image_name",
"field" : "isContainImage",
"showName" : " 是否包含图片",
"style" : "width: 3%;",
"searchType" : "option",
},{
"data" : "newstime",
"showName" : " 新闻发生时间",
"style" : "width: 6%;",
"searchType" : "date",
"addType" : "none",
"editType" : "none",
"searchWhereKey" : "between",
},{
"data" : "push_time",
"showName" : " 发布时间",
"style" : "width: 6%;",
"searchType" : "date",
"addType" : "none",
"editType" : "none",
"searchWhereKey" : "between",
},{
"data" : "remark",
"showName" : " 备注",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "create_admin_user_id",
"field" : "createAdminUserId",
"showName" : " 创建人",
"style" : "width: 3%;",
"searchType" : "browse",
"refTable" : "create_admin_user",
"refId" : "id",
"refName" : "name",
"refWhere" : "1=1"
},{
"data" : "valid_name",
"field" : "valid",
"showName" : " 状态",
"style" : "width: 3%;",
"searchType" : "option",
},{
"data" : "is_auto_import_name",
"field" : "isAutoImport",
"showName" : " 是否系统自动导入",
"style" : "width: 3%;",
"searchType" : "option",
},{
"data" : "is_not_review_name",
"field" : "isNotReview",
"showName" : " 是否免审",
"style" : "width: 3%;",
"searchType" : "option",
},{
"data" : "status_name",
"field" : "status",
"showName" : " 新闻状态",
"style" : "width: 3%;",
"searchType" : "option",
},{
"data" : "approve_admin_user_id",
"field" : "approveAdminUserId",
"showName" : " 审批人id",
"style" : "width: 3%;",
"searchType" : "browse",
"refTable" : "approve_admin_user",
"refId" : "id",
"refName" : "name",
"refWhere" : "1=1"
},{
"data" : "approve_time",
"showName" : " 最后审核通过时间",
"style" : "width: 6%;",
"searchType" : "date",
"addType" : "none",
"editType" : "none",
"searchWhereKey" : "between",
},{
"data" : "update_time",
"showName" : " 修改时间",
"style" : "width: 6%;",
"searchType" : "date",
"addType" : "none",
"editType" : "none",
"searchWhereKey" : "between",
},{
"data" : "create_time",
"showName" : " 录入时间",
"style" : "width: 6%;",
"searchType" : "date",
"addType" : "none",
"editType" : "none",
"searchWhereKey" : "between",
},{
"data" : "content",
"showName" : " 新闻内容",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "ctext",
"showName" : " 新闻内容",
"style" : "width: 3%;",
"searchType" : "text",
},{
"data" : "",
"showName" : "操作",
"align" : "center"
}
控制列在前端的展示很简单,因为列在前端展示一共有:
1.表格列
2.搜索条件
3.新增数据
4.修改信息
5.展示详情
只需要控制是否在上述功能区域中是否显示、如何显示即可。
目前本人已开发出了一个简略版的mysql+spring boot+spring mvc+mybatis+shiro+jsp+jquery+bootstrap+tomcat