feat:提交初步门户网站后台
This commit is contained in:
parent
3116c7f7b0
commit
e38dd9a39c
1
pom.xml
1
pom.xml
|
@ -23,6 +23,7 @@
|
||||||
<module>yudao-module-mall</module>
|
<module>yudao-module-mall</module>
|
||||||
<module>yudao-module-crm</module>
|
<module>yudao-module-crm</module>
|
||||||
<module>yudao-module-erp</module>
|
<module>yudao-module-erp</module>
|
||||||
|
<module>yudao-module-portal</module>
|
||||||
<!-- <module>yudao-module-iot</module>-->
|
<!-- <module>yudao-module-iot</module>-->
|
||||||
<!-- AI 大模型的开启,请参考 https://doc.iocoder.cn/ai/build/ 文档,对 JDK 版本要要求! -->
|
<!-- AI 大模型的开启,请参考 https://doc.iocoder.cn/ai/build/ 文档,对 JDK 版本要要求! -->
|
||||||
<!-- <module>yudao-module-ai</module>-->
|
<!-- <module>yudao-module-ai</module>-->
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<modules>
|
||||||
|
<module>yudao-module-portal-api</module>
|
||||||
|
<module>yudao-module-portal-biz</module>
|
||||||
|
</modules>
|
||||||
|
<artifactId>yudao-module-portal</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
portal 模块,我们放门户网站业务。
|
||||||
|
例如说:各大品牌官网
|
||||||
|
</description>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,55 @@
|
||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位管理', '', 2, 0, ${table.parentMenuId},
|
||||||
|
'job-post', '', 'portal/jobpost/index', 0, 'JobPost'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位查询', 'portal:job-post:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位创建', 'portal:job-post:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位更新', 'portal:job-post:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位删除', 'portal:job-post:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位导出', 'portal:job-post:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
|
@ -0,0 +1,55 @@
|
||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻管理', '', 2, 0, ${table.parentMenuId},
|
||||||
|
'news', '', 'portal/news/index', 0, 'News'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻查询', 'portal:news:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻创建', 'portal:news:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻更新', 'portal:news:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻删除', 'portal:news:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻导出', 'portal:news:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
|
@ -0,0 +1,55 @@
|
||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻类型管理', '', 2, 0, ${table.parentMenuId},
|
||||||
|
'news-type', '', 'portal/newstype/index', 0, 'NewsType'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻类型查询', 'portal:news-type:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻类型创建', 'portal:news-type:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻类型更新', 'portal:news-type:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻类型删除', 'portal:news-type:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'新闻类型导出', 'portal:news-type:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
|
@ -0,0 +1,55 @@
|
||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'用户管理', '', 2, 0, ${table.parentMenuId},
|
||||||
|
'user', '', 'portal/user/index', 0, 'User'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'用户查询', 'portal:user:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'用户创建', 'portal:user:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'用户更新', 'portal:user:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'用户删除', 'portal:user:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'用户导出', 'portal:user:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
|
@ -0,0 +1,55 @@
|
||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位类别管理', '', 2, 0, ${table.parentMenuId},
|
||||||
|
'job-category', '', 'portal/jobcategory/index', 0, 'JobCategory'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位类别查询', 'portal:job-category:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位类别创建', 'portal:job-category:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位类别更新', 'portal:job-category:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位类别删除', 'portal:job-category:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'职位类别导出', 'portal:job-category:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
|
@ -0,0 +1,55 @@
|
||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'城市管理', '', 2, 0, ${table.parentMenuId},
|
||||||
|
'city', '', 'portal/city/index', 0, 'City'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'城市查询', 'portal:city:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'城市创建', 'portal:city:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'城市更新', 'portal:city:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'城市删除', 'portal:city:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'城市导出', 'portal:city:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
|
@ -0,0 +1,99 @@
|
||||||
|
-- 用户表
|
||||||
|
CREATE TABLE `portal_user` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`username` varchar(50) NOT NULL COMMENT '用户名',
|
||||||
|
`password` varchar(100) NOT NULL COMMENT '密码',
|
||||||
|
`token` varchar(100) DEFAULT NULL COMMENT '登录token',
|
||||||
|
`creator` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) DEFAULT b'0' NOT NULL COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint(20) DEFAULT 0 NOT NULL COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_username` (`username`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
|
||||||
|
|
||||||
|
-- 职位表
|
||||||
|
CREATE TABLE `portal_job_post` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`title` varchar(100) NOT NULL COMMENT '职位标题',
|
||||||
|
`description` text COMMENT '职位描述',
|
||||||
|
`requirement` text COMMENT '职位要求',
|
||||||
|
`city_id` bigint(20) NOT NULL COMMENT '城市ID',
|
||||||
|
`job_category_id` bigint(20) NOT NULL COMMENT '职位类别ID',
|
||||||
|
`publish_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '发布时间',
|
||||||
|
`creator` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) DEFAULT b'0' NOT NULL COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint(20) DEFAULT 0 NOT NULL COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_city` (`city_id`),
|
||||||
|
KEY `idx_category` (`job_category_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='职位表';
|
||||||
|
|
||||||
|
-- 城市表
|
||||||
|
CREATE TABLE `portal_city` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`name` varchar(50) NOT NULL COMMENT '城市名称',
|
||||||
|
`code` varchar(20) NOT NULL COMMENT '城市编码',
|
||||||
|
`creator` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) DEFAULT b'0' NOT NULL COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint(20) DEFAULT 0 NOT NULL COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_code` (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='城市表';
|
||||||
|
|
||||||
|
-- 职位类别表
|
||||||
|
CREATE TABLE `portal_job_category` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`name` varchar(50) NOT NULL COMMENT '类别名称',
|
||||||
|
`parent_id` bigint(20) DEFAULT NULL COMMENT '父类别ID',
|
||||||
|
`creator` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) DEFAULT b'0' NOT NULL COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint(20) DEFAULT 0 NOT NULL COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_parent` (`parent_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='职位类别表';
|
||||||
|
|
||||||
|
-- 新闻表
|
||||||
|
CREATE TABLE `portal_news` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`news_title` varchar(200) NOT NULL COMMENT '新闻标题',
|
||||||
|
`news_desc` varchar(500) DEFAULT NULL COMMENT '新闻描述',
|
||||||
|
`news_content` text NOT NULL COMMENT '新闻内容',
|
||||||
|
`news_path` varchar(100) NOT NULL COMMENT '新闻路径',
|
||||||
|
`cover_img` varchar(255) DEFAULT NULL COMMENT '封面图片',
|
||||||
|
`news_type_id` bigint(20) NOT NULL COMMENT '新闻类型ID',
|
||||||
|
`publish_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '发布时间',
|
||||||
|
`creator` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) DEFAULT b'0' NOT NULL COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint(20) DEFAULT 0 NOT NULL COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_path` (`news_path`),
|
||||||
|
KEY `idx_type` (`news_type_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='新闻表';
|
||||||
|
|
||||||
|
-- 新闻类型表
|
||||||
|
CREATE TABLE `portal_news_type` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`type_name` varchar(50) NOT NULL COMMENT '类型名称',
|
||||||
|
`creator` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT '' NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) DEFAULT b'0' NOT NULL COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint(20) DEFAULT 0 NOT NULL COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='新闻类型表';
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-portal</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>yudao-module-portal-api</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
portal 模块 API,暴露给其它模块调用
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 参数校验 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.enums;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report 错误码枚举类
|
||||||
|
*
|
||||||
|
* report 系统,使用 1-003-000-000 段
|
||||||
|
*/
|
||||||
|
public interface ErrorCodeConstants {
|
||||||
|
|
||||||
|
// ========== portal 模块 1_012_000_000 ==========
|
||||||
|
ErrorCode JOB_POST_NOT_EXISTS = new ErrorCode(1_012_000_000, "职位不存在");
|
||||||
|
ErrorCode NEWS_NOT_EXISTS = new ErrorCode(1_012_000_000, "新闻不存在");
|
||||||
|
ErrorCode NEWS_TYPE_NOT_EXISTS = new ErrorCode( 1_012_000_000, "新闻类型不存在");
|
||||||
|
ErrorCode USER_NOT_EXISTS = new ErrorCode( 1_012_000_000, "用户不存在");
|
||||||
|
ErrorCode JOB_CATEGORY_NOT_EXISTS = new ErrorCode( 1_012_000_000, "职位类别不存在");
|
||||||
|
ErrorCode CITY_NOT_EXISTS = new ErrorCode( 1_012_000_000, "城市不存在");
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
/**
|
||||||
|
* 占位,避免 api 目录无文件时,git 无法提交
|
||||||
|
*/
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-portal</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>yudao-module-portal-biz</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
portal 模块,我们放门户网站业务。
|
||||||
|
例如说:品牌官网
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-portal-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-system-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-infra-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 消息队列相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,95 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.city;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.city.CityDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.city.CityService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 城市")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/city")
|
||||||
|
@Validated
|
||||||
|
public class CityController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityService cityService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建城市")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:city:create')")
|
||||||
|
public CommonResult<Long> createCity(@Valid @RequestBody CitySaveReqVO createReqVO) {
|
||||||
|
return success(cityService.createCity(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新城市")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:city:update')")
|
||||||
|
public CommonResult<Boolean> updateCity(@Valid @RequestBody CitySaveReqVO updateReqVO) {
|
||||||
|
cityService.updateCity(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除城市")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:city:delete')")
|
||||||
|
public CommonResult<Boolean> deleteCity(@RequestParam("id") Long id) {
|
||||||
|
cityService.deleteCity(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得城市")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:city:query')")
|
||||||
|
public CommonResult<CityRespVO> getCity(@RequestParam("id") Long id) {
|
||||||
|
CityDO city = cityService.getCity(id);
|
||||||
|
return success(BeanUtils.toBean(city, CityRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得城市分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:city:query')")
|
||||||
|
public CommonResult<PageResult<CityRespVO>> getCityPage(@Valid CityPageReqVO pageReqVO) {
|
||||||
|
PageResult<CityDO> pageResult = cityService.getCityPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, CityRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出城市 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:city:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportCityExcel(@Valid CityPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<CityDO> list = cityService.getCityPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "城市.xls", "数据", CityRespVO.class,
|
||||||
|
BeanUtils.toBean(list, CityRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.city.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 城市分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class CityPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "城市名称", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "城市编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.city.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 城市 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class CityRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7162")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "城市名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||||
|
@ExcelProperty("城市名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "城市编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("城市编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.city.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 城市新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class CitySaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7162")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "城市名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||||
|
@NotEmpty(message = "城市名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "城市编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "城市编码不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobcategory;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobcategory.JobCategoryDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.jobcategory.JobCategoryService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 职位类别")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/job-category")
|
||||||
|
@Validated
|
||||||
|
public class JobCategoryController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JobCategoryService jobCategoryService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建职位类别")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-category:create')")
|
||||||
|
public CommonResult<Long> createJobCategory(@Valid @RequestBody JobCategorySaveReqVO createReqVO) {
|
||||||
|
return success(jobCategoryService.createJobCategory(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新职位类别")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-category:update')")
|
||||||
|
public CommonResult<Boolean> updateJobCategory(@Valid @RequestBody JobCategorySaveReqVO updateReqVO) {
|
||||||
|
jobCategoryService.updateJobCategory(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除职位类别")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-category:delete')")
|
||||||
|
public CommonResult<Boolean> deleteJobCategory(@RequestParam("id") Long id) {
|
||||||
|
jobCategoryService.deleteJobCategory(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得职位类别")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-category:query')")
|
||||||
|
public CommonResult<JobCategoryRespVO> getJobCategory(@RequestParam("id") Long id) {
|
||||||
|
JobCategoryDO jobCategory = jobCategoryService.getJobCategory(id);
|
||||||
|
return success(BeanUtils.toBean(jobCategory, JobCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得职位类别分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-category:query')")
|
||||||
|
public CommonResult<PageResult<JobCategoryRespVO>> getJobCategoryPage(@Valid JobCategoryPageReqVO pageReqVO) {
|
||||||
|
PageResult<JobCategoryDO> pageResult = jobCategoryService.getJobCategoryPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, JobCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出职位类别 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-category:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportJobCategoryExcel(@Valid JobCategoryPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<JobCategoryDO> list = jobCategoryService.getJobCategoryPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "职位类别.xls", "数据", JobCategoryRespVO.class,
|
||||||
|
BeanUtils.toBean(list, JobCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 职位类别分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class JobCategoryPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "类别名称", example = "赵六")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "父类别ID", example = "8012")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 职位类别 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class JobCategoryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12274")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "类别名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||||
|
@ExcelProperty("类别名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "父类别ID", example = "8012")
|
||||||
|
@ExcelProperty("父类别ID")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 职位类别新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class JobCategorySaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12274")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "类别名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||||
|
@NotEmpty(message = "类别名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "父类别ID", example = "8012")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobpost;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobpost.JobPostDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.jobpost.JobPostService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 职位")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/job-post")
|
||||||
|
@Validated
|
||||||
|
public class JobPostController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JobPostService jobPostService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建职位")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-post:create')")
|
||||||
|
public CommonResult<Long> createJobPost(@Valid @RequestBody JobPostSaveReqVO createReqVO) {
|
||||||
|
return success(jobPostService.createJobPost(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新职位")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-post:update')")
|
||||||
|
public CommonResult<Boolean> updateJobPost(@Valid @RequestBody JobPostSaveReqVO updateReqVO) {
|
||||||
|
jobPostService.updateJobPost(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除职位")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-post:delete')")
|
||||||
|
public CommonResult<Boolean> deleteJobPost(@RequestParam("id") Long id) {
|
||||||
|
jobPostService.deleteJobPost(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得职位")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-post:query')")
|
||||||
|
public CommonResult<JobPostRespVO> getJobPost(@RequestParam("id") Long id) {
|
||||||
|
JobPostDO jobPost = jobPostService.getJobPost(id);
|
||||||
|
return success(BeanUtils.toBean(jobPost, JobPostRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得职位分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-post:query')")
|
||||||
|
public CommonResult<PageResult<JobPostRespVO>> getJobPostPage(@Valid JobPostPageReqVO pageReqVO) {
|
||||||
|
PageResult<JobPostDO> pageResult = jobPostService.getJobPostPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, JobPostRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出职位 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:job-post:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportJobPostExcel(@Valid JobPostPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<JobPostDO> list = jobPostService.getJobPostPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "职位.xls", "数据", JobPostRespVO.class,
|
||||||
|
BeanUtils.toBean(list, JobPostRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 职位分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class JobPostPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "职位标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "职位描述", example = "随便")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "职位要求")
|
||||||
|
private String requirement;
|
||||||
|
|
||||||
|
@Schema(description = "城市ID", example = "12580")
|
||||||
|
private Long cityId;
|
||||||
|
|
||||||
|
@Schema(description = "职位类别ID", example = "7839")
|
||||||
|
private Long jobCategoryId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] publishTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 职位 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class JobPostRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15137")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "职位标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("职位标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "职位描述", example = "随便")
|
||||||
|
@ExcelProperty("职位描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "职位要求")
|
||||||
|
@ExcelProperty("职位要求")
|
||||||
|
private String requirement;
|
||||||
|
|
||||||
|
@Schema(description = "城市ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12580")
|
||||||
|
@ExcelProperty("城市ID")
|
||||||
|
private Long cityId;
|
||||||
|
|
||||||
|
@Schema(description = "职位类别ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7839")
|
||||||
|
@ExcelProperty("职位类别ID")
|
||||||
|
private Long jobCategoryId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
@ExcelProperty("发布时间")
|
||||||
|
private LocalDateTime publishTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 职位新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class JobPostSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15137")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "职位标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "职位标题不能为空")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "职位描述", example = "随便")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "职位要求")
|
||||||
|
private String requirement;
|
||||||
|
|
||||||
|
@Schema(description = "城市ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12580")
|
||||||
|
@NotNull(message = "城市ID不能为空")
|
||||||
|
private Long cityId;
|
||||||
|
|
||||||
|
@Schema(description = "职位类别ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7839")
|
||||||
|
@NotNull(message = "职位类别ID不能为空")
|
||||||
|
private Long jobCategoryId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
private LocalDateTime publishTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.news;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.news.NewsDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.news.NewsService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 新闻")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/news")
|
||||||
|
@Validated
|
||||||
|
public class NewsController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NewsService newsService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建新闻")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news:create')")
|
||||||
|
public CommonResult<Long> createNews(@Valid @RequestBody NewsSaveReqVO createReqVO) {
|
||||||
|
return success(newsService.createNews(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新新闻")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news:update')")
|
||||||
|
public CommonResult<Boolean> updateNews(@Valid @RequestBody NewsSaveReqVO updateReqVO) {
|
||||||
|
newsService.updateNews(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除新闻")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news:delete')")
|
||||||
|
public CommonResult<Boolean> deleteNews(@RequestParam("id") Long id) {
|
||||||
|
newsService.deleteNews(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得新闻")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news:query')")
|
||||||
|
public CommonResult<NewsRespVO> getNews(@RequestParam("id") Long id) {
|
||||||
|
NewsDO news = newsService.getNews(id);
|
||||||
|
return success(BeanUtils.toBean(news, NewsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得新闻分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news:query')")
|
||||||
|
public CommonResult<PageResult<NewsRespVO>> getNewsPage(@Valid NewsPageReqVO pageReqVO) {
|
||||||
|
PageResult<NewsDO> pageResult = newsService.getNewsPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, NewsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出新闻 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportNewsExcel(@Valid NewsPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<NewsDO> list = newsService.getNewsPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "新闻.xls", "数据", NewsRespVO.class,
|
||||||
|
BeanUtils.toBean(list, NewsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.news.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 新闻分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class NewsPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "新闻标题")
|
||||||
|
private String newsTitle;
|
||||||
|
|
||||||
|
@Schema(description = "新闻描述")
|
||||||
|
private String newsDesc;
|
||||||
|
|
||||||
|
@Schema(description = "新闻内容")
|
||||||
|
private String newsContent;
|
||||||
|
|
||||||
|
@Schema(description = "新闻路径")
|
||||||
|
private String newsPath;
|
||||||
|
|
||||||
|
@Schema(description = "封面图片")
|
||||||
|
private String coverImg;
|
||||||
|
|
||||||
|
@Schema(description = "新闻类型ID", example = "23155")
|
||||||
|
private Long newsTypeId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] publishTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.news.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 新闻 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class NewsRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7907")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "新闻标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("新闻标题")
|
||||||
|
private String newsTitle;
|
||||||
|
|
||||||
|
@Schema(description = "新闻描述")
|
||||||
|
@ExcelProperty("新闻描述")
|
||||||
|
private String newsDesc;
|
||||||
|
|
||||||
|
@Schema(description = "新闻内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("新闻内容")
|
||||||
|
private String newsContent;
|
||||||
|
|
||||||
|
@Schema(description = "新闻路径", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("新闻路径")
|
||||||
|
private String newsPath;
|
||||||
|
|
||||||
|
@Schema(description = "封面图片")
|
||||||
|
@ExcelProperty("封面图片")
|
||||||
|
private String coverImg;
|
||||||
|
|
||||||
|
@Schema(description = "新闻类型ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23155")
|
||||||
|
@ExcelProperty("新闻类型ID")
|
||||||
|
private Long newsTypeId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
@ExcelProperty("发布时间")
|
||||||
|
private LocalDateTime publishTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.news.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 新闻新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class NewsSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7907")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "新闻标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "新闻标题不能为空")
|
||||||
|
private String newsTitle;
|
||||||
|
|
||||||
|
@Schema(description = "新闻描述")
|
||||||
|
private String newsDesc;
|
||||||
|
|
||||||
|
@Schema(description = "新闻内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "新闻内容不能为空")
|
||||||
|
private String newsContent;
|
||||||
|
|
||||||
|
@Schema(description = "新闻路径", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "新闻路径不能为空")
|
||||||
|
private String newsPath;
|
||||||
|
|
||||||
|
@Schema(description = "封面图片")
|
||||||
|
private String coverImg;
|
||||||
|
|
||||||
|
@Schema(description = "新闻类型ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23155")
|
||||||
|
@NotNull(message = "新闻类型ID不能为空")
|
||||||
|
private Long newsTypeId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
private LocalDateTime publishTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.newstype;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.newstype.NewsTypeDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.newstype.NewsTypeService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 新闻类型")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/news-type")
|
||||||
|
@Validated
|
||||||
|
public class NewsTypeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NewsTypeService newsTypeService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建新闻类型")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news-type:create')")
|
||||||
|
public CommonResult<Long> createNewsType(@Valid @RequestBody NewsTypeSaveReqVO createReqVO) {
|
||||||
|
return success(newsTypeService.createNewsType(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新新闻类型")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news-type:update')")
|
||||||
|
public CommonResult<Boolean> updateNewsType(@Valid @RequestBody NewsTypeSaveReqVO updateReqVO) {
|
||||||
|
newsTypeService.updateNewsType(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除新闻类型")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news-type:delete')")
|
||||||
|
public CommonResult<Boolean> deleteNewsType(@RequestParam("id") Long id) {
|
||||||
|
newsTypeService.deleteNewsType(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得新闻类型")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news-type:query')")
|
||||||
|
public CommonResult<NewsTypeRespVO> getNewsType(@RequestParam("id") Long id) {
|
||||||
|
NewsTypeDO newsType = newsTypeService.getNewsType(id);
|
||||||
|
return success(BeanUtils.toBean(newsType, NewsTypeRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得新闻类型分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news-type:query')")
|
||||||
|
public CommonResult<PageResult<NewsTypeRespVO>> getNewsTypePage(@Valid NewsTypePageReqVO pageReqVO) {
|
||||||
|
PageResult<NewsTypeDO> pageResult = newsTypeService.getNewsTypePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, NewsTypeRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出新闻类型 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:news-type:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportNewsTypeExcel(@Valid NewsTypePageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<NewsTypeDO> list = newsTypeService.getNewsTypePage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "新闻类型.xls", "数据", NewsTypeRespVO.class,
|
||||||
|
BeanUtils.toBean(list, NewsTypeRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.newstype.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 新闻类型分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class NewsTypePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "类型名称", example = "王五")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.newstype.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 新闻类型 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class NewsTypeRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22991")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@ExcelProperty("类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.newstype.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 新闻类型新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class NewsTypeSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22991")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@NotEmpty(message = "类型名称不能为空")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.portaluser;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.portaluser.PortalUserDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.user.PortalUserService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/user")
|
||||||
|
@Validated
|
||||||
|
public class PortalUserController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PortalUserService userService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:user:create')")
|
||||||
|
public CommonResult<Long> createUser(@Valid @RequestBody PortalUserSaveReqVO createReqVO) {
|
||||||
|
return success(userService.createUser(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:user:update')")
|
||||||
|
public CommonResult<Boolean> updateUser(@Valid @RequestBody PortalUserSaveReqVO updateReqVO) {
|
||||||
|
userService.updateUser(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:user:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUser(@RequestParam("id") Long id) {
|
||||||
|
userService.deleteUser(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:user:query')")
|
||||||
|
public CommonResult<PortalUserRespVO> getUser(@RequestParam("id") Long id) {
|
||||||
|
PortalUserDO user = userService.getUser(id);
|
||||||
|
return success(BeanUtils.toBean(user, PortalUserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:user:query')")
|
||||||
|
public CommonResult<PageResult<PortalUserRespVO>> getUserPage(@Valid PortalUserPageReqVO pageReqVO) {
|
||||||
|
PageResult<PortalUserDO> pageResult = userService.getUserPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, PortalUserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('portal:user:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserExcel(@Valid PortalUserPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<PortalUserDO> list = userService.getUserPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户.xls", "数据", PortalUserRespVO.class,
|
||||||
|
BeanUtils.toBean(list, PortalUserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class PortalUserPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "用户名", example = "李四")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Schema(description = "密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Schema(description = "登录token")
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class PortalUserRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "943")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@ExcelProperty("用户名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Schema(description = "登录token")
|
||||||
|
@ExcelProperty("登录token")
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class PortalUserSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "943")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@NotEmpty(message = "用户名不能为空")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "密码不能为空")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Schema(description = "登录token")
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.app.city;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.CityPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.CityRespVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.CitySaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.city.CityDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.city.CityService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 城市")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/city")
|
||||||
|
@Validated
|
||||||
|
public class AppCityController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityService cityService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建城市")
|
||||||
|
public CommonResult<Long> createCity(@Valid @RequestBody CitySaveReqVO createReqVO) {
|
||||||
|
return success(cityService.createCity(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新城市")
|
||||||
|
public CommonResult<Boolean> updateCity(@Valid @RequestBody CitySaveReqVO updateReqVO) {
|
||||||
|
cityService.updateCity(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除城市")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteCity(@RequestParam("id") Long id) {
|
||||||
|
cityService.deleteCity(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得城市")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<CityRespVO> getCity(@RequestParam("id") Long id) {
|
||||||
|
CityDO city = cityService.getCity(id);
|
||||||
|
return success(BeanUtils.toBean(city, CityRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得城市分页")
|
||||||
|
public CommonResult<PageResult<CityRespVO>> getCityPage(@Valid CityPageReqVO pageReqVO) {
|
||||||
|
PageResult<CityDO> pageResult = cityService.getCityPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, CityRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出城市 Excel")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportCityExcel(@Valid CityPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<CityDO> list = cityService.getCityPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "城市.xls", "数据", CityRespVO.class,
|
||||||
|
BeanUtils.toBean(list, CityRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.app.jobcategory;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.JobCategoryPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.JobCategoryRespVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.JobCategorySaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobcategory.JobCategoryDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.jobcategory.JobCategoryService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 职位类别")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/job-category")
|
||||||
|
@Validated
|
||||||
|
public class AppJobCategoryController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JobCategoryService jobCategoryService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建职位类别")
|
||||||
|
public CommonResult<Long> createJobCategory(@Valid @RequestBody JobCategorySaveReqVO createReqVO) {
|
||||||
|
return success(jobCategoryService.createJobCategory(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新职位类别")
|
||||||
|
public CommonResult<Boolean> updateJobCategory(@Valid @RequestBody JobCategorySaveReqVO updateReqVO) {
|
||||||
|
jobCategoryService.updateJobCategory(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除职位类别")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteJobCategory(@RequestParam("id") Long id) {
|
||||||
|
jobCategoryService.deleteJobCategory(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得职位类别")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<JobCategoryRespVO> getJobCategory(@RequestParam("id") Long id) {
|
||||||
|
JobCategoryDO jobCategory = jobCategoryService.getJobCategory(id);
|
||||||
|
return success(BeanUtils.toBean(jobCategory, JobCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得职位类别分页")
|
||||||
|
public CommonResult<PageResult<JobCategoryRespVO>> getJobCategoryPage(@Valid JobCategoryPageReqVO pageReqVO) {
|
||||||
|
PageResult<JobCategoryDO> pageResult = jobCategoryService.getJobCategoryPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, JobCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出职位类别 Excel")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportJobCategoryExcel(@Valid JobCategoryPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<JobCategoryDO> list = jobCategoryService.getJobCategoryPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "职位类别.xls", "数据", JobCategoryRespVO.class,
|
||||||
|
BeanUtils.toBean(list, JobCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.app.jobpost;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.JobPostPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.JobPostRespVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.JobPostSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobpost.JobPostDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.jobpost.JobPostService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 职位")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/job-post")
|
||||||
|
@Validated
|
||||||
|
public class AppJobPostController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JobPostService jobPostService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建职位")
|
||||||
|
public CommonResult<Long> createJobPost(@Valid @RequestBody JobPostSaveReqVO createReqVO) {
|
||||||
|
return success(jobPostService.createJobPost(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新职位")
|
||||||
|
public CommonResult<Boolean> updateJobPost(@Valid @RequestBody JobPostSaveReqVO updateReqVO) {
|
||||||
|
jobPostService.updateJobPost(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除职位")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteJobPost(@RequestParam("id") Long id) {
|
||||||
|
jobPostService.deleteJobPost(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得职位")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<JobPostRespVO> getJobPost(@RequestParam("id") Long id) {
|
||||||
|
JobPostDO jobPost = jobPostService.getJobPost(id);
|
||||||
|
return success(BeanUtils.toBean(jobPost, JobPostRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得职位分页")
|
||||||
|
public CommonResult<PageResult<JobPostRespVO>> getJobPostPage(@Valid JobPostPageReqVO pageReqVO) {
|
||||||
|
PageResult<JobPostDO> pageResult = jobPostService.getJobPostPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, JobPostRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出职位 Excel")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportJobPostExcel(@Valid JobPostPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<JobPostDO> list = jobPostService.getJobPostPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "职位.xls", "数据", JobPostRespVO.class,
|
||||||
|
BeanUtils.toBean(list, JobPostRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.app.news;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.NewsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.NewsRespVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.NewsSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.news.NewsDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.news.NewsService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 新闻")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/news")
|
||||||
|
@Validated
|
||||||
|
public class AppNewsController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NewsService newsService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建新闻")
|
||||||
|
public CommonResult<Long> createNews(@Valid @RequestBody NewsSaveReqVO createReqVO) {
|
||||||
|
return success(newsService.createNews(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新新闻")
|
||||||
|
public CommonResult<Boolean> updateNews(@Valid @RequestBody NewsSaveReqVO updateReqVO) {
|
||||||
|
newsService.updateNews(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除新闻")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteNews(@RequestParam("id") Long id) {
|
||||||
|
newsService.deleteNews(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得新闻")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<NewsRespVO> getNews(@RequestParam("id") Long id) {
|
||||||
|
NewsDO news = newsService.getNews(id);
|
||||||
|
return success(BeanUtils.toBean(news, NewsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得新闻分页")
|
||||||
|
public CommonResult<PageResult<NewsRespVO>> getNewsPage(@Valid NewsPageReqVO pageReqVO) {
|
||||||
|
PageResult<NewsDO> pageResult = newsService.getNewsPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, NewsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出新闻 Excel")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportNewsExcel(@Valid NewsPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<NewsDO> list = newsService.getNewsPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "新闻.xls", "数据", NewsRespVO.class,
|
||||||
|
BeanUtils.toBean(list, NewsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.app.newstype;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.NewsTypePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.NewsTypeRespVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.NewsTypeSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.newstype.NewsTypeDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.newstype.NewsTypeService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 新闻类型")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/news-type")
|
||||||
|
@Validated
|
||||||
|
public class AppNewsTypeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NewsTypeService newsTypeService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建新闻类型")
|
||||||
|
public CommonResult<Long> createNewsType(@Valid @RequestBody NewsTypeSaveReqVO createReqVO) {
|
||||||
|
return success(newsTypeService.createNewsType(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新新闻类型")
|
||||||
|
public CommonResult<Boolean> updateNewsType(@Valid @RequestBody NewsTypeSaveReqVO updateReqVO) {
|
||||||
|
newsTypeService.updateNewsType(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除新闻类型")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteNewsType(@RequestParam("id") Long id) {
|
||||||
|
newsTypeService.deleteNewsType(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得新闻类型")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<NewsTypeRespVO> getNewsType(@RequestParam("id") Long id) {
|
||||||
|
NewsTypeDO newsType = newsTypeService.getNewsType(id);
|
||||||
|
return success(BeanUtils.toBean(newsType, NewsTypeRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得新闻类型分页")
|
||||||
|
public CommonResult<PageResult<NewsTypeRespVO>> getNewsTypePage(@Valid NewsTypePageReqVO pageReqVO) {
|
||||||
|
PageResult<NewsTypeDO> pageResult = newsTypeService.getNewsTypePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, NewsTypeRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出新闻类型 Excel")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportNewsTypeExcel(@Valid NewsTypePageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<NewsTypeDO> list = newsTypeService.getNewsTypePage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "新闻类型.xls", "数据", NewsTypeRespVO.class,
|
||||||
|
BeanUtils.toBean(list, NewsTypeRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.controller.app.portaluser;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.PortalUserPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.PortalUserRespVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.PortalUserSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.portaluser.PortalUserDO;
|
||||||
|
import cn.iocoder.yudao.module.portal.service.user.PortalUserService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/portal/user")
|
||||||
|
@Validated
|
||||||
|
public class AppPortalUserController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PortalUserService userService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户")
|
||||||
|
public CommonResult<Long> createUser(@Valid @RequestBody PortalUserSaveReqVO createReqVO) {
|
||||||
|
return success(userService.createUser(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户")
|
||||||
|
public CommonResult<Boolean> updateUser(@Valid @RequestBody PortalUserSaveReqVO updateReqVO) {
|
||||||
|
userService.updateUser(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteUser(@RequestParam("id") Long id) {
|
||||||
|
userService.deleteUser(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<PortalUserRespVO> getUser(@RequestParam("id") Long id) {
|
||||||
|
PortalUserDO user = userService.getUser(id);
|
||||||
|
return success(BeanUtils.toBean(user, PortalUserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户分页")
|
||||||
|
public CommonResult<PageResult<PortalUserRespVO>> getUserPage(@Valid PortalUserPageReqVO pageReqVO) {
|
||||||
|
PageResult<PortalUserDO> pageResult = userService.getUserPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, PortalUserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户 Excel")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserExcel(@Valid PortalUserPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<PortalUserDO> list = userService.getUserPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户.xls", "数据", PortalUserRespVO.class,
|
||||||
|
BeanUtils.toBean(list, PortalUserRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.dataobject.city;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市 DO
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@TableName("portal_city")
|
||||||
|
@KeySequence("portal_city_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CityDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 城市名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 城市编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.dataobject.jobcategory;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位类别 DO
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@TableName("portal_job_category")
|
||||||
|
@KeySequence("portal_job_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class JobCategoryDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 类别名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 父类别ID
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.dataobject.jobpost;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位 DO
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@TableName("portal_job_post")
|
||||||
|
@KeySequence("portal_job_post_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class JobPostDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 职位标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 职位描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 职位要求
|
||||||
|
*/
|
||||||
|
private String requirement;
|
||||||
|
/**
|
||||||
|
* 城市ID
|
||||||
|
*/
|
||||||
|
private Long cityId;
|
||||||
|
/**
|
||||||
|
* 职位类别ID
|
||||||
|
*/
|
||||||
|
private Long jobCategoryId;
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime publishTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.dataobject.news;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻 DO
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@TableName("portal_news")
|
||||||
|
@KeySequence("portal_news_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class NewsDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 新闻标题
|
||||||
|
*/
|
||||||
|
private String newsTitle;
|
||||||
|
/**
|
||||||
|
* 新闻描述
|
||||||
|
*/
|
||||||
|
private String newsDesc;
|
||||||
|
/**
|
||||||
|
* 新闻内容
|
||||||
|
*/
|
||||||
|
private String newsContent;
|
||||||
|
/**
|
||||||
|
* 新闻路径
|
||||||
|
*/
|
||||||
|
private String newsPath;
|
||||||
|
/**
|
||||||
|
* 封面图片
|
||||||
|
*/
|
||||||
|
private String coverImg;
|
||||||
|
/**
|
||||||
|
* 新闻类型ID
|
||||||
|
*/
|
||||||
|
private Long newsTypeId;
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime publishTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.dataobject.newstype;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻类型 DO
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@TableName("portal_news_type")
|
||||||
|
@KeySequence("portal_news_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class NewsTypeDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 类型名称
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.dataobject.portaluser;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户 DO
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@TableName("portal_user")
|
||||||
|
@KeySequence("portal_user_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PortalUserDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* 登录token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.mysql.city;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.city.CityDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市 Mapper
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CityMapper extends BaseMapperX<CityDO> {
|
||||||
|
|
||||||
|
default PageResult<CityDO> selectPage(CityPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<CityDO>()
|
||||||
|
.likeIfPresent(CityDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(CityDO::getCode, reqVO.getCode())
|
||||||
|
.betweenIfPresent(CityDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(CityDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.mysql.jobcategory;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobcategory.JobCategoryDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位类别 Mapper
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface JobCategoryMapper extends BaseMapperX<JobCategoryDO> {
|
||||||
|
|
||||||
|
default PageResult<JobCategoryDO> selectPage(JobCategoryPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<JobCategoryDO>()
|
||||||
|
.likeIfPresent(JobCategoryDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(JobCategoryDO::getParentId, reqVO.getParentId())
|
||||||
|
.betweenIfPresent(JobCategoryDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(JobCategoryDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.mysql.jobpost;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobpost.JobPostDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位 Mapper
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface JobPostMapper extends BaseMapperX<JobPostDO> {
|
||||||
|
|
||||||
|
default PageResult<JobPostDO> selectPage(JobPostPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<JobPostDO>()
|
||||||
|
.eqIfPresent(JobPostDO::getTitle, reqVO.getTitle())
|
||||||
|
.eqIfPresent(JobPostDO::getDescription, reqVO.getDescription())
|
||||||
|
.eqIfPresent(JobPostDO::getRequirement, reqVO.getRequirement())
|
||||||
|
.eqIfPresent(JobPostDO::getCityId, reqVO.getCityId())
|
||||||
|
.eqIfPresent(JobPostDO::getJobCategoryId, reqVO.getJobCategoryId())
|
||||||
|
.betweenIfPresent(JobPostDO::getPublishTime, reqVO.getPublishTime())
|
||||||
|
.betweenIfPresent(JobPostDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(JobPostDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.mysql.news;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.news.NewsDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻 Mapper
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NewsMapper extends BaseMapperX<NewsDO> {
|
||||||
|
|
||||||
|
default PageResult<NewsDO> selectPage(NewsPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<NewsDO>()
|
||||||
|
.eqIfPresent(NewsDO::getNewsTitle, reqVO.getNewsTitle())
|
||||||
|
.eqIfPresent(NewsDO::getNewsDesc, reqVO.getNewsDesc())
|
||||||
|
.eqIfPresent(NewsDO::getNewsContent, reqVO.getNewsContent())
|
||||||
|
.eqIfPresent(NewsDO::getNewsPath, reqVO.getNewsPath())
|
||||||
|
.eqIfPresent(NewsDO::getCoverImg, reqVO.getCoverImg())
|
||||||
|
.eqIfPresent(NewsDO::getNewsTypeId, reqVO.getNewsTypeId())
|
||||||
|
.betweenIfPresent(NewsDO::getPublishTime, reqVO.getPublishTime())
|
||||||
|
.betweenIfPresent(NewsDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(NewsDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.mysql.newstype;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.newstype.NewsTypeDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻类型 Mapper
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NewsTypeMapper extends BaseMapperX<NewsTypeDO> {
|
||||||
|
|
||||||
|
default PageResult<NewsTypeDO> selectPage(NewsTypePageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<NewsTypeDO>()
|
||||||
|
.likeIfPresent(NewsTypeDO::getTypeName, reqVO.getTypeName())
|
||||||
|
.betweenIfPresent(NewsTypeDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(NewsTypeDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.dal.mysql.portaluser;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.portaluser.PortalUserDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户 Mapper
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface PortalUserMapper extends BaseMapperX<PortalUserDO> {
|
||||||
|
|
||||||
|
default PageResult<PortalUserDO> selectPage(PortalUserPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<PortalUserDO>()
|
||||||
|
.likeIfPresent(PortalUserDO::getUsername, reqVO.getUsername())
|
||||||
|
.eqIfPresent(PortalUserDO::getPassword, reqVO.getPassword())
|
||||||
|
.eqIfPresent(PortalUserDO::getToken, reqVO.getToken())
|
||||||
|
.betweenIfPresent(PortalUserDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(PortalUserDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.city;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.city.CityDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市 Service 接口
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
public interface CityService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建城市
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createCity(@Valid CitySaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新城市
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateCity(@Valid CitySaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除城市
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteCity(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得城市
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 城市
|
||||||
|
*/
|
||||||
|
CityDO getCity(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得城市分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 城市分页
|
||||||
|
*/
|
||||||
|
PageResult<CityDO> getCityPage(CityPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.city;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.city.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.city.CityDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.mysql.city.CityMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.portal.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class CityServiceImpl implements CityService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityMapper cityMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createCity(CitySaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
CityDO city = BeanUtils.toBean(createReqVO, CityDO.class);
|
||||||
|
cityMapper.insert(city);
|
||||||
|
// 返回
|
||||||
|
return city.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCity(CitySaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateCityExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
CityDO updateObj = BeanUtils.toBean(updateReqVO, CityDO.class);
|
||||||
|
cityMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteCity(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateCityExists(id);
|
||||||
|
// 删除
|
||||||
|
cityMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateCityExists(Long id) {
|
||||||
|
if (cityMapper.selectById(id) == null) {
|
||||||
|
throw exception(CITY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CityDO getCity(Long id) {
|
||||||
|
return cityMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<CityDO> getCityPage(CityPageReqVO pageReqVO) {
|
||||||
|
return cityMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.jobcategory;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobcategory.JobCategoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位类别 Service 接口
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
public interface JobCategoryService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建职位类别
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createJobCategory(@Valid JobCategorySaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新职位类别
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateJobCategory(@Valid JobCategorySaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除职位类别
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteJobCategory(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得职位类别
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 职位类别
|
||||||
|
*/
|
||||||
|
JobCategoryDO getJobCategory(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得职位类别分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 职位类别分页
|
||||||
|
*/
|
||||||
|
PageResult<JobCategoryDO> getJobCategoryPage(JobCategoryPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.jobcategory;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobcategory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobcategory.JobCategoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.mysql.jobcategory.JobCategoryMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.portal.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位类别 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class JobCategoryServiceImpl implements JobCategoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JobCategoryMapper jobCategoryMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createJobCategory(JobCategorySaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
JobCategoryDO jobCategory = BeanUtils.toBean(createReqVO, JobCategoryDO.class);
|
||||||
|
jobCategoryMapper.insert(jobCategory);
|
||||||
|
// 返回
|
||||||
|
return jobCategory.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateJobCategory(JobCategorySaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateJobCategoryExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
JobCategoryDO updateObj = BeanUtils.toBean(updateReqVO, JobCategoryDO.class);
|
||||||
|
jobCategoryMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteJobCategory(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateJobCategoryExists(id);
|
||||||
|
// 删除
|
||||||
|
jobCategoryMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateJobCategoryExists(Long id) {
|
||||||
|
if (jobCategoryMapper.selectById(id) == null) {
|
||||||
|
throw exception(JOB_CATEGORY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JobCategoryDO getJobCategory(Long id) {
|
||||||
|
return jobCategoryMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<JobCategoryDO> getJobCategoryPage(JobCategoryPageReqVO pageReqVO) {
|
||||||
|
return jobCategoryMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.jobpost;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobpost.JobPostDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位 Service 接口
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
public interface JobPostService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建职位
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createJobPost(@Valid JobPostSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新职位
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateJobPost(@Valid JobPostSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除职位
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteJobPost(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得职位
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 职位
|
||||||
|
*/
|
||||||
|
JobPostDO getJobPost(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得职位分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 职位分页
|
||||||
|
*/
|
||||||
|
PageResult<JobPostDO> getJobPostPage(JobPostPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.jobpost;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.jobpost.JobPostDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.mysql.jobpost.JobPostMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.portal.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class JobPostServiceImpl implements JobPostService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JobPostMapper jobPostMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createJobPost(JobPostSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
JobPostDO jobPost = BeanUtils.toBean(createReqVO, JobPostDO.class);
|
||||||
|
jobPostMapper.insert(jobPost);
|
||||||
|
// 返回
|
||||||
|
return jobPost.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateJobPost(JobPostSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateJobPostExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
JobPostDO updateObj = BeanUtils.toBean(updateReqVO, JobPostDO.class);
|
||||||
|
jobPostMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteJobPost(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateJobPostExists(id);
|
||||||
|
// 删除
|
||||||
|
jobPostMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateJobPostExists(Long id) {
|
||||||
|
if (jobPostMapper.selectById(id) == null) {
|
||||||
|
throw exception(JOB_POST_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JobPostDO getJobPost(Long id) {
|
||||||
|
return jobPostMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<JobPostDO> getJobPostPage(JobPostPageReqVO pageReqVO) {
|
||||||
|
return jobPostMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.news;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.news.NewsDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻 Service 接口
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
public interface NewsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新闻
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createNews(@Valid NewsSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新新闻
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateNews(@Valid NewsSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除新闻
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteNews(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得新闻
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 新闻
|
||||||
|
*/
|
||||||
|
NewsDO getNews(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得新闻分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 新闻分页
|
||||||
|
*/
|
||||||
|
PageResult<NewsDO> getNewsPage(NewsPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.news;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.news.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.news.NewsDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.mysql.news.NewsMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.portal.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class NewsServiceImpl implements NewsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NewsMapper newsMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createNews(NewsSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
NewsDO news = BeanUtils.toBean(createReqVO, NewsDO.class);
|
||||||
|
newsMapper.insert(news);
|
||||||
|
// 返回
|
||||||
|
return news.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateNews(NewsSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateNewsExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
NewsDO updateObj = BeanUtils.toBean(updateReqVO, NewsDO.class);
|
||||||
|
newsMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteNews(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateNewsExists(id);
|
||||||
|
// 删除
|
||||||
|
newsMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateNewsExists(Long id) {
|
||||||
|
if (newsMapper.selectById(id) == null) {
|
||||||
|
throw exception(NEWS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NewsDO getNews(Long id) {
|
||||||
|
return newsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<NewsDO> getNewsPage(NewsPageReqVO pageReqVO) {
|
||||||
|
return newsMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.newstype;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.newstype.NewsTypeDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻类型 Service 接口
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
public interface NewsTypeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新闻类型
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createNewsType(@Valid NewsTypeSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新新闻类型
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateNewsType(@Valid NewsTypeSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除新闻类型
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteNewsType(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得新闻类型
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 新闻类型
|
||||||
|
*/
|
||||||
|
NewsTypeDO getNewsType(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得新闻类型分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 新闻类型分页
|
||||||
|
*/
|
||||||
|
PageResult<NewsTypeDO> getNewsTypePage(NewsTypePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.newstype;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.newstype.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.newstype.NewsTypeDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.mysql.newstype.NewsTypeMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.portal.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻类型 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class NewsTypeServiceImpl implements NewsTypeService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NewsTypeMapper newsTypeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createNewsType(NewsTypeSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
NewsTypeDO newsType = BeanUtils.toBean(createReqVO, NewsTypeDO.class);
|
||||||
|
newsTypeMapper.insert(newsType);
|
||||||
|
// 返回
|
||||||
|
return newsType.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateNewsType(NewsTypeSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateNewsTypeExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
NewsTypeDO updateObj = BeanUtils.toBean(updateReqVO, NewsTypeDO.class);
|
||||||
|
newsTypeMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteNewsType(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateNewsTypeExists(id);
|
||||||
|
// 删除
|
||||||
|
newsTypeMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateNewsTypeExists(Long id) {
|
||||||
|
if (newsTypeMapper.selectById(id) == null) {
|
||||||
|
throw exception(NEWS_TYPE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NewsTypeDO getNewsType(Long id) {
|
||||||
|
return newsTypeMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<NewsTypeDO> getNewsTypePage(NewsTypePageReqVO pageReqVO) {
|
||||||
|
return newsTypeMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.user;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.portaluser.PortalUserDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.mysql.portaluser.PortalUserMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.portal.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class PortalServiceImpl implements PortalUserService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PortalUserMapper portalUserMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUser(PortalUserSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
PortalUserDO user = BeanUtils.toBean(createReqVO, PortalUserDO.class);
|
||||||
|
portalUserMapper.insert(user);
|
||||||
|
// 返回
|
||||||
|
return user.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUser(PortalUserSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
PortalUserDO updateObj = BeanUtils.toBean(updateReqVO, PortalUserDO.class);
|
||||||
|
portalUserMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUser(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserExists(id);
|
||||||
|
// 删除
|
||||||
|
portalUserMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateUserExists(Long id) {
|
||||||
|
if (portalUserMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PortalUserDO getUser(Long id) {
|
||||||
|
return portalUserMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<PortalUserDO> getUserPage(PortalUserPageReqVO pageReqVO) {
|
||||||
|
return portalUserMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package cn.iocoder.yudao.module.portal.service.user;
|
||||||
|
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.controller.admin.portaluser.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.portal.dal.dataobject.portaluser.PortalUserDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户 Service 接口
|
||||||
|
*
|
||||||
|
* @author 篮智科技
|
||||||
|
*/
|
||||||
|
public interface PortalUserService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUser(@Valid PortalUserSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUser(@Valid PortalUserSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUser(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
PortalUserDO getUser(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户分页
|
||||||
|
*/
|
||||||
|
PageResult<PortalUserDO> getUserPage(PortalUserPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?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.iocoder.yudao.module.portal.dal.mysql.city.CityMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?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.iocoder.yudao.module.portal.dal.mysql.jobcategory.JobCategoryMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?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.iocoder.yudao.module.portal.dal.mysql.jobpost.JobPostMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?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.iocoder.yudao.module.portal.dal.mysql.news.NewsMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?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.iocoder.yudao.module.portal.dal.mysql.newstype.NewsTypeMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?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.iocoder.yudao.module.portal.dal.mysql.portaluser.PortalUserMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,98 @@
|
||||||
|
package cn.iocoder.yudao.module.member.service.address;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.address.MemberAddressMapper;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.ADDRESS_NOT_EXISTS;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link AddressServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Import(AddressServiceImpl.class)
|
||||||
|
public class MemberAddressServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AddressServiceImpl addressService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberAddressMapper addressMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateAddress_success() {
|
||||||
|
// 准备参数
|
||||||
|
AppAddressCreateReqVO reqVO = randomPojo(AppAddressCreateReqVO.class);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long addressId = addressService.createAddress(randomLongId(), reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(addressId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
MemberAddressDO address = addressMapper.selectById(addressId);
|
||||||
|
assertPojoEquals(reqVO, address);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateAddress_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberAddressDO dbAddress = randomPojo(MemberAddressDO.class);
|
||||||
|
addressMapper.insert(dbAddress);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
AppAddressUpdateReqVO reqVO = randomPojo(AppAddressUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbAddress.getId()); // 设置更新的 ID
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
addressService.updateAddress(dbAddress.getUserId(), reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
MemberAddressDO address = addressMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, address);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateAddress_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
AppAddressUpdateReqVO reqVO = randomPojo(AppAddressUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> addressService.updateAddress(randomLongId(), reqVO), ADDRESS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteAddress_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberAddressDO dbAddress = randomPojo(MemberAddressDO.class);
|
||||||
|
addressMapper.insert(dbAddress);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbAddress.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
addressService.deleteAddress(dbAddress.getUserId(), id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(addressMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteAddress_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> addressService.deleteAddress(randomLongId(), id), ADDRESS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
package cn.iocoder.yudao.module.member.service.auth;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||||
|
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.logger.LoginLogApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.social.SocialUserApi;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
|
||||||
|
|
||||||
|
// TODO @芋艿:单测的 review,等逻辑都达成一致后
|
||||||
|
/**
|
||||||
|
* {@link MemberAuthService} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 宋天
|
||||||
|
*/
|
||||||
|
@Import({MemberAuthServiceImpl.class, YudaoRedisAutoConfiguration.class})
|
||||||
|
public class MemberAuthServiceTest extends BaseDbAndRedisUnitTest {
|
||||||
|
|
||||||
|
// TODO @芋艿:登录相关的单测,待补全
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberAuthServiceImpl authService;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MemberUserService userService;
|
||||||
|
@MockBean
|
||||||
|
private SmsCodeApi smsCodeApi;
|
||||||
|
@MockBean
|
||||||
|
private LoginLogApi loginLogApi;
|
||||||
|
@MockBean
|
||||||
|
private OAuth2TokenApi oauth2TokenApi;
|
||||||
|
@MockBean
|
||||||
|
private SocialUserApi socialUserApi;
|
||||||
|
@MockBean
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserMapper memberUserMapper;
|
||||||
|
|
||||||
|
// TODO 芋艿:后续重构这个单测
|
||||||
|
// @Test
|
||||||
|
// public void testUpdatePassword_success(){
|
||||||
|
// // 准备参数
|
||||||
|
// MemberUserDO userDO = randomUserDO();
|
||||||
|
// memberUserMapper.insert(userDO);
|
||||||
|
//
|
||||||
|
// // 新密码
|
||||||
|
// String newPassword = randomString();
|
||||||
|
//
|
||||||
|
// // 请求实体
|
||||||
|
// AppMemberUserUpdatePasswordReqVO reqVO = AppMemberUserUpdatePasswordReqVO.builder()
|
||||||
|
// .oldPassword(userDO.getPassword())
|
||||||
|
// .password(newPassword)
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// // 测试桩
|
||||||
|
// // 这两个相等是为了返回ture这个结果
|
||||||
|
// when(passwordEncoder.matches(reqVO.getOldPassword(),reqVO.getOldPassword())).thenReturn(true);
|
||||||
|
// when(passwordEncoder.encode(newPassword)).thenReturn(newPassword);
|
||||||
|
//
|
||||||
|
// // 更新用户密码
|
||||||
|
// authService.updatePassword(userDO.getId(), reqVO);
|
||||||
|
// assertEquals(memberUserMapper.selectById(userDO.getId()).getPassword(),newPassword);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// TODO 芋艿:后续重构这个单测
|
||||||
|
// @Test
|
||||||
|
// public void testResetPassword_success(){
|
||||||
|
// // 准备参数
|
||||||
|
// MemberUserDO userDO = randomUserDO();
|
||||||
|
// memberUserMapper.insert(userDO);
|
||||||
|
//
|
||||||
|
// // 随机密码
|
||||||
|
// String password = randomNumbers(11);
|
||||||
|
// // 随机验证码
|
||||||
|
// String code = randomNumbers(4);
|
||||||
|
//
|
||||||
|
// // mock
|
||||||
|
// when(passwordEncoder.encode(password)).thenReturn(password);
|
||||||
|
//
|
||||||
|
// // 更新用户密码
|
||||||
|
// AppMemberUserResetPasswordReqVO reqVO = new AppMemberUserResetPasswordReqVO();
|
||||||
|
// reqVO.setMobile(userDO.getMobile());
|
||||||
|
// reqVO.setPassword(password);
|
||||||
|
// reqVO.setCode(code);
|
||||||
|
//
|
||||||
|
// authService.resetPassword(reqVO);
|
||||||
|
// assertEquals(memberUserMapper.selectById(userDO.getId()).getPassword(),password);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ========== 随机对象 ==========
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
private static MemberUserDO randomUserDO(Consumer<MemberUserDO>... consumers) {
|
||||||
|
Consumer<MemberUserDO> consumer = (o) -> {
|
||||||
|
o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // 保证 status 的范围
|
||||||
|
o.setPassword(randomString());
|
||||||
|
};
|
||||||
|
return randomPojo(MemberUserDO.class, ArrayUtils.append(consumer, consumers));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,160 @@
|
||||||
|
package cn.iocoder.yudao.module.member.service.group;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.group.MemberGroupMapper;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.GROUP_HAS_USER;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.GROUP_NOT_EXISTS;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
// TODO 芋艿:完全 review 完,在去 review 单测
|
||||||
|
/**
|
||||||
|
* {@link MemberGroupServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
@Import(MemberGroupServiceImpl.class)
|
||||||
|
public class MemberGroupServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberGroupServiceImpl groupService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberGroupMapper groupMapper;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateGroup_success() {
|
||||||
|
// 准备参数
|
||||||
|
MemberGroupCreateReqVO reqVO = randomPojo(MemberGroupCreateReqVO.class,
|
||||||
|
o -> o.setStatus(randomCommonStatus()));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long groupId = groupService.createGroup(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(groupId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
MemberGroupDO group = groupMapper.selectById(groupId);
|
||||||
|
assertPojoEquals(reqVO, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateGroup_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberGroupDO dbGroup = randomPojo(MemberGroupDO.class);
|
||||||
|
groupMapper.insert(dbGroup);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
MemberGroupUpdateReqVO reqVO = randomPojo(MemberGroupUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbGroup.getId()); // 设置更新的 ID
|
||||||
|
o.setStatus(randomCommonStatus());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
groupService.updateGroup(reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
MemberGroupDO group = groupMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateGroup_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
MemberGroupUpdateReqVO reqVO = randomPojo(MemberGroupUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> groupService.updateGroup(reqVO), GROUP_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteGroup_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberGroupDO dbGroup = randomPojo(MemberGroupDO.class);
|
||||||
|
groupMapper.insert(dbGroup);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbGroup.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
groupService.deleteGroup(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(groupMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteGroup_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> groupService.deleteGroup(id), GROUP_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteGroup_hasUser() {
|
||||||
|
// mock 数据
|
||||||
|
MemberGroupDO dbGroup = randomPojo(MemberGroupDO.class);
|
||||||
|
groupMapper.insert(dbGroup);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbGroup.getId();
|
||||||
|
|
||||||
|
// mock 会员数据
|
||||||
|
when(memberUserService.getUserCountByGroupId(eq(id))).thenReturn(1L);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> groupService.deleteGroup(id), GROUP_HAS_USER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetGroupPage() {
|
||||||
|
String name = randomString();
|
||||||
|
int status = CommonStatusEnum.ENABLE.getStatus();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
MemberGroupDO dbGroup = randomPojo(MemberGroupDO.class, o -> { // 等会查询到
|
||||||
|
o.setName(name);
|
||||||
|
o.setStatus(status);
|
||||||
|
o.setCreateTime(buildTime(2023, 2, 18));
|
||||||
|
});
|
||||||
|
groupMapper.insert(dbGroup);
|
||||||
|
// 测试 name 不匹配
|
||||||
|
groupMapper.insert(cloneIgnoreId(dbGroup, o -> o.setName("")));
|
||||||
|
// 测试 status 不匹配
|
||||||
|
groupMapper.insert(cloneIgnoreId(dbGroup, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
groupMapper.insert(cloneIgnoreId(dbGroup, o -> o.setCreateTime(null)));
|
||||||
|
// 准备参数
|
||||||
|
MemberGroupPageReqVO reqVO = new MemberGroupPageReqVO();
|
||||||
|
reqVO.setName(name);
|
||||||
|
reqVO.setStatus(status);
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<MemberGroupDO> pageResult = groupService.getGroupPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbGroup, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,268 @@
|
||||||
|
package cn.iocoder.yudao.module.member.service.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelListReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelMapper;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomInt;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
// TODO 芋艿:完全 review 完,在去 review 单测
|
||||||
|
/**
|
||||||
|
* {@link MemberLevelServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
@Import(MemberLevelServiceImpl.class)
|
||||||
|
public class MemberLevelServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberLevelServiceImpl levelService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberLevelMapper memberlevelMapper;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MemberLevelRecordService memberLevelRecordService;
|
||||||
|
@MockBean
|
||||||
|
private MemberExperienceRecordService memberExperienceRecordService;
|
||||||
|
@MockBean
|
||||||
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateLevel_success() {
|
||||||
|
// 准备参数
|
||||||
|
MemberLevelCreateReqVO reqVO = randomPojo(MemberLevelCreateReqVO.class, o -> {
|
||||||
|
o.setDiscountPercent(randomInt());
|
||||||
|
o.setIcon(randomURL());
|
||||||
|
o.setBackgroundUrl(randomURL());
|
||||||
|
o.setStatus(randomCommonStatus());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long levelId = levelService.createLevel(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(levelId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
MemberLevelDO level = memberlevelMapper.selectById(levelId);
|
||||||
|
assertPojoEquals(reqVO, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateLevel_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberLevelDO dbLevel = randomPojo(MemberLevelDO.class);
|
||||||
|
memberlevelMapper.insert(dbLevel);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
MemberLevelUpdateReqVO reqVO = randomPojo(MemberLevelUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbLevel.getId()); // 设置更新的 ID
|
||||||
|
//以下要保持一致
|
||||||
|
o.setName(dbLevel.getName());
|
||||||
|
o.setLevel(dbLevel.getLevel());
|
||||||
|
o.setExperience(dbLevel.getExperience());
|
||||||
|
//以下是要修改的字段
|
||||||
|
o.setDiscountPercent(randomInt());
|
||||||
|
o.setIcon(randomURL());
|
||||||
|
o.setBackgroundUrl(randomURL());
|
||||||
|
o.setStatus(randomCommonStatus());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
levelService.updateLevel(reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
MemberLevelDO level = memberlevelMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateLevel_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
MemberLevelUpdateReqVO reqVO = randomPojo(MemberLevelUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> levelService.updateLevel(reqVO), LEVEL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteLevel_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberLevelDO dbLevel = randomPojo(MemberLevelDO.class);
|
||||||
|
memberlevelMapper.insert(dbLevel);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbLevel.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
levelService.deleteLevel(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(memberlevelMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteLevel_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> levelService.deleteLevel(id), LEVEL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetLevelList() {
|
||||||
|
// mock 数据
|
||||||
|
MemberLevelDO dbLevel = randomPojo(MemberLevelDO.class, o -> { // 等会查询到
|
||||||
|
o.setName("黄金会员");
|
||||||
|
o.setStatus(1);
|
||||||
|
});
|
||||||
|
memberlevelMapper.insert(dbLevel);
|
||||||
|
// 测试 name 不匹配
|
||||||
|
memberlevelMapper.insert(cloneIgnoreId(dbLevel, o -> o.setName("")));
|
||||||
|
// 测试 status 不匹配
|
||||||
|
memberlevelMapper.insert(cloneIgnoreId(dbLevel, o -> o.setStatus(0)));
|
||||||
|
// 准备参数
|
||||||
|
MemberLevelListReqVO reqVO = new MemberLevelListReqVO();
|
||||||
|
reqVO.setName("黄金会员");
|
||||||
|
reqVO.setStatus(1);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
List<MemberLevelDO> list = levelService.getLevelList(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, list.size());
|
||||||
|
assertPojoEquals(dbLevel, list.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateLevel_nameUnique() {
|
||||||
|
// 准备参数
|
||||||
|
String name = randomString();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
memberlevelMapper.insert(randomLevelDO(o -> o.setName(name)));
|
||||||
|
|
||||||
|
// 调用,校验异常
|
||||||
|
List<MemberLevelDO> list = memberlevelMapper.selectList();
|
||||||
|
assertServiceException(() -> levelService.validateNameUnique(list, null, name), LEVEL_NAME_EXISTS, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateLevel_nameUnique() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
String name = randomString();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
memberlevelMapper.insert(randomLevelDO(o -> o.setName(name)));
|
||||||
|
|
||||||
|
// 调用,校验异常
|
||||||
|
List<MemberLevelDO> list = memberlevelMapper.selectList();
|
||||||
|
assertServiceException(() -> levelService.validateNameUnique(list, id, name), LEVEL_NAME_EXISTS, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateLevel_levelUnique() {
|
||||||
|
// 准备参数
|
||||||
|
Integer level = randomInteger();
|
||||||
|
String name = randomString();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
memberlevelMapper.insert(randomLevelDO(o -> {
|
||||||
|
o.setLevel(level);
|
||||||
|
o.setName(name);
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 调用,校验异常
|
||||||
|
List<MemberLevelDO> list = memberlevelMapper.selectList();
|
||||||
|
assertServiceException(() -> levelService.validateLevelUnique(list, null, level), LEVEL_VALUE_EXISTS, level, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateLevel_levelUnique() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
Integer level = randomInteger();
|
||||||
|
String name = randomString();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
memberlevelMapper.insert(randomLevelDO(o -> {
|
||||||
|
o.setLevel(level);
|
||||||
|
o.setName(name);
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 调用,校验异常
|
||||||
|
List<MemberLevelDO> list = memberlevelMapper.selectList();
|
||||||
|
assertServiceException(() -> levelService.validateLevelUnique(list, id, level), LEVEL_VALUE_EXISTS, level, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateLevel_experienceOutRange() {
|
||||||
|
// 准备参数
|
||||||
|
int level = 10;
|
||||||
|
int experience = 10;
|
||||||
|
String name = randomString();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
memberlevelMapper.insert(randomLevelDO(o -> {
|
||||||
|
o.setLevel(level);
|
||||||
|
o.setExperience(experience);
|
||||||
|
o.setName(name);
|
||||||
|
}));
|
||||||
|
List<MemberLevelDO> list = memberlevelMapper.selectList();
|
||||||
|
|
||||||
|
// 调用,校验异常
|
||||||
|
assertServiceException(() -> levelService.validateExperienceOutRange(list, null, level + 1, experience - 1), LEVEL_EXPERIENCE_MIN, name, level);
|
||||||
|
// 调用,校验异常
|
||||||
|
assertServiceException(() -> levelService.validateExperienceOutRange(list, null, level - 1, experience + 1), LEVEL_EXPERIENCE_MAX, name, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateLevel_experienceOutRange() {
|
||||||
|
// 准备参数
|
||||||
|
int level = 10;
|
||||||
|
int experience = 10;
|
||||||
|
Long id = randomLongId();
|
||||||
|
String name = randomString();
|
||||||
|
|
||||||
|
// mock 数据
|
||||||
|
memberlevelMapper.insert(randomLevelDO(o -> {
|
||||||
|
o.setLevel(level);
|
||||||
|
o.setExperience(experience);
|
||||||
|
o.setName(name);
|
||||||
|
}));
|
||||||
|
List<MemberLevelDO> list = memberlevelMapper.selectList();
|
||||||
|
|
||||||
|
// 调用,校验异常
|
||||||
|
assertServiceException(() -> levelService.validateExperienceOutRange(list, id, level + 1, experience - 1), LEVEL_EXPERIENCE_MIN, name, level);
|
||||||
|
// 调用,校验异常
|
||||||
|
assertServiceException(() -> levelService.validateExperienceOutRange(list, id, level - 1, experience + 1), LEVEL_EXPERIENCE_MAX, name, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 随机对象 ==========
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
private static MemberLevelDO randomLevelDO(Consumer<MemberLevelDO>... consumers) {
|
||||||
|
Consumer<MemberLevelDO> consumer = (o) -> {
|
||||||
|
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
o.setDiscountPercent(randomInt(0, 100));
|
||||||
|
o.setIcon(randomURL());
|
||||||
|
o.setBackgroundUrl(randomURL());
|
||||||
|
};
|
||||||
|
return randomPojo(MemberLevelDO.class, ArrayUtils.append(consumer, consumers));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,133 @@
|
||||||
|
package cn.iocoder.yudao.module.member.service.tag;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.tag.MemberTagMapper;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.TAG_NOT_EXISTS;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
// TODO 芋艿:完全 review 完,在去 review 单测
|
||||||
|
/**
|
||||||
|
* {@link MemberTagServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Import(MemberTagServiceImpl.class)
|
||||||
|
public class MemberTagServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberTagServiceImpl tagService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberTagMapper tagMapper;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateTag_success() {
|
||||||
|
// 准备参数
|
||||||
|
MemberTagCreateReqVO reqVO = randomPojo(MemberTagCreateReqVO.class);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long tagId = tagService.createTag(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(tagId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
MemberTagDO tag = tagMapper.selectById(tagId);
|
||||||
|
assertPojoEquals(reqVO, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateTag_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberTagDO dbTag = randomPojo(MemberTagDO.class);
|
||||||
|
tagMapper.insert(dbTag);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
MemberTagUpdateReqVO reqVO = randomPojo(MemberTagUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbTag.getId()); // 设置更新的 ID
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
tagService.updateTag(reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
MemberTagDO tag = tagMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateTag_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
MemberTagUpdateReqVO reqVO = randomPojo(MemberTagUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> tagService.updateTag(reqVO), TAG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteTag_success() {
|
||||||
|
// mock 数据
|
||||||
|
MemberTagDO dbTag = randomPojo(MemberTagDO.class);
|
||||||
|
tagMapper.insert(dbTag);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbTag.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
tagService.deleteTag(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(tagMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteTag_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> tagService.deleteTag(id), TAG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTagPage() {
|
||||||
|
// mock 数据
|
||||||
|
MemberTagDO dbTag = randomPojo(MemberTagDO.class, o -> { // 等会查询到
|
||||||
|
o.setName("test");
|
||||||
|
o.setCreateTime(buildTime(2023, 2, 18));
|
||||||
|
});
|
||||||
|
tagMapper.insert(dbTag);
|
||||||
|
// 测试 name 不匹配
|
||||||
|
tagMapper.insert(cloneIgnoreId(dbTag, o -> o.setName("ne")));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
tagMapper.insert(cloneIgnoreId(dbTag, o -> o.setCreateTime(null)));
|
||||||
|
// 准备参数
|
||||||
|
MemberTagPageReqVO reqVO = new MemberTagPageReqVO();
|
||||||
|
reqVO.setName("test");
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<MemberTagDO> pageResult = tagService.getTagPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbTag, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
package cn.iocoder.yudao.module.member.service.user;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||||
|
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserUpdateMobileReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||||
|
import cn.iocoder.yudao.module.member.service.auth.MemberAuthServiceImpl;
|
||||||
|
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomNumbers;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
// TODO @芋艿:单测的 review,等逻辑都达成一致后
|
||||||
|
/**
|
||||||
|
* {@link MemberUserServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 宋天
|
||||||
|
*/
|
||||||
|
@Disabled
|
||||||
|
@Import({MemberUserServiceImpl.class, YudaoRedisAutoConfiguration.class})
|
||||||
|
public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserServiceImpl memberUserService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserMapper userMapper;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MemberAuthServiceImpl authService;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private SmsCodeApi smsCodeApi;
|
||||||
|
@MockBean
|
||||||
|
private FileApi fileApi;
|
||||||
|
|
||||||
|
// TODO 芋艿:后续重构这个单测
|
||||||
|
// @Test
|
||||||
|
// public void testUpdateNickName_success(){
|
||||||
|
// // mock 数据
|
||||||
|
// MemberUserDO userDO = randomUserDO();
|
||||||
|
// userMapper.insert(userDO);
|
||||||
|
//
|
||||||
|
// // 随机昵称
|
||||||
|
// String newNickName = randomString();
|
||||||
|
//
|
||||||
|
// // 调用接口修改昵称
|
||||||
|
// memberUserService.updateUser(userDO.getId(),newNickName);
|
||||||
|
// // 查询新修改后的昵称
|
||||||
|
// String nickname = memberUserService.getUser(userDO.getId()).getNickname();
|
||||||
|
// // 断言
|
||||||
|
// assertEquals(newNickName,nickname);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Test
|
||||||
|
// public void testUpdateAvatar_success() throws Exception {
|
||||||
|
// // mock 数据
|
||||||
|
// MemberUserDO dbUser = randomUserDO();
|
||||||
|
// userMapper.insert(dbUser);
|
||||||
|
//
|
||||||
|
// // 准备参数
|
||||||
|
// Long userId = dbUser.getId();
|
||||||
|
// byte[] avatarFileBytes = randomBytes(10);
|
||||||
|
// ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes);
|
||||||
|
// // mock 方法
|
||||||
|
// String avatar = randomString();
|
||||||
|
// when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar);
|
||||||
|
// // 调用
|
||||||
|
// String str = memberUserService.updateUserAvatar(userId, avatarFile);
|
||||||
|
// // 断言
|
||||||
|
// assertEquals(avatar, str);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled // TODO 芋艿:后续再修复
|
||||||
|
public void updateMobile_success(){
|
||||||
|
// mock数据
|
||||||
|
String oldMobile = randomNumbers(11);
|
||||||
|
MemberUserDO userDO = randomUserDO();
|
||||||
|
userDO.setMobile(oldMobile);
|
||||||
|
userMapper.insert(userDO);
|
||||||
|
|
||||||
|
// TODO 芋艿:需要修复该单元测试,重构多模块带来的
|
||||||
|
// 旧手机和旧验证码
|
||||||
|
// SmsCodeDO codeDO = new SmsCodeDO();
|
||||||
|
String oldCode = RandomUtil.randomString(4);
|
||||||
|
// codeDO.setMobile(userDO.getMobile());
|
||||||
|
// codeDO.setCode(oldCode);
|
||||||
|
// codeDO.setScene(SmsSceneEnum.MEMBER_UPDATE_MOBILE.getScene());
|
||||||
|
// codeDO.setUsed(Boolean.FALSE);
|
||||||
|
// when(smsCodeService.checkCodeIsExpired(codeDO.getMobile(),codeDO.getCode(),codeDO.getScene())).thenReturn(codeDO);
|
||||||
|
|
||||||
|
// 更新手机号
|
||||||
|
String newMobile = randomNumbers(11);
|
||||||
|
String newCode = randomNumbers(4);
|
||||||
|
AppMemberUserUpdateMobileReqVO reqVO = new AppMemberUserUpdateMobileReqVO();
|
||||||
|
reqVO.setMobile(newMobile);
|
||||||
|
reqVO.setCode(newCode);
|
||||||
|
reqVO.setOldCode(oldCode);
|
||||||
|
memberUserService.updateUserMobile(userDO.getId(),reqVO);
|
||||||
|
|
||||||
|
assertEquals(memberUserService.getUser(userDO.getId()).getMobile(),newMobile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 随机对象 ==========
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
private static MemberUserDO randomUserDO(Consumer<MemberUserDO>... consumers) {
|
||||||
|
Consumer<MemberUserDO> consumer = (o) -> {
|
||||||
|
o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // 保证 status 的范围
|
||||||
|
};
|
||||||
|
return randomPojo(MemberUserDO.class, ArrayUtils.append(consumer, consumers));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
lazy-initialization: true # 开启懒加载,加快速度
|
||||||
|
banner-mode: off # 单元测试,禁用 Banner
|
||||||
|
|
||||||
|
--- #################### 数据库相关配置 ####################
|
||||||
|
|
||||||
|
spring:
|
||||||
|
# 数据源配置项
|
||||||
|
datasource:
|
||||||
|
name: ruoyi-vue-pro
|
||||||
|
url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
|
||||||
|
driver-class-name: org.h2.Driver
|
||||||
|
username: sa
|
||||||
|
password:
|
||||||
|
druid:
|
||||||
|
async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
|
||||||
|
initial-size: 1 # 单元测试,配置为 1,提升启动速度
|
||||||
|
sql:
|
||||||
|
init:
|
||||||
|
schema-locations: classpath:/sql/create_tables.sql
|
||||||
|
|
||||||
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1 # 地址
|
||||||
|
port: 16379 # 端口(单元测试,使用 16379 端口)
|
||||||
|
database: 0 # 数据库索引
|
||||||
|
|
||||||
|
mybatis:
|
||||||
|
lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
|
||||||
|
|
||||||
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
|
||||||
|
--- #################### 配置中心相关配置 ####################
|
||||||
|
|
||||||
|
--- #################### 服务保障相关配置 ####################
|
||||||
|
|
||||||
|
# Lock4j 配置项(单元测试,禁用 Lock4j)
|
||||||
|
|
||||||
|
--- #################### 监控相关配置 ####################
|
||||||
|
|
||||||
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
|
# 芋道配置项,设置当前项目所有自定义的配置
|
||||||
|
yudao:
|
||||||
|
info:
|
||||||
|
base-package: cn.iocoder.yudao.module
|
|
@ -0,0 +1,4 @@
|
||||||
|
<configuration>
|
||||||
|
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||||
|
</configuration>
|
|
@ -0,0 +1,5 @@
|
||||||
|
DELETE FROM "member_user";
|
||||||
|
DELETE FROM "member_address";
|
||||||
|
DELETE FROM "member_tag";
|
||||||
|
DELETE FROM "member_level";
|
||||||
|
DELETE FROM "member_group";
|
|
@ -0,0 +1,113 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS "member_user"
|
||||||
|
(
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
|
||||||
|
"nickname" varchar(30) NOT NULL DEFAULT '' COMMENT '用户昵称',
|
||||||
|
"name" varchar(30) NULL COMMENT '真实名字',
|
||||||
|
sex tinyint null comment '性别',
|
||||||
|
birthday datetime null comment '出生日期',
|
||||||
|
area_id int null comment '所在地',
|
||||||
|
mark varchar(255) null comment '用户备注',
|
||||||
|
point int default 0 null comment '积分',
|
||||||
|
"avatar" varchar(255) NOT NULL DEFAULT '' COMMENT '头像',
|
||||||
|
"status" tinyint NOT NULL COMMENT '状态',
|
||||||
|
"mobile" varchar(11) NOT NULL COMMENT '手机号',
|
||||||
|
"password" varchar(100) NOT NULL DEFAULT '' COMMENT '密码',
|
||||||
|
"register_ip" varchar(32) NOT NULL COMMENT '注册 IP',
|
||||||
|
"login_ip" varchar(50) NULL DEFAULT '' COMMENT '最后登录IP',
|
||||||
|
"login_date" datetime NULL DEFAULT NULL COMMENT '最后登录时间',
|
||||||
|
"tag_ids" varchar(255) NULL DEFAULT NULL COMMENT '用户标签编号列表,以逗号分隔',
|
||||||
|
"level_id" bigint NULL DEFAULT NULL COMMENT '等级编号',
|
||||||
|
"experience" bigint NULL DEFAULT NULL COMMENT '经验',
|
||||||
|
"group_id" bigint NULL DEFAULT NULL COMMENT '用户分组编号',
|
||||||
|
"creator" varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
"updater" varchar(64) NULL DEFAULT '' COMMENT '更新者',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
"deleted" bit(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||||
|
"tenant_id" bigint not null default '0',
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '会员表';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "member_address" (
|
||||||
|
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"user_id" bigint(20) NOT NULL,
|
||||||
|
"name" varchar(10) NOT NULL,
|
||||||
|
"mobile" varchar(20) NOT NULL,
|
||||||
|
"area_id" bigint(20) NOT NULL,
|
||||||
|
"detail_address" varchar(250) NOT NULL,
|
||||||
|
"default_status" bit NOT NULL,
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"creator" varchar(64) DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
"updater" varchar(64) DEFAULT '',
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '用户收件地址';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "member_tag"
|
||||||
|
(
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
"tenant_id" bigint NOT NULL default '0',
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '会员标签';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "member_level"
|
||||||
|
(
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"experience" int NOT NULL,
|
||||||
|
"level" int NOT NULL,
|
||||||
|
"discount_percent" int NOT NULL,
|
||||||
|
"icon" varchar NOT NULL,
|
||||||
|
"background_url" varchar NOT NULL,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
"tenant_id" bigint not null default '0',
|
||||||
|
"status" tinyint NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '会员等级';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "member_group"
|
||||||
|
(
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"remark" varchar NOT NULL,
|
||||||
|
"status" tinyint NOT NULL DEFAULT '0',
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
"tenant_id" bigint not null default '0',
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '用户分组';
|
||||||
|
CREATE TABLE IF NOT EXISTS "member_brokerage_record"
|
||||||
|
(
|
||||||
|
"id" int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"user_id" bigint NOT NULL,
|
||||||
|
"biz_id" varchar NOT NULL,
|
||||||
|
"biz_type" varchar NOT NULL,
|
||||||
|
"title" varchar NOT NULL,
|
||||||
|
"price" int NOT NULL,
|
||||||
|
"total_price" int NOT NULL,
|
||||||
|
"description" varchar NOT NULL,
|
||||||
|
"status" varchar NOT NULL,
|
||||||
|
"frozen_days" int NOT NULL,
|
||||||
|
"unfreeze_time" varchar,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
"tenant_id" bigint not null default '0',
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '佣金记录';
|
|
@ -101,6 +101,13 @@
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- portal 门户网站模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-portal-biz</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- AI 大模型相关模块。默认注释,保证编译速度 -->
|
<!-- AI 大模型相关模块。默认注释,保证编译速度 -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
|
|
Loading…
Reference in New Issue