Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
5bd6820f
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5bd6820f
编写于
10月 07, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:新增枚举类
上级
1cf2bc72
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
117 deletion
+39
-117
src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java
...pringbootkwan/controller/InterviewQuestionController.java
+10
-0
src/main/java/com/kwan/springbootkwan/enums/InterviewQuestionTypeEnum.java
.../kwan/springbootkwan/enums/InterviewQuestionTypeEnum.java
+0
-115
src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java
...kwan/springbootkwan/service/InterviewQuestionService.java
+6
-0
src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java
...ngbootkwan/service/impl/InterviewQuestionServiceImpl.java
+23
-2
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java
浏览文件 @
5bd6820f
...
...
@@ -54,6 +54,16 @@ public class InterviewQuestionController {
return
Result
.
ok
(
this
.
interviewQuestionService
.
questionType
());
}
/**
* 获取所有的面试题的种类的数量
*
* @return
*/
@GetMapping
(
"/allQuestionType"
)
public
Result
allQuestionType
()
{
return
Result
.
ok
(
this
.
interviewQuestionService
.
allQuestionType
());
}
/**
* 分页查询所有数据
*
...
...
src/main/java/com/kwan/springbootkwan/enums/InterviewQuestionTypeEnum.java
已删除
100644 → 0
浏览文件 @
1cf2bc72
package
com.kwan.springbootkwan.enums
;
import
lombok.Getter
;
import
lombok.ToString
;
@Getter
@ToString
public
enum
InterviewQuestionTypeEnum
{
/**
* 全部
*/
type_00
(
0
,
"全部"
),
/**
* 基础知识
*/
type_01
(
1
,
"基础知识"
),
/**
* 集合
*/
type_02
(
2
,
"集合"
),
/**
* JVM
*/
type_03
(
3
,
"JVM"
),
/**
* 并发编程
*/
type_04
(
4
,
"并发编程"
),
/**
* MySql
*/
type_05
(
5
,
"MySql"
),
/**
* Redis
*/
type_06
(
6
,
"Redis"
),
/**
* 中间件
*/
type_07
(
7
,
"中间件"
),
/**
* Spring
*/
type_08
(
8
,
"Spring"
),
/**
* 微服务
*/
type_09
(
9
,
"微服务"
),
/**
* 分布式
*/
type_10
(
10
,
"分布式"
),
/**
* 项目
*/
type_11
(
11
,
"项目"
),
/**
* 算法
*/
type_12
(
12
,
"算法"
),
/**
* 反问环节
*/
type_13
(
13
,
"反问环节"
),
/**
* 设计模式
*/
type_14
(
14
,
"设计模式"
),
/**
* 其他
*/
type_99
(
99
,
"其他"
);
private
Integer
code
;
private
String
name
;
InterviewQuestionTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
/**
* 通过code获取name
*
* @param code
* @return
*/
public
static
String
getNameByCode
(
Integer
code
)
{
for
(
InterviewQuestionTypeEnum
enums
:
InterviewQuestionTypeEnum
.
values
())
{
if
(
enums
.
getCode
().
equals
(
code
))
{
return
enums
.
getName
();
}
}
return
null
;
}
/**
* 通过value取枚举
*
* @param value
* @return
*/
public
static
InterviewQuestionTypeEnum
getBrandDetailNoByValue
(
String
value
)
{
if
(
null
==
value
)
{
return
null
;
}
for
(
InterviewQuestionTypeEnum
enums
:
InterviewQuestionTypeEnum
.
values
())
{
if
(
enums
.
getCode
().
equals
(
value
))
{
return
enums
;
}
}
return
null
;
}
}
src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java
浏览文件 @
5bd6820f
...
...
@@ -27,4 +27,10 @@ public interface InterviewQuestionService extends IService<InterviewQuestion> {
* @return
*/
List
<
InterviewQuestionTypeDTO
>
questionType
();
/**
* 获取所有的类型
*
* @return
*/
List
<
InterviewQuestionTypeDTO
>
allQuestionType
();
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java
浏览文件 @
5bd6820f
...
...
@@ -2,10 +2,11 @@ package com.kwan.springbootkwan.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springbootkwan.entity.DictionaryManagement
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO
;
import
com.kwan.springbootkwan.enums.InterviewQuestionTypeEnum
;
import
com.kwan.springbootkwan.mapper.InterviewQuestionMapper
;
import
com.kwan.springbootkwan.service.DictionaryManagementService
;
import
com.kwan.springbootkwan.service.InterviewQuestionService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,6 +18,7 @@ import java.nio.file.Path;
import
java.nio.file.Paths
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 面试题(InterviewQuestion)表服务实现类
...
...
@@ -30,6 +32,8 @@ public class InterviewQuestionServiceImpl extends ServiceImpl<InterviewQuestionM
@Resource
private
InterviewQuestionMapper
interviewQuestionMapper
;
@Resource
private
DictionaryManagementService
dictionaryManagementService
;
@Override
public
boolean
uploadFile
(
String
path
)
{
...
...
@@ -60,13 +64,30 @@ public class InterviewQuestionServiceImpl extends ServiceImpl<InterviewQuestionM
@Override
public
List
<
InterviewQuestionTypeDTO
>
questionType
()
{
final
List
<
InterviewQuestionTypeDTO
>
interviewQuestionTypeDTOS
=
this
.
allQuestionType
();
//获取种类,并按数量排序
LinkedList
<
InterviewQuestionTypeDTO
>
types
=
interviewQuestionMapper
.
questionType
();
types
.
addFirst
(
new
InterviewQuestionTypeDTO
(
0
,
"全部"
,
0
));
for
(
InterviewQuestionTypeDTO
interviewQuestionTypeDTO
:
types
)
{
//数据库存的是问题类型的编码
interviewQuestionTypeDTO
.
setName
(
InterviewQuestionTypeEnum
.
getNameByCode
(
interviewQuestionTypeDTO
.
getQuestionType
()));
final
InterviewQuestionTypeDTO
item
=
interviewQuestionTypeDTOS
.
stream
().
filter
(
x
->
x
.
getQuestionType
().
equals
(
interviewQuestionTypeDTO
.
getQuestionType
())).
findFirst
().
get
();
interviewQuestionTypeDTO
.
setName
(
item
.
getName
());
}
return
types
;
}
@Override
public
List
<
InterviewQuestionTypeDTO
>
allQuestionType
()
{
QueryWrapper
<
DictionaryManagement
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"dict_type"
,
1
);
wrapper
.
eq
(
"is_delete"
,
0
);
final
List
<
DictionaryManagement
>
list
=
dictionaryManagementService
.
list
(
wrapper
);
return
list
.
stream
()
.
map
(
item
->
{
InterviewQuestionTypeDTO
interviewQuestionTypeDTO
=
new
InterviewQuestionTypeDTO
();
interviewQuestionTypeDTO
.
setQuestionType
(
item
.
getCode
());
interviewQuestionTypeDTO
.
setName
(
item
.
getName
());
return
interviewQuestionTypeDTO
;
}).
collect
(
Collectors
.
toList
());
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录